|
XML for Java Compatibility API 2.0.13 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.xml.parser.Child | +--com.ibm.xml.parser.TXCharacterData | +--com.ibm.xml.parser.PseudoNode
PseudoNode provides support, in place of actual DOM Nodes, for generated document objects when document validity is not an issue. PseudoNodes are useful when an application does not care about the validity of a document's structure, and wishes to quickly specify a literal string to represent the Node.
PseudoNodes can be added to TXDocument, TXElement, or DTD objects in order to expediently print text.
For example, instead of specifying an Element hierarchy as:
TXElement root = factory.createElement("PERSON"); TXElement item = factory.createElement("NAME"); // Make <NAME>John Doe</NAME> item.addElement(factory.createText("John Doe")); root.addElement(item); item = factory.createElement("AGE"); // Make <AGE>35</AGE> item.addElement(factory.createText("35")); root.addElement(item); item = factory.createElement("EMAIL"); // Make <EMAIL>John.Doe@foo.com</EMAIL> item.addElement(factory.createText("John.Doe@foo.com")); root.addElement(item); // Now root has NAME, AGE, and EMAIL. doc.addElement(root);
...using PsuedoNode you can instead specify:
doc.addElement(new PseudoNode("<PERSON><NAME>John Doe</NAME><AGE>35</AGE><EMAIL>John.Doe@foo.com</EMAIL></PERSON>"));
Note that because of the requirement for validation, the object tree produced by the XML4J parser doesn't include PseudoNodes.
Child
, Serialized FormFields inherited from class com.ibm.xml.parser.Child |
ATTDEF,
ATTLIST,
ELEMENT_DECL,
NAME_ATTDEF,
NAME_ATTLIST,
NAME_CDATA,
NAME_COMMENT,
NAME_DOCFRAGMENT,
NAME_DOCUMENT,
NAME_ELEMENT_DECL,
NAME_PSEUDONODE,
NAME_TEXT,
PSEUDONODE |
Constructor Summary | |
PseudoNode(java.lang.String data)
Constructor. |
Method Summary | |
void |
acceptPost(Visitor visitor)
Implements the accept operation of the visitor design pattern when the end of a PseudoNode is recognized when traversing the document object tree. |
void |
acceptPre(Visitor visitor)
Implements the accept operation of the visitor design pattern when the start of a PseudoNode is recognized when traversing the document object tree. |
java.lang.Object |
clone()
Clone this Pseudo Node using the appropriate factory. |
boolean |
equals(org.w3c.dom.Node arg,
boolean deep)
|
java.lang.String |
getNodeName()
|
short |
getNodeType()
Returns that this object is a Pseudo Node. |
java.lang.String |
getText()
Returns all text associated with this Node without considering entities. |
Methods inherited from class com.ibm.xml.parser.TXCharacterData |
appendData,
deleteData,
getData,
getLength,
getNodeValue,
insertData,
replaceData,
setData,
setNodeValue,
substringData |
Methods inherited from class com.ibm.xml.parser.Child |
appendChild,
clearDigest,
cloneNode,
getAttributes,
getChildNodes,
getDigest,
getFactory,
getFirstChild,
getFirstWithoutReference,
getLastChild,
getLastWithoutReference,
getNextSibling,
getNextWithoutReference,
getOwnerDocument,
getParentNode,
getParentWithoutReference,
getPreviousSibling,
getPreviousWithoutReference,
getUserData,
hasChildNodes,
insertBefore,
makeXPointer,
print,
print,
removeChild,
replaceChild,
searchAncestors,
searchAncestors,
setFactory,
setUserData,
toXMLString,
toXMLString |
Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public PseudoNode(java.lang.String data)
data
- The actual content of the Pseudo Node.Method Detail |
public java.lang.Object clone()
This method is defined by Child.
Child.clone()
public short getNodeType()
This method is defined by DOM.
public java.lang.String getNodeName()
public boolean equals(org.w3c.dom.Node arg, boolean deep)
public java.lang.String getText()
This method is defined by Child.
Child.toXMLString(java.io.Writer, java.lang.String)
,
TXCharacterData.getData()
public void acceptPre(Visitor visitor) throws java.lang.Exception
visitor
- The implemention of the Visitor operation (toXMLString, digest, ...)Visitor
,
TreeTraversal
,
NonRecursivePreorderTreeTraversal
,
TreeTraversalException
public void acceptPost(Visitor visitor) throws java.lang.Exception
visitor
- The implemention of the Visitor operation (toXMLString, digest, ...)Visitor
,
TreeTraversal
,
NonRecursivePreorderTreeTraversal
,
TreeTraversalException
|
XML for Java Compatibility API 2.0.13 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |