|
XML for Java Compatibility API 2.0.6 | ||||||||
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.Parent | +--com.ibm.xml.parser.TXDocument
The TXDocument class implements the Document interface as defined by the Document Object Model (DOM).
The Document object represents the entire XML document. Conceptually, it is the root of the document tree, and provides the primary access to the document's data.
Document
,
Parent
,
Child
,
Parser.setElementFactory(com.ibm.xml.parser.TXDocument)
, Serialized FormField Summary | |
java.lang.String |
expandedNameSeparator
|
Fields 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 | |
TXDocument()
Constructor. |
Method Summary | |
void |
acceptPost(Visitor visitor)
Implements the accept operation of the visitor design pattern when the end of a TXDocument Node 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 TXDocument Node is recognized when traversing the document object tree. |
protected void |
checkChildType(org.w3c.dom.Node child)
Check whether child is allowed to be insered in this node or not. |
java.lang.Object |
clone()
Clone this Document Node and its children using the appropriate factories. |
org.w3c.dom.Node |
cloneNode(boolean deep)
|
AttDef |
createAttDef(java.lang.String name)
Create and initialize a AttDef instance using the supplied parameters. |
Attlist |
createAttlist(java.lang.String name)
Create and initialize a Attlist instance using the supplied parameters. |
org.w3c.dom.Attr |
createAttribute(java.lang.String name)
Create and return a new Attr . |
org.w3c.dom.CDATASection |
createCDATASection(java.lang.String data)
Create and initialize a TXCDATASection instance using the supplied parameters. |
org.w3c.dom.Comment |
createComment(java.lang.String data)
Create and initialize a TXComment instance using the supplied parameters. |
ContentModel |
createContentModel(CMNode modelGroupNode)
Create and initialize a ContentModel instance using the supplied parameters. |
ContentModel |
createContentModel(int type)
Create and initialize a ContentModel instance using the supplied parameters. |
org.w3c.dom.DocumentFragment |
createDocumentFragment()
This method is defined by DOM. |
DTD |
createDTD()
Create and initialize a DTD instance. |
DTD |
createDTD(java.lang.String name,
ExternalID externalID)
Create and initialize a DTD instance using the supplied parameters. |
org.w3c.dom.Element |
createElement(java.lang.String name)
Create and initialize a TXElement instance using the supplied parameters. |
ElementDecl |
createElementDecl(java.lang.String name,
ContentModel contentModel)
Create and initialize a ElementDecl instance using the supplied parameters. |
org.w3c.dom.Entity |
createEntity()
This method is defined by DOM. |
EntityDecl |
createEntityDecl(java.lang.String name,
ExternalID externalID,
boolean isParameter,
java.lang.String ndata)
Create and initialize a EntityDecl instance using the supplied parameters. |
EntityDecl |
createEntityDecl(java.lang.String name,
java.lang.String value,
boolean isParameter)
Create and initialize a EntityDecl instance using the supplied parameters. |
org.w3c.dom.EntityReference |
createEntityReference(java.lang.String name)
Create and initialize a EntityReference instance using the supplied parameters. |
java.security.MessageDigest |
createMessageDigest()
Returns a newly created MessageDigest instance if none currently exists,
or resets the existing digest. |
TXNotation |
createNotation(java.lang.String name,
ExternalID externalID)
Create and initialize a TXNotation instance using the supplied parameters. |
org.w3c.dom.ProcessingInstruction |
createProcessingInstruction(java.lang.String name,
java.lang.String data)
Create and initialize a TXPI instance using the supplied parameters. |
StylesheetPI |
createStylesheetPI(java.lang.String name,
java.lang.String data,
java.lang.String type,
java.lang.String hrefURI,
java.lang.String title)
Create and initialize a StylesheetPI instance using the supplied parameters. |
TXText |
createTextNode(char[] charArray,
int offset,
int length,
boolean isIgnorableWhitespace)
Create and initialize a TXText instance using the supplied parameters. |
org.w3c.dom.Text |
createTextNode(java.lang.String data)
Create and initialize a TXText instance using the supplied parameters. |
TXText |
createTextNode(java.lang.String data,
boolean isIgnorableWhitespace)
Create and initialize a TXText instance using the supplied parameters. |
boolean |
equals(org.w3c.dom.Node arg,
boolean deep)
|
org.w3c.dom.DocumentType |
getDoctype()
Returns this Document's Type Definition (DTD) as a Node. |
org.w3c.dom.Element |
getDocumentElement()
Returns this Document's root Element. |
DTD |
getDTD()
Returns this Document's Type Definition (DTD) as a DTD. |
org.w3c.dom.NodeList |
getElementsByTagName(java.lang.String qName)
Returns a NodeList of matches through all child Element Nodes. |
java.lang.String |
getEncoding()
Returns the value of the XML encoding parameter from the XML prolog declaration (e.g. |
TXDocument |
getFactory()
|
org.w3c.dom.DOMImplementation |
getImplementation()
Return an instance of DOMImplementation handling this document. |
static TXDocument |
getInstance()
Returns the current TXDocument instance; if an instance
does not currently exist, it will be created. |
java.lang.String |
getNodeName()
|
short |
getNodeType()
Returns that this object is a Document Node. |
org.w3c.dom.Document |
getOwnerDocument()
Returns null. |
java.lang.String |
getRootName()
Returns the name of this Document's root Element (not DTD). |
java.lang.String |
getStandalone()
Returns if this Document is standalone. |
java.lang.String |
getText()
Return all text associated with this Node and its children without considering entities. |
java.lang.String |
getVersion()
Returns the XML version of this Document from the XML prolog declaration (e.g. |
boolean |
isAddFixedAttributes()
Returns a flag whether #FIXED attributes are automatically added. |
boolean |
isCheckNodeLoop()
Returns a flag whether new child is an ancestor of a parent. |
boolean |
isCheckOwnerDocument()
Returns a flag whether new child was created from another document. |
boolean |
isCheckValidity()
Returns whether validity constraints are checked in this doument. |
boolean |
isProcessNamespace()
Returns whether namespaces are considered. |
boolean |
isStandalone()
Returns if this Document is standalone. |
void |
printWithFormat(java.io.Writer pw)
Format and print this Node and any children in XML format using the default character encoding. |
void |
printWithFormat(java.io.Writer pw,
java.lang.String encoding)
Format and print this Node and any children in XML format using the specified character encoding. |
void |
printWithFormat(java.io.Writer pw,
java.lang.String encoding,
int indent)
Format and print this Node and any children in XML format, using the specified character encoding, and indented by indent spaces. |
protected void |
realInsert(org.w3c.dom.Node child,
int index)
Insert a Child Node into the specified position. |
org.w3c.dom.Node |
removeChild(org.w3c.dom.Node oldChild)
Removes the Child Node indicated by oldChild from this Nodes list of children, and returns it. |
org.w3c.dom.Node |
replaceChild(org.w3c.dom.Node newChild,
org.w3c.dom.Node oldChild)
Replaces the Child Node oldChild with newChild in this Node's list of children, and return the oldChild Node. |
protected void |
resetCheckValidity()
Reconfigure checkValidity flag. |
void |
setAddFixedAttributes(boolean addFixedAttributes)
Sets a flag whether #FIXED attributes are automatically added. |
void |
setCheckNodeLoop(boolean doCheck)
Sets a flag whether new child is an ancestor of a parent. |
void |
setCheckOwnerDocument(boolean doCheck)
Sets a flag whether new child was created from another document. |
void |
setDigestAlgorithm(java.lang.String defDigestAlgorithm)
Sets the default message digest algorithm for use by createMessageDigest() . |
void |
setEncoding(java.lang.String xmlEncoding)
Sets the value of the XML encoding parameter from the XML prolog declaration (e.g. |
void |
setPrintInternalDTD(boolean printInternalDTD)
Sets whether the internal DTD is printed by the print() methods. |
void |
setProcessNamespace(boolean isProcessNamespace)
Sets whether namespaces are considered in some operations to nodes created by this document. |
void |
setStandalone(java.lang.String standalone)
Sets if this Document is standalone. |
void |
setVersion(java.lang.String xmlVersion)
Sets the XML version of this Document from the XML prolog declaration (e.g. |
Methods inherited from class com.ibm.xml.parser.Parent |
addElement,
appendChild,
elements,
expandEntityReferences,
getChildNodes,
getChildrenArray,
getFirstChild,
getFirstWithoutReference,
getLastChild,
getLastWithoutReference,
hasChildNodes,
insert,
insertAfter,
insertBefore,
insertFirst,
insertLast,
processAfterRemove |
Methods inherited from class com.ibm.xml.parser.Child |
clearDigest,
getAttributes,
getDigest,
getNextSibling,
getNextWithoutReference,
getNodeValue,
getParentNode,
getParentWithoutReference,
getPreviousSibling,
getPreviousWithoutReference,
getUserData,
makeXPointer,
print,
print,
searchAncestors,
searchAncestors,
setFactory,
setNodeValue,
setUserData,
toXMLString,
toXMLString |
Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public java.lang.String expandedNameSeparator
Namespace.createExpandedName()
Constructor Detail |
public TXDocument()
xml
namespace to this document.Method Detail |
public java.lang.Object clone()
This method is defined by Child.
Child.clone()
public org.w3c.dom.Node cloneNode(boolean deep)
public boolean equals(org.w3c.dom.Node arg, boolean deep)
public short getNodeType()
This method is defined by DOM.
public java.lang.String getNodeName()
public org.w3c.dom.Element getDocumentElement()
getRootName()
public java.lang.String getRootName()
getDocumentElement()
public org.w3c.dom.NodeList getElementsByTagName(java.lang.String qName)
This method is defined by DOM.
qName
- Qualified name to match against in all subordinate Elements.TXElement.getElementsByTagName(java.lang.String)
,
Namespace
public org.w3c.dom.DocumentType getDoctype()
getDTD()
public DTD getDTD()
getDoctype()
,
isCheckValidity()
public boolean isCheckValidity()
This flag doesn't affect all validity constraints in XML 1.0. it affects only validity constraints about content model matching of elements and attribute types.
protected void resetCheckValidity()
public java.lang.String getStandalone()
setStandalone(java.lang.String)
,
isStandalone()
public boolean isStandalone()
getStandalone()
,
setStandalone(java.lang.String)
public void setStandalone(java.lang.String standalone)
isStandalone()
,
getStandalone()
public java.lang.String getVersion()
<?xml ...>
).setVersion(java.lang.String)
public void setVersion(java.lang.String xmlVersion)
<?xml ...>
).xmlVersion
- XML version of this Document (e.g. "1.0").getVersion()
public java.lang.String getEncoding()
<?xml encoding="...">
).setEncoding(java.lang.String)
public void setEncoding(java.lang.String xmlEncoding)
<?xml encoding="...">
).
The supported XML encodings are the intersection of XML-supported code sets and those supported in JDK 1.1:
xmlEncoding
- Value of the XML encoding parameter.MIME2Java.convert(java.lang.String)
,
getEncoding()
,
DTD.setEncoding(java.lang.String)
public void setProcessNamespace(boolean isProcessNamespace)
Parser#setProcessNamespace(true)
is called and
this document is created by the parser.Parser.setProcessNamespace(boolean)
public boolean isProcessNamespace()
protected void realInsert(org.w3c.dom.Node child, int index) throws LibraryException
child
- The Node being inserted.index
- 0-based index into the list of children.public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild) throws org.w3c.dom.DOMException
A DTD can't be replaced by this method.
This method is defined by DOM.
newChild
- The Child Node to replace with.oldChild
- The Child Node being replaced.removeChild(org.w3c.dom.Node)
public org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild) throws org.w3c.dom.DOMException
This method is defined by DOM.
oldChild
- The Child Node being removed.replaceChild(org.w3c.dom.Node, org.w3c.dom.Node)
public void printWithFormat(java.io.Writer pw) throws java.io.IOException, LibraryException
pw
- The character output stream to use.Child.print(java.io.Writer, java.lang.String)
public void printWithFormat(java.io.Writer pw, java.lang.String encoding) throws java.io.IOException, LibraryException
pw
- The character output stream to use.encoding
- Java character encoding in use by pw.Child.print(java.io.Writer, java.lang.String)
public void printWithFormat(java.io.Writer pw, java.lang.String encoding, int indent) throws java.io.IOException, LibraryException
pw
- The character output stream to use.encoding
- Java character encoding in use by pw.indent
- Number of spaces to indent at each nesting level.Child.print(java.io.Writer, java.lang.String)
public void setPrintInternalDTD(boolean printInternalDTD)
print()
methods.printInternalDTD
- =true to print the internal DTD; =false to not print.public java.lang.String getText()
This method is defined by Child.
Child.toXMLString(java.io.Writer, java.lang.String)
public org.w3c.dom.DOMImplementation getImplementation()
This method is defined by DOM.
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
public org.w3c.dom.Document getOwnerDocument()
This method is defined by DOM.
public TXDocument getFactory()
public static TXDocument getInstance()
TXDocument
instance; if an instance
does not currently exist, it will be created.public org.w3c.dom.Element createElement(java.lang.String name) throws org.w3c.dom.DOMException
TXElement
instance using the supplied parameters.
This method is defined by DOM.
name
- This Element's tag name (qualified name).public org.w3c.dom.Attr createAttribute(java.lang.String name) throws org.w3c.dom.DOMException
Attr
.
This method is defined by DOM.
name
- The name of this attribute.public org.w3c.dom.Text createTextNode(java.lang.String data)
TXText
instance using the supplied parameters.
This method is defined by DOM.
data
- The actual content of the Text Node.public TXText createTextNode(java.lang.String data, boolean isIgnorableWhitespace)
TXText
instance using the supplied parameters.data
- The actual content of the Text Node.isIgnorableWhitespace
- =true
space is to be preserved;
=false
space is to be ignored.TXText.setIsIgnorableWhitespace(boolean)
public TXText createTextNode(char[] charArray, int offset, int length, boolean isIgnorableWhitespace)
TXText
instance using the supplied parameters.charArray
- Existing character array to use as actual content of the Text Node.offset
- Offset into charArray.length
- Number of charArray characters to use.isIgnorableWhitespace
- =true
space is to be preserved;
=false
space is to be ignored.TXText.setIsIgnorableWhitespace(boolean)
public org.w3c.dom.CDATASection createCDATASection(java.lang.String data) throws org.w3c.dom.DOMException
TXCDATASection
instance using the supplied parameters.
This method is defined by DOM.
data
- The actual content of the CDATASection Node.public org.w3c.dom.Comment createComment(java.lang.String data)
TXComment
instance using the supplied parameters.
This method is defined by DOM.
data
- The actual content of the Comment Node.public org.w3c.dom.ProcessingInstruction createProcessingInstruction(java.lang.String name, java.lang.String data) throws org.w3c.dom.DOMException
TXPI
instance using the supplied parameters.
This method is defined by DOM.
name
- The first token following the markup.data
- From the character immediately after name to the
character immediately preceding the ?>
.public StylesheetPI createStylesheetPI(java.lang.String name, java.lang.String data, java.lang.String type, java.lang.String hrefURI, java.lang.String title)
StylesheetPI
instance using the supplied parameters.name
- The first token following the markup (e.g. "xml:stylesheet"
).data
- From the character immediately after name to the character immediately preceding the ?>
.type
- The value of the type=
attribute.hrefURI
- The value of the href=
attribute.title
- The value of the title=
attribute, or null.public DTD createDTD()
DTD
instance.public DTD createDTD(java.lang.String name, ExternalID externalID)
DTD
instance using the supplied parameters.name
- The name of this DTD. This value is also known as the DOCTYPE
and the root Element Name.externalID
- The external ID associated with this DTD.ExternalID
public ElementDecl createElementDecl(java.lang.String name, ContentModel contentModel)
ElementDecl
instance using the supplied parameters.name
- This element definition's name.contentModel
- The content model to associate with this element definition,
or null if the content model is to be set later.public ContentModel createContentModel(int type)
ContentModel
instance using the supplied parameters.
This factory is for content models NOT of type MODEL_GROUP.type
- The type for this content model.
Must be one of org.w3c.dom.ElementDefinition#ContentType.
Note that the XML4J parser will never set #PCDATA
as the
content type; MODEL_GROUP
will be set instead.public ContentModel createContentModel(CMNode modelGroupNode)
ContentModel
instance using the supplied parameters.
This factory is for content models of type MODEL_GROUP
.modelGroupNode
- The content model associated with the model group.public Attlist createAttlist(java.lang.String name)
Attlist
instance using the supplied parameters.name
- This attribute list's name; this value is also known as the Element type.public AttDef createAttDef(java.lang.String name)
AttDef
instance using the supplied parameters.name
- Name of this attribute as defined by the DTD.public EntityDecl createEntityDecl(java.lang.String name, java.lang.String value, boolean isParameter)
EntityDecl
instance using the supplied parameters.
This factory is for internal entities.name
- Name of this entity.value
- The XML-encoded value that was directly assigned to the EntityDecl.isParameter
- =true if a parameter entity; otherwise =false.public EntityDecl createEntityDecl(java.lang.String name, ExternalID externalID, boolean isParameter, java.lang.String ndata)
EntityDecl
instance using the supplied parameters.
Constructor for external entities.name
- Name of the entity.externalID
- The reference(s) to the external entity to retrieve.isParameter
- =true if a parameter entity; otherwise =false.ndata
- The notation associated with the binary entity, or null if
the Entity is a text entity.ExternalID
public TXNotation createNotation(java.lang.String name, ExternalID externalID)
TXNotation
instance using the supplied parameters.name
- The name of the Notation.externalID
- The public or system identifier which defines the DTD's notation.public org.w3c.dom.EntityReference createEntityReference(java.lang.String name) throws org.w3c.dom.DOMException
EntityReference
instance using the supplied parameters.name
- This reference's name. This is also the name of the entity
being referred to by the general entity reference.EntityReference
.public org.w3c.dom.DocumentFragment createDocumentFragment()
This method is defined by DOM.
public org.w3c.dom.Entity createEntity()
This method is defined by DOM. NOT IMPLEMENTED.
public java.security.MessageDigest createMessageDigest() throws java.security.NoSuchAlgorithmException
MessageDigest
instance if none currently exists,
or resets the existing digest. The digest will be created based on the existing
digest algorithm (see setDigestAlgorithm
).setDigestAlgorithm(java.lang.String)
public void setDigestAlgorithm(java.lang.String defDigestAlgorithm)
createMessageDigest()
.
By default, the message digest algorithm is MD5.
defDigestAlgorithm
- Refer to java.security.MessageDigest for acceptable values.createMessageDigest()
protected void checkChildType(org.w3c.dom.Node child) throws org.w3c.dom.DOMException
public boolean isCheckOwnerDocument()
public void setCheckOwnerDocument(boolean doCheck)
public boolean isCheckNodeLoop()
public void setCheckNodeLoop(boolean doCheck)
public boolean isAddFixedAttributes()
Parser
,
Element.removeAttribute(java.lang.String)
,
Element.removeAttributeNode(org.w3c.dom.Attr)
,
TXElement.removeAttribute(java.lang.String)
,
TXElement.removeAttributeNode(org.w3c.dom.Attr)
,
TXElement.resetDefaultAttribute(java.lang.String)
public void setAddFixedAttributes(boolean addFixedAttributes)
Parser
adding #FIXED attributes,
You must call this method before Parser#readStream()
.
TXDocument doc = new TXDocument(); doc.setAddFixedAttributes(false); parser.setElementFactory(doc); parser.readStream(....); // This method returns doc.
Parser
,
Element.removeAttribute(java.lang.String)
,
Element.removeAttributeNode(org.w3c.dom.Attr)
,
TXElement.removeAttribute(java.lang.String)
,
TXElement.removeAttributeNode(org.w3c.dom.Attr)
,
TXElement.resetDefaultAttribute(java.lang.String)
|
XML for Java Compatibility API 2.0.6 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |