Skip navigation links

Oracle Security Developer Tools XML Security Java API Reference
11g (11.1.1)

E10680-02


oracle.security.xmlsec.util
Class NodeReader

java.lang.Object
  extended by oracle.security.xmlsec.util.NodeReader

Direct Known Subclasses:
FilteredNodeReader, NodeReaderForNodeset, NodeReaderForSAX, NodeReaderForStAX, NodeReaderForSubtree

public abstract class NodeReader
extends java.lang.Object

FOR INTERNAL USE ONLY


Nested Class Summary
static interface NodeReader.NodeListener
          NodeListeners are only required in "Push mode" i.e.

 

Field Summary
static int CHARACTERS
           
static int COMMENT
           
static int DTD
           
static int END_DOCUMENT
           
static int END_ELEMENT
           
static int PROCESSING_INSTRUCTION
           
static int START_DOCUMENT
           
static int START_ELEMENT
           

 

Constructor Summary
NodeReader()
           

 

Method Summary
 void addListener(NodeReader.NodeListener nodeListener)
          register for consumeNode event.
protected  void fireConsumeNode()
          trigger consumeNode event on all the listeners.
 java.util.Collection getAncestorXmlAttributes(boolean c14n11)
          Get a list of all the xml attributes in the ancestors of this element, whether the elements are in the nodeset or not.
abstract  java.util.Iterator getAttributes()
          Returns all the namespaces and attributes on this START_ELEMENT.
abstract  int getEventType()
          Returns an integer code that indicates the type of the event the cursor is pointing to START_ELEMENT END_ELEMENT PROCESSING_INSTRUCTION CHARACTERS COMMENT START_DOCUMENT END_DOCUMENT
abstract  java.lang.String getLocalName()
          Returns the (local) name of the current event.
 java.util.Map getNamespaces()
          Returns all the namespaces on this START_ELEMENT.
 java.util.Iterator getNamespacesForMissingAncestors()
          Returns those inherited namespace declaration, for which the ancestor element that declares the namespace is missing from the nodeset.
abstract  java.lang.String getNamespaceURI()
          If the current event is a START_ELEMENT or END_ELEMENT this method returns the URI of the prefix or the default namespace
 org.w3c.dom.Node getNode()
          Returns the current node.
abstract  java.lang.String getPIData()
          Get the data section of a processing instruction
abstract  java.lang.String getPITarget()
          Get the target of a processing instruction
abstract  java.lang.String getPrefix()
          Returns the prefix of the current event or null if the event does not have a prefix
 java.util.SortedMap getSortedAttributes()
          Returns all the attributes (not namespaces) on this START_ELEMENT.
abstract  char[] getText()
          Returns the current value of the parse event as a character array, this returns the string value of a CHARACTERS event, returns the value of a COMMENT,
abstract  int getTextLength()
           
abstract  int getTextStart()
           
abstract  boolean hasNext()
          Returns true if there are more parsing events and false if there are no more events.
 boolean isElementAnOrphan()
          Returns whether this element in an orphan (i.e the element is included but its parent is not included in the nodeset).
 boolean isElementIncluded()
          For special case when some of an element's attributes are in the node set but the element itself is not
 boolean isElementInheritingNamespaces()
          Whether the element inherits all the namespaces of its parents.
 boolean isUnnecessaryEmptyDefaultNsRequired()
          This is only used for STR-Transform and Decrpyt Transform where apex nodes in replacement nodesets should have xmlns="" if the apex node doesn't define the default namespace.
abstract  int next()
          Get next parsing event.
 void removeListener(NodeReader.NodeListener nodeListener)
          unregister for consumeNode event.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

START_ELEMENT

public static final int START_ELEMENT
See Also:
Constant Field Values

END_ELEMENT

public static final int END_ELEMENT
See Also:
Constant Field Values

PROCESSING_INSTRUCTION

public static final int PROCESSING_INSTRUCTION
See Also:
Constant Field Values

CHARACTERS

public static final int CHARACTERS
See Also:
Constant Field Values

COMMENT

public static final int COMMENT
See Also:
Constant Field Values

START_DOCUMENT

public static final int START_DOCUMENT
See Also:
Constant Field Values

END_DOCUMENT

public static final int END_DOCUMENT
See Also:
Constant Field Values

DTD

public static final int DTD
See Also:
Constant Field Values

Constructor Detail

NodeReader

public NodeReader()

Method Detail

hasNext

public abstract boolean hasNext()
                         throws NodeReaderException
Returns true if there are more parsing events and false if there are no more events.
Returns:
Throws:
NodeReaderException

next

public abstract int next()
                  throws NodeReaderException
Get next parsing event. one of
Returns:
Throws:
NodeReaderException

getEventType

public abstract int getEventType()
Returns an integer code that indicates the type of the event the cursor is pointing to
Returns:

getLocalName

public abstract java.lang.String getLocalName()
Returns the (local) name of the current event.

getNamespaceURI

public abstract java.lang.String getNamespaceURI()
If the current event is a START_ELEMENT or END_ELEMENT this method returns the URI of the prefix or the default namespace

getPrefix

public abstract java.lang.String getPrefix()
Returns the prefix of the current event or null if the event does not have a prefix

getText

public abstract char[] getText()
Returns the current value of the parse event as a character array, this returns the string value of a CHARACTERS event, returns the value of a COMMENT,
Returns:

getTextStart

public abstract int getTextStart()

getTextLength

public abstract int getTextLength()

getPIData

public abstract java.lang.String getPIData()
Get the data section of a processing instruction

getPITarget

public abstract java.lang.String getPITarget()
Get the target of a processing instruction

isElementIncluded

public boolean isElementIncluded()
For special case when some of an element's attributes are in the node set but the element itself is not

getNode

public org.w3c.dom.Node getNode()
Returns the current node. It is ok for this method to return null, it will do that for a non DOM implementation

getAttributes

public abstract java.util.Iterator getAttributes()
Returns all the namespaces and attributes on this START_ELEMENT.

All NodeReaders must implement this. Additionally a node reader may implement the getNamespaces() and getSortedAttributes() methods to return the namespaces and attributes separately.


getSortedAttributes

public java.util.SortedMap getSortedAttributes()
Returns all the attributes (not namespaces) on this START_ELEMENT. This method only exists for performance. If this method returns null then the getAttributes() method is used, The map should contain Attr->DUMMY. the map should use StreamC14nImpl.AttrComparator as its comparator to sort the attributes

getNamespaces

public java.util.Map getNamespaces()
Returns all the namespaces on this START_ELEMENT. This method only exists for performance. If this method returns null then the getAttributes() method is used The map should contain Prefix->NamespaceNode

isElementAnOrphan

public boolean isElementAnOrphan()
Returns whether this element in an orphan (i.e the element is included but its parent is not included in the nodeset). This is used in inclusiveC14N

getAncestorXmlAttributes

public java.util.Collection getAncestorXmlAttributes(boolean c14n11)
                                              throws NodeReaderException
Get a list of all the xml attributes in the ancestors of this element, whether the elements are in the nodeset or not. This is used in inclusive C14N.
Parameters:
c14n11 - follow C14n 1.1 rules, i.e. for simple inheritable attributes - xml:lang and xml:space, return the nearest ancestor, and for xml:base merge the values from missing ancestors
Throws:
NodeReaderException

isElementInheritingNamespaces

public boolean isElementInheritingNamespaces()
Whether the element inherits all the namespaces of its parents. Normally it does, but only in case of an XPath nodeset, each element has its own list of namespace nodes and this is false

getNamespacesForMissingAncestors

public java.util.Iterator getNamespacesForMissingAncestors()
Returns those inherited namespace declaration, for which the ancestor element that declares the namespace is missing from the nodeset. Note: these namespaces should also included in the namespaces returned by getAttributes and getNamespaces

E.gfor this xml <foo xmlns:n1="n1"> <bar xmlns:n2="n2"/> </foo> if foo is not included in the nodeset, but bar is included, bar inherits the n1 namespace declaration. So n1 should be returned by this function and both n1 and n2 should be returned by getAttributes

Returns:

isUnnecessaryEmptyDefaultNsRequired

public boolean isUnnecessaryEmptyDefaultNsRequired()
This is only used for STR-Transform and Decrpyt Transform where apex nodes in replacement nodesets should have xmlns="" if the apex node doesn't define the default namespace. Note xmlns="" is required to be output even if that been output before and even if it not used
Returns:

addListener

public void addListener(NodeReader.NodeListener nodeListener)
register for consumeNode event. Only required in "Push Mode" ie in SAX
Parameters:
nodeListener -

removeListener

public void removeListener(NodeReader.NodeListener nodeListener)
unregister for consumeNode event. Only required in "Push Mode" ie in SAX
Parameters:
nodeListener -

fireConsumeNode

protected void fireConsumeNode()
                        throws NodeReaderException
trigger consumeNode event on all the listeners. Only used in "Push Mode" ie in SAX
Throws:
NodeReaderException

Skip navigation links

Oracle Security Developer Tools XML Security Java API Reference
11g (11.1.1)

E10680-02


Copyright © 2005, 2009, Oracle. All rights reserved.