Oracle9i XML Reference Release 1 (9.0.1) Part Number A88899-01 |
|
This chapter describes the Extensible Markup Language (XML) Parser for PL/SQL. It has three main sections:
The Extensible Markup Language (XML) describes a class of data objects called XML documents. It partially describes the behavior of computer programs which process them. XML is an application profile or restricted form of the Standard Generalized Markup Language (SGML) By construction, XML documents are conforming SGML documents.
XML documents are made up of storage units called entities, which contain either parsed or unparsed data. Parsed data is made up of characters, some of which form character data, and some of which form markup. Markup encodes a description of the document's storage layout and logical structure. XML provides a mechanism to impose constraints on the storage layout and logical structure.
A software module called an XML processor is used to read XML documents and provide access to their content and structure. It is assumed that an XML processor is doing its work on behalf of another module, called the application. This PL/SQL implementation of the XML processor (or parser) followed the W3C XML specification (rev. REC-xml-19980210) and included the required behavior of an XML processor in terms of how it must read XML data and the information it must provide to the application.
The following is the default behavior for this PL/SQL XML parser:
The types and methods described in this document are made available by the PL/SQL package xmlparser
.
Parses XML stored in the given url/file and returns the built DOM Document
Returns a new parser instance
Parses xml stored in the given url/file
Parses xml stored in the given buffer
Parses xml stored in the given clob
Parses xml stored in the given url/file
Parses xml stored in the given buffer
Parses xml stored in the given clob
Sets base directory used to resolve relative urls
Turn warnings on or off
Sets errors to be sent to the specified file
Sets white space preserve mode
Sets validation mode
Gets validation mode
Sets DTD
Gets DTD Parser
Gets DOM document
Free a Parser object
TYPE Parser IS RECORD ( ID VARCHAR2(5) );
Parses xml stored in the given url/file and returns the built DOM Document.
FUNCTION parse(url VARCHAR2) RETURN DOMDocument;
url (IN)- complete path of the url/file to be parsed
Nothing
This is meant to be used when the default parser behavior is acceptable and just a url/file needs to be parsed.
An application error is raised if parsing failed, for some reason.
Returns a new parser instance
FUNCTION newParser RETURN Parser;
None
A new parser instance
This function must be called before the default behavior of Parser can be changed and if other parse methods need to be used.
Parses xml stored in the given url/file
PROCEDURE parse(p Parser, url VARCHAR2);
p (IN)- parser instance url (IN)- complete path of the url/file to be parsed
Nothing
Any changes to the default parser behavior should be effected before calling this procedure.
An application error is raised if parsing failed, for some reason.
Parses xml stored in the given buffer
PROCEDURE parseBuffer(p Parser, doc VARCHAR2);
p (IN)- parser instance doc (IN)- xml document buffer to parse
Nothing
Any changes to the default parser behavior should be effected before calling this procedure.
An application error is raised if parsing failed, for some reason.
Parses xml stored in the given clob
PROCEDURE parseClob(p Parser, doc CLOB);
p (IN)- parser instance doc (IN)- xml document clob to parse
Nothing
Any changes to the default parser behavior should be effected before calling this procedure.
An application error is raised if parsing failed, for some reason.
Parses the DTD stored in the given url/file
PROCEDURE parseDTD(p Parser, url VARCHAR2, root VARCHAR2);
p (IN)- parser instance url (IN)- complete path of the url/file to be parsed root (IN)- name of the root element
Nothing
Any changes to the default parser behavior should be effected before calling this procedure.
An application error is raised if parsing failed, for some reason.
Parses the DTD stored in the given buffer
PROCEDURE parseDTDBuffer(p Parser, dtd VARCHAR2, root VARCHAR2);
p (IN)- parser instance dtd (IN)- dtd buffer to parse root (IN)- name of the root element
Nothing
Any changes to the default parser behavior should be effected before calling this procedure.
An application error is raised if parsing failed, for some reason.
Parses the DTD stored in the given clob
PROCEDURE parseDTDClob(p Parser, dtd CLOB, root VARCHAR2);
p (IN)- parser instance dtd (IN)- dtd clob to parse root (IN)- name of the root element
Nothing
Any changes to the default parser behavior should be effected before calling this procedure.
An application error is raised if parsing failed, for some reason.
Sets base directory used to resolve relative urls
PROCEDURE setBaseDir(p Parser, dir VARCHAR2);
p (IN)- parser instance dir (IN)- directory to use as base directory
Nothing
An application error is raised if parsing failed, for some reason.
Turn warnings on or off
PROCEDURE showWarnings(p Parser, yes BOOLEAN);
p (IN)- parser instance yes (IN)- mode to set: TRUE - show warnings, FALSE - don't show warnings
Nothing
Sets errors to be sent to the specified file
PROCEDURE setErrorLog(p Parser, fileName VARCHAR2);
p (IN)- parser instance fileName (IN)- complete path of the file to use as the error log
Nothing
Sets whitespace preserving mode
PROCEDURE setPreserveWhitespace(p Parser, yes BOOLEAN);
p (IN)- parser instance yes (IN)- mode to set: TRUE - preserve, FALSE - don't preserve
Nothing
Sets validation mode
PROCEDURE setValidationMode(p Parser, yes BOOLEAN);
p (IN)- parser instance yes (IN)- mode to set: TRUE - validating, FALSE - non valid
Nothing
Gets validation mode
FUNCTION getValidationMode(p Parser) RETURN BOOLEAN;
p (IN)- parser instance
The validation mode: TRUE - validating, FALSE - non valid
Sets a DTD to be used by the parser for validation
PROCEDURE setDoctype(p Parser, dtd DOMDocumentType);
p (IN)- parser instance dtd (IN)- DTD to set
Nothing
Gets DTD - MUST be called only after a DTD is parsed
FUNCTION getDoctype(p Parser) RETURN DOMDocumentType;
p (IN)- parser instance
The parsed DTD
Gets DOM Document built by the parser - MUST be called only after a document is parsed
FUNCTION getDocument(p Parser) RETURN DOMDocument;
p (IN)- parser instance
The root of the DOM tree
Free a parser object
PROCEDURE freeParser(p Parser)
p (IN)- parser instance
The Extensible Stylesheet Language Transformation (XSLT), describes rules for transforming a source tree into a result tree. A transformation expressed in XSLT is called a stylesheet. The transformation specified is achieved by associating patterns with templates defined in the stylesheet. A template is instantiated to create part of the result tree. This PL/SQL implementation of the XSL processor followed the W3C XSLT working draft (rev WD-xslt-19990813) and included the required behavior of an XSL processor in terms of how it must read XSLT stylesheets and the transformation it must effect.
The following is the default behavior for this PL/SQL XML parser:
The types and methods described in this document are made available by the PL/SQL package xslprocessor.
Returns a new processor instance
FUNCTION newProcessor RETURN Processor;
None
A new processor instance
This function must be called before the default behavior of Processor can be changed and if other processor methods need to be used.
Transforms input XML document using given DOMDocument and stylesheet
PROCEDURE processXSL(p Processor, ss Stylesheet, xmldoc DOMDocument);
p (IN)- processor instance ss (IN)- stylesheet instance xmldoc (IN)- xml document to be transformed
Nothing
Any changes to the default processor behavior should be effected before calling this procedure.
An application error is raised if processing failed, for some reason.
Transforms input XML document using given DOMDocumentFragment and stylesheet
PROCEDURE processXSL(p Processor, ss Stylesheet, xmldoc DOMDocumentFragment);
p (IN)- processor instance ss (IN)- stylesheet instance xmldoc (IN)- xml document fragment to be transformed
Nothing
Any changes to the default processor behavior should be effected before calling this procedure.
An application error is raised if processing failed, for some reason.
Turn warnings on or off
PROCEDURE showWarnings(p Processor, yes BOOLEAN);
p (IN)- processor instance yes (IN)- mode to set: TRUE - show warnings, FALSE - don't show warnings
Nothing
Sets errors to be sent to the specified file
PROCEDURE setErrorLog(p Processor, fileName VARCHAR2);
p (IN)- processor instance fileName (IN)- complete path of the file to use as the error log
Nothing
Create a new stylesheet using the given input and reference URLs
FUNCTION newStylesheet(inp VARCHAR2, ref VARCHAR2) RETURN Stylesheet;
inp (IN)- input url to use for construction ref (IN)- reference url
A new stylesheet instance
Transforms a node in a DOM tree using the given stylesheet
FUNCTION transformNode(n DOMNode, ss Stylesheet) RETURN DOMDocumentFragment;
n (IN)- DOM Node to transform ss (IN)- stylesheet to use
Result of the transformation
Selects nodes from a DOM tree which match the given pattern
FUNCTION selectNodes(n DOMNode, pattern VARCHAR2) RETURN DOMNodeList;
n (IN)- DOM Node to transform pattern (IN)- pattern to use
Result of the selection
Selects the first node from the tree that matches the given pattern
FUNCTION selectSingleNodes(n DOMNode, pattern VARCHAR2) RETURN DOMNode;
n (IN)- DOM Node to transform pattern (IN)- pattern to use
Result of the selection
Retrieves the value of the first node from the tree that matches the given pattern
FUNCTION valueOf(n DOMNode, pattern VARCHAR2) RETURN VARCHAR2;
n (IN)- DOM Node to transform pattern (IN)- pattern to use
Result of the selection
Sets a top level paramter in the stylesheet
PROCEDURE setParam(ss Stylesheet, name VARCHAR2, value VARCHAR2)
ss (IN)- stylesheet name (IN)- name of the param value (IN)- value of the param
Removes a top level stylesheet parameter
PROCEDURE removeParam(ss Stylesheet, name VARCHAR2)
ss (IN)- Stylesheet name (IN)- name of the parameter
Resets the top-level stylesheet parameters
PROCEDURE resetParams(ss Stylesheet)
ss (IN)- Stylesheet
Frees a Stylesheet object
PROCEDURE freestylesheet(ss Stylesheet)
ss (IN)- Stylesheet
Frees a Processor object
PROCEDURE freeProccessor(p Processor)
p (IN)- Processor
The Document Object Model (DOM) is an application programming interface (API) for HTML and XML documents. It defines the logical structure of documents and the way a document is accessed and manipulated. In the DOM specification, the term "document" is used in the broad sense. XML is increasingly being used as a way of representing many different kinds of information that may be stored in diverse systems, and much of this would traditionally be seen as data rather than as documents. Nevertheless, XML presents this data as documents, and the DOM may be used to manage this data.
With the Document Object Model, programmers can build documents, navigate their structure, and add, modify, or delete elements and content. Anything found in an HTML or XML document can be accessed, changed, deleted, or added using the Document Object Model, with a few exceptions. In particular, the DOM interfaces for the XML internal and external subsets have not yet been specified.
One important objective of the W3C specification for the Document Object Model is to provide a standard programming interface that can be used in a wide variety of environments and applications. The DOM is designed to be used with any programming language. Since the DOM standard is object-oriented, for this PL/SQL adaptation, some changes had to be made:
appendChild(n DOMNode, newChild IN DOMNode)
DOMNode;
and to perform setAttribute on a DOM Element elem, the following PL/SQL procedure is provided:
setAttribute(elem DOMElement, name IN VARCHAR2, value IN VARCHAR2);
DOM defines an inheritance hierarchy. For example, Document, Element, and Attr are defined to be subtypes of Node. Thus, a method defined in the Node interface should be available in these as well. Since, such inheritance is not directly possible in PL/SQL, the makeNode functions need to be invoked on different DOM types to convert these into a DOMNode. The appropriate functions or procedures that accept DOMNodes can then be called to operate on these types. If, subsequently, type specific functionality is desired, the DOMNode can be converted back into the type by using the makeXXX functions, where DOMXXX is the DOM type desired
The implementation of this PL/SQL DOM interface followed the DOM standard of revision REC-DOM-Level-1-19981001. The types and methods described in this document are made available by the PL/SQL package xmldom.
ELEMENT_NODE
ATTRIBUTE_NODE
TEXT_NODE
CDATA_SECTION_NODE
ENTITY_REFERENCE_NODE
ENTITY_NODE
PROCESSING_INSTRUCTION_NODE
COMMENT_NODE
DOCUMENT_NODE
DOCUMENT_TYPE_NODE
DOCUMENT_FRAGMENT_NODE
NOTATION_NODE
INDEX_SIZE_ERR
DOMSTRING_SIZE_ERR
HIERARCHY_REQUEST_ERR
WRONG_DOCUMENT_ERR
INVALID_CHARACTER_ERR
NO_DATA_ALLOWED_ERR
NO_MODIFICATION_ALLOWED_ERR
NOT_FOUND_ERR
NOT_SUPPORTED_ERR
INUSE_ATTRIBUTE_ERR
DOMNode
DOMNamedNodeMap
DOMNodeList
DOMAttr
DOMCDataSection
DOMCharacterData
DOMComment
DOMDocumentFragment
DOMElement
DOMEntity
DOMEntityReference
DOMNotation
DOMProcessingInstruction
DOMText
DOMImplementation
DOMDocumentType
DOMDocument
isNull(n DOMNode)
BOOLEAN;
makeAttr(n DOMNode)
DOMAttr;
makeCDataSection(n DOMNode)
DOMCDataSection;
makeCharacterData(n DOMNode)
DOMCharacterData;
makeComment(n DOMNode)
DOMComment;
makeDocumentFragment(n DOMNode)
DOMDocumentFragment;
makeDocumentType(n DOMNode)
DOMDocumentType;
makeElement(n DOMNode)
DOMElement;
makeEntity(n DOMNode)
DOMEntity;
makeEntityReference(n DOMNode)
DOMEntityReference;
makeNotation(n DOMNode)
DOMNotation;
makeProcessingInstruction(n DOMNode)
DOMProcessingInstruction;
makeText(n DOMNode) RETURN DOMText;
makeDocument(n DOMNode)
DOMDocument;
writeToFile(n DOMNode, fileName VARCHAR2);
writeToBuffer(n DOMNode, buffer IN OUT VARCHAR2);
writeToClob(n DOMNode, cl IN OUT CLOB);
writeToFile(n DOMNode, fileName VARCHAR2, charset VARCHAR2);
writeToBuffer(n DOMNode, buffer IN OUT VARCHAR2, charset VARCHAR2);
writeToClob(n DOMNode, cl IN OUT CLOB, charset VARCHAR2);
getNodeName(n DOMNode)
VARCHAR2;
getNodeValue(n DOMNode)
VARCHAR2;
setNodeValue(n DOMNode, nodeValue IN VARCHAR2);
getNodeType(n DOMNode)
NUMBER;
getParentNode(n DOMNode)
DOMNode;
getChildNodes(n DOMNode)
DOMNodeList;
getFirstChild(n DOMNode)
DOMNode;
getLastChild(n DOMNode)
DOMNode;
getPreviousSibling(n DOMNode)
DOMNode;
getNextSibling(n DOMNode)
DOMNode;
getAttributes(n DOMNode)
DOMNamedNodeMap;
getOwnerDocument(n DOMNode)
DOMDocument;
insertBefore(n DOMNode, newChild IN DOMNode, refChild IN DOMNode)
DOMNode;
replaceChild(n DOMNode, newChild IN DOMNode, oldChild IN DOMNode)>
DOMNode;
removeChild(n DOMNode, oldChild IN DOMNode)
DOMNode;
appendChild(n DOMNode, newChild IN DOMNode)
DOMNode;
hasChildNodes(n DOMNode)
BOOLEAN;
cloneNode(n DOMNode, deep boolean)
DOMNode;
isNull(nnm DOMNamedNodeMap)
BOOLEAN;
getNamedItem(nnm DOMNamedNodeMap, name IN VARCHAR2)
DOMNode;
setNamedItem(nnm DOMNamedNodeMap, arg IN DOMNode)
DOMNode;
removeNamedItem(nnm DOMNamedNodeMap, name IN VARCHAR2)
DOMNode;
item(nnm DOMNamedNodeMap, idx IN NUMBER)
DOMNode;
getLength(nnm DOMNamedNodeMap)
NUMBER;
isNull(nl DOMNodeList)
BOOLEAN;
item(nl DOMNodeList, idx IN NUMBER)
DOMNode;
getLength(nl DOMNodeList)
NUMBER;
isNull(a DOMAttr)
BOOLEAN;
makeNode(a DOMAttr)
DOMNode;
getQualifiedName(a DOMAttr)
VARCHAR2;
getNamespace(a DOMAttr)
VARCHAR2;
getLocalName(a DOMAttr)
VARCHAR2;
getExpandedName(a DOMAttr)
VARCHAR2;
getName(a DOMAttr)
VARCHAR2;
getSpecified(a DOMAttr)
BOOLEAN;
getValue(a DOMAttr)
VARCHAR2;
setValue(a DOMAttr, value IN VARCHAR2);
isNull(cds DOMCDataSection)
BOOLEAN;
makeNode(cds DOMCDataSection)
DOMNode;
isNull(cd DOMCharacterData)
BOOLEAN;
makeNode(cd DOMCharacterData)
DOMNode;
getData(cd DOMCharacterData)
VARCHAR2;
setData(cd DOMCharacterData, data IN VARCHAR2);
getLength(cd DOMCharacterData)
NUMBER;
substringData(cd DOMCharacterData, offset IN NUMBER, cnt IN NUMBER)
VARCHAR2;
appendData(cd DOMCharacterData, arg IN VARCHAR2);
insertData(cd DOMCharacterData, offset IN NUMBER, arg IN VARCHAR2);
deleteData(cd DOMCharacterData, offset IN NUMBER, cnt IN NUMBER);
replaceData(cd DOMCharacterData, offset IN NUMBER, cnt IN NUMBER, arg IN VARCHAR2);
isNull(com DOMComment)
BOOLEAN;
makeNode(com DOMComment)
DOMNode;
isNull(di DOMImplementation)
BOOLEAN;
hasFeature(di DOMImplementation, feature IN VARCHAR2, version IN VARCHAR2)
BOOLEAN;
isNull(df DOMDocumentFragment)
BOOLEAN;
makeNode(df DOMDocumentFragment)
DOMNode;
isNull(dt DOMDocumentType)
BOOLEAN;
makeNode(dt DOMDocumentType)
DOMNode;
findEntity(dt DOMDocumentType, name VARCHAR2, par BOOLEAN)
DOMEntity;
findNotation(dt DOMDocumentType, name VARCHAR2)
DOMNotation;
getPublicId(dt DOMDocumentType)
VARCHAR2;
getSystemId(dt DOMDocumentType)
VARCHAR2;
writeExternalDTDToFile(dt DOMDocumentType, fileName VARCHAR2);
writeExternalDTDToBuffer(dt DOMDocumentType, buffer IN OUT VARCHAR2);
writeExternalDTDToClob(dt DOMDocumentType, cl IN OUT CLOB);
writeExternalDTDToFile(dt DOMDocumentType, fileName VARCHAR2, charset VARCHAR2);
writeExternalDTDToBuffer(dt DOMDocumentType, buffer IN OUT VARCHAR2, charset VARCHAR2);
writeExternalDTDToClob(dt DOMDocumentType, cl IN OUT CLOB, charset VARCHAR2);
getName(dt DOMDocumentType)
VARCHAR2;
getEntities(dt DOMDocumentType)
DOMNamedNodeMap;
getNotations(dt DOMDocumentType)
DOMNamedNodeMap;
isNull(elem DOMElement)
BOOLEAN;
makeNode(elem DOMElement)
DOMNode;
getQualifiedName(elem DOMElement)
VARCHAR2;
getNamespace(elem DOMElement)
VARCHAR2;
getLocalName(elem DOMElement)
VARCHAR2;
getExpandedName(elem DOMElement)
VARCHAR2;
getChildrenByTagName(elem DOMElement, name IN VARCHAR2)
DOMNodeList;
getElementsByTagName(elem DOMElement, name IN VARCHAR2, ns VARCHAR2)
DOMNodeList;
getChildrenByTagName(elem DOMElement, name IN VARCHAR2, ns VARCHAR2)
DOMNodeList;
resolveNamespacePrefix(elem DOMElement, prefix VARCHAR2)
VARCHAR2;
getTagName(elem DOMElement)
VARCHAR2;
getAttribute(elem DOMElement, name IN VARCHAR2)
VARCHAR2;
setAttribute(elem DOMElement, name IN VARCHAR2, value IN VARCHAR2);
removeAttribute(elem DOMElement, name IN VARCHAR2);
getAttributeNode(elem DOMElement, name IN VARCHAR2)
DOMAttr;
setAttributeNode(elem DOMElement, newAttr IN DOMAttr)
DOMAttr;
removeAttributeNode(elem DOMElement, oldAttr IN DOMAttr)
DOMAttr;
getElementsByTagName(elem DOMElement, name IN VARCHAR2)
DOMNodeList;
normalize(elem DOMElement);
isNull(ent DOMEntity)
BOOLEAN;
makeNode(ent DOMEntity)
DOMNode;
getPublicId(ent DOMEntity)
VARCHAR2;
getSystemId(ent DOMEntity)
VARCHAR2;
getNotationName(ent DOMEntity)
VARCHAR2;
isNull(eref DOMEntityReference)
BOOLEAN;
makeNode(eref DOMEntityReference)
DOMNode;
isNull(n DOMNotation)
BOOLEAN;
makeNode(n DOMNotation)
DOMNode;
getPublicId(n DOMNotation)
VARCHAR2;
getSystemId(n DOMNotation)
VARCHAR2;
isNull(pi DOMProcessingInstruction)
BOOLEAN;
makeNode(pi DOMProcessingInstruction)
DOMNode;
getData(pi DOMProcessingInstruction)
VARCHAR2;
getTarget(pi DOMProcessingInstruction)
VARCHAR2;
setData(pi DOMProcessingInstruction, data IN VARCHAR2);
isNull(t DOMText)
BOOLEAN;
makeNode(t DOMText)
DOMNode;
splitText(t DOMText, offset IN NUMBER)
DOMText;
isNull(doc DOMDocument)
BOOLEAN;
makeNode(doc DOMDocument)
DOMNode;
newDOMDocument
DOMDocument;
getVersion(doc DOMDocument)
VARCHAR2;
setVersion(doc DOMDocument, version VARCHAR2);
getCharset(doc DOMDocument)
VARCHAR2;
setCharset(doc DOMDocument, charset VARCHAR2);
getStandalone(doc DOMDocument)
VARCHAR2;
setStandalone(doc DOMDocument, value VARCHAR2);
writeToFile(doc DOMDocument, fileName VARCHAR2);
writeToBuffer(doc DOMDocument, buffer IN OUT VARCHAR2);
writeToClob(doc DOMDocument, cl IN OUT CLOB);
writeToFile(doc DOMDocument, fileName VARCHAR2, charset VARCHAR2);
writeToBuffer(doc DOMDocument, buffer IN OUT VARCHAR2, charset VARCHAR2);
writeToClob(doc DOMDocument, cl IN OUT CLOB, charset VARCHAR2);
writeExternalDTDToFile(doc DOMDocument, fileName VARCHAR2);
writeExternalDTDToBuffer(doc DOMDocument, buffer IN OUT VARCHAR2);
writeExternalDTDToClob(doc DOMDocument, cl IN OUT CLOB);
writeExternalDTDToFile(doc DOMDocument, fileName VARCHAR2, charset VARCHAR2);
writeExternalDTDToBuffer(doc DOMDocument, buffer IN OUT VARCHAR2, charset VARCHAR2);
writeExternalDTDToClob(doc DOMDocument, cl IN OUT CLOB, charset VARCHAR2);
getDoctype(doc DOMDocument)
DOMDocumentType;
getImplementation(doc DOMDocument)
DOMImplementation;
getDocumentElement(doc DOMDocument)
DOMElement;
createElement(doc DOMDocument, tagName IN VARCHAR2)
DOMElement;
createDocumentFragment(doc DOMDocument)
DOMDocumentFragment;
createTextNode(doc DOMDocument, data IN VARCHAR2)
DOMText;
createComment(doc DOMDocument, data IN VARCHAR2)
DOMComment;
createCDATASection(doc DOMDocument, data IN VARCHAR2)
DOMCDATASection;
createProcessingInstruction(doc DOMDocument, target IN VARCHAR2, data IN VARCHAR2)
DOMProcessingInstruction;
createAttribute(doc DOMDocument, name IN VARCHAR2)
DOMAttr;
createEntityReference(doc DOMDocument, name IN VARCHAR2)
DOMEntityReference;
getElementsByTagName(doc DOMDocument, tagname IN VARCHAR2)
DOMNodeList;
isNull(n DOMNode)
BOOLEAN;
Checks if the given DOMNode is null
FUNCTION isNull(n DOMNode) RETURN BOOLEAN;
n (IN)- DOMNode to check
Whether given DOMNode is null: TRUE - is null, FALSE - is not null
makeAttr(n DOMNode)
DOMAttr;
Casts given DOMNode to a DOMAttr
FUNCTION makeAttr(n DOMNode) RETURN DOMAttr;
n (IN)- DOMNode to cast
The DOMAttr
makeCDataSection(n DOMNode)
DOMCDataSection;
Casts given DOMNode to a DOMCDataSection
FUNCTION makeCDataSection(n DOMNode) RETURN DOMCDataSection;
n (IN)- DOMNode to cast
The DOMCDataSection
makeCharacterData(n DOMNode)
DOMCharacterData;
Casts given DOMNode to a DOMCharacterData
FUNCTION makeCharacterData(n DOMNode) RETURN DOMCharacterData;
n (IN)- DOMNode to cast
The DOMCharacterData
makeComment(n DOMNode)
DOMComment;
Casts given DOMNode to a DOMComment
FUNCTION makeComment(n DOMNode) RETURN DOMComment;
n (IN)- DOMNode to cast
The DOMComment
makeDocumentFragment(n DOMNode)
DOMDocumentFragment;
Casts given DOMNode to a DOMDocumentFragment
FUNCTION makeDocumentFragment(n DOMNode) RETURN DOMDocumentFragment;
n (IN)- DOMNode to cast
The DOMDocumentFragment
FUNCTION makeDocumentType(n DOMNode) RETURN DOMDocumentType;
Casts given DOMNode to a DOMDocumentType
FUNCTION makeDocumentType(n DOMNode) RETURN DOMDocumentType;
n (IN)- DOMNode to cast
The DOMDocumentType
DOMElement;
Casts given DOMNode to a DOMElement
FUNCTION makeElement(n DOMNode) RETURN DOMElement;
n (IN)- DOMNode to cast
The DOMElement
makeEntity(n DOMNode)
DOMEntity;
Casts given DOMNode to a DOMEntity
FUNCTION makeEntity(n DOMNode) RETURN DOMEntity;
n (IN)- DOMNode to cast
The DOMEntity
makeEntityReference(n DOMNode)
DOMEntityReference;
Casts given DOMNode to a DOMEntityReference
FUNCTION makeEntityReference(n DOMNode) RETURN DOMEntityReference;
n (IN)- DOMNode to cast
The DOMEntityReference
Casts given DOMNode to a DOMNotation
makeNotation(n DOMNode)
DOMNotation;
n (IN)- DOMNode to cast
The DOMNotation
makeProcessingInstruction(n DOMNode)
DOMProcessingInstruction;
Casts given DOMNode to a DOMProcessingInstruction
makeProcessingInstruction(n DOMNode)
DOMProcessingInstruction;
n (IN)- DOMNode to cast
The DOMProcessingInstruction
makeText(n DOMNode)
DOMText;
Casts given DOMNode to a DOMText
makeText(n DOMNode)
DOMText;
n (IN)- DOMNode to cast
The DOMText
makeDocument(n DOMNode)
DOMDocument;
Casts given DOMNode to a DOMDocument
makeDocument(n DOMNode)
DOMDocument;
n (IN)- DOMNode to cast
The DOMDocument
writeToFile(n DOMNode, fileName VARCHAR2);
Writes XML node to specified file using the database character set
writeToFile(n DOMNode, fileName VARCHAR2);
n (IN)- DOMNode fileName (IN)- File to write to
Nothing
writeToBuffer(n DOMNode, buffer IN OUT VARCHAR2);
Writes XML node to specified buffer using the database character set
writeToBuffer(n DOMNode, buffer IN OUT VARCHAR2);
n (IN)- DOMNode buffer (OUT)- buffer to write to
Nothing
writeToClob(n DOMNode, cl IN OUT CLOB);
Writes XML node to specified clob using the database character set
writeToClob(n DOMNode, cl IN OUT CLOB);
n (IN)- DOMNode cl (OUT)- CLOB to write to
Nothing
writeToFile(n DOMNode, fileName VARCHAR2, charset VARCHAR2);
Writes XML node to specified file using the given character set
writeToFile(n DOMNode, fileName VARCHAR2, charset VARCHAR2);
n (IN)- DOMNode fileName (IN)- File to write to charset (IN)- Character set
Nothing
writeToBuffer(n DOMNode, buffer IN OUT VARCHAR2, charset VARCHAR2);
Writes XML node to specified buffer using the given character set
writeToBuffer(n DOMNode, buffer IN OUT VARCHAR2, charset VARCHAR2);
n (IN)- DOMNode buffer (OUT)- buffer to write to charset (IN)- Character set
Nothing
writeToClob(n DOMNode, cl IN OUT CLOB, charset VARCHAR2);
Writes XML node to specified clob using the given character set
writeToClob(n DOMNode, cl IN OUT CLOB, charset VARCHAR2);
n (IN)- DOMNode cl (OUT)- CLOB to write to charset (IN)- Character set
Nothing
isNull(nnm DOMNamedNodeMap)
BOOLEAN;
Checks if the given DOM NamedNodeMap is null
isNull(nnm DOMNamedNodeMap)
BOOLEAN;
nnm (IN)- DOMNamedNodeMap to check
Whether given DOM NamedNodeMap is null: TRUE - is null, FALSE - is not null
isNull(nl DOMNodeList)
BOOLEAN;
Checks if the given DOM NodeList is null
FUNCTION isNull(nl DOMNodeList) RETURN BOOLEAN;
nl (IN)- DOMNodeList to check
Whether given DOM NodeList is null: TRUE - is null, FALSE - is not null
isNull(a DOMAttr)
BOOLEAN;
Checks if the given DOM Attr is null
FUNCTION isNull(a DOMAttr) RETURN BOOLEAN;
a (IN)- DOMAttr to check
Whether given DOM Attr is null: TRUE - is null, FALSE - is not null
makeNode(a DOMAttr)
DOMNode;
Casts given DOMAttr to a DOMNode
FUNCTION makeNode(a DOMAttr) RETURN DOMNode;
a (IN)- DOMNode to cast
The DOMNode
getQualifiedName(a DOMAttr)
VARCHAR2;
Returns the qualified name of the DOMAttr
FUNCTION getQualifiedName(a DOMAttr) RETURN VARCHAR2;
a (IN)- DOMAttr
The qualified name
getNamespace(a DOMAttr)
VARCHAR2;
Returns the namespace of the DOMAttr
FUNCTION getNamespace(a DOMAttr) RETURN VARCHAR2;
a (IN)- DOMAttr
The namespace
getLocalName(a DOMAttr)
VARCHAR2;
Returns the local name of the DOMAttr
FUNCTION getLocalName(a DOMAttr) RETURN VARCHAR2;
a (IN)- DOMAttr
The local name
getExpandedName(a DOMAttr)
VARCHAR2;
Returns the expanded name of the DOMAttr
FUNCTION getExpandedName(a DOMAttr) RETURN VARCHAR2;
a (IN)- DOMAttr
The expanded name
isNull(cds DOMCDataSection)
BOOLEAN;
Checks if the given DOM CDataSection is null
FUNCTION isNull(cds DOMCDataSection) RETURN BOOLEAN;
cds (IN)- DOMCDataSection to check
Whether given DOM CDataSection is null: TRUE - is null, FALSE - is not null
makeNode(cds DOMCDataSection)
DOMNode;
Casts given DOMCDataSection to a DOMNode
FUNCTION makeNode(cds DOMCDataSection) RETURN DOMNode;
cds (IN)- DOMCDataSection to cast
The DOMNode
BOOLEAN;
Checks if the given DOM CharacterData is null
FUNCTION isNull(cd DOMCharacterData) RETURN BOOLEAN;
cd (IN)- DOMCharacterData to check
Whether given DOM CharacterData is null : TRUE - is null, FALSE - is not null
makeNode(cd DOMCharacterData)
DOMNode;
Casts given DOMCharacterData to a DOMNode
FUNCTION makeNode(cd DOMCharacterData) RETURN DOMNode;
cd (IN)- DOMCharacterData to cast
The DOMNode
BOOLEAN;
Checks if the given DOM Comment is null
FUNCTION isNull(com DOMComment) RETURN BOOLEAN;
com (IN)- DOMComment to check
Whether given DOM Comment is null: TRUE - is null, FALSE - is not null
DOMNode;
Casts given DOMComment to a DOMNode
FUNCTION makeNode(com DOMComment) RETURN DOMNode;
com (IN)- DOMComment to ast
The DOMComment
BOOLEAN;
Checks if the given DOM Implementation is null
FUNCTION isNull(di DOMImplementation) RETURN BOOLEAN;
di (IN)- DOMImplementation to check
Whether given DOM Implementation is null: TRUE - is null, FALSE - is not null
isNull(df DOMDocumentFragment)
BOOLEAN;
Checks if the given DOM DocumentFragment is null
FUNCTION isNull(df DOMDocumentFragment) RETURN BOOLEAN;
df (IN)- DOMDocumentFragment to check
Whether given DOM DocumentFragment is null: TRUE - is null, FALSE - is not null
makeNode(df DOMDocumentFragment)
DOMComment;
Casts given DOMDocumentFragment to a DOMNode
FUNCTION makeNode(df DOMDocumentFragment) RETURN DOMNode;
df (IN)- DOMDocumentFragment to cast
The DOMNode
isNull(dt DOMDocumentType)
BOOLEAN;
Checks if the given DOM DocumentType is null
FUNCTION isNull(dt DOMDocumentType) RETURN BOOLEAN;
dt (IN)- DOMDocumentType to check
Whether given DOM DocumentType is null: TRUE - is null, FALSE - is not null
makeNode(dt DOMDocumentType)
DOMNode;
Casts given DOMDocumentType to a DOMNode
FUNCTION makeNode(dt DOMDocumentType) RETURN DOMNode;
dt (IN)- DOMDocumentType to cast
The DOMNode
findEntity(dt DOMDocumentType, name VARCHAR2, par BOOLEAN)
DOMEntity;
Finds an entity in the given DTD
FUNCTION findEntity(dt DOMDocumentType, name VARCHAR2, par BOOLEAN) RETURN DOMEntity;
dt (IN)- DTD name (IN)- entity to find par (IN)- TRUE - parameter entity, FALSE - normal entity
The DOMEntity, if found.
findNotation(dt DOMDocumentType, name VARCHAR2)
DOMNotation;
Finds a notation in the given DTD
FUNCTION findNotation(dt DOMDocumentType, name VARCHAR2) RETURN DOMNotation;
dt (IN)- DTD name (IN)- notation to find
The DOMNotation, if found.
getPublicId(dt DOMDocumentType)
VARCHAR2;
Return the public id of the given DTD
FUNCTION getPublicId(dt DOMDocumentType) RETURN VARCHAR2;
dt (IN)- DTD
The public id
getSystemId(dt DOMDocumentType)
VARCHAR2;
Return the system id of the given DTD
FUNCTION getSystemId(dt DOMDocumentType) RETURN VARCHAR2;
dt (IN)- DTD
The system id
writeExternalDTDToFile(dt DOMDocumentType, fileName VARCHAR2);
Writes DTD to specified file using the database character set
PROCEDURE writeExternalDTDToFile(dt DOMDocumentType, fileName VARCHAR2);
dt (IN)- DOMDocumentType fileName (IN)- File to write to
Nothing
writeExternalDTDToBuffer(dt DOMDocumentType, buffer IN OUT VARCHAR2);
Writes DTD to specified buffer using the database character set
writeExternalDTDToBuffer(dt DOMDocumentType, buffer IN OUT VARCHAR2);
dt (IN)- DOMDocumentType buffer (OUT)- buffer to write to
Nothing
writeExternalDTDToClob(dt DOMDocumentType, cl IN OUT CLOB);
Writes DTD to specified clob using the database character set
PROCEDURE writeExternalDTDToClob(dt DOMDocumentType, cl IN OUT CLOB);
dt (IN)- DOMDocumentType cl (OUT)- CLOB to write to
Nothing
writeExternalDTDToFile(dt DOMDocumentType, fileName VARCHAR2, charset VARCHAR2);
Writes DTD to specified file using the given character set
writeExternalDTDToFile(dt DOMDocumentType, fileName VARCHAR2, charset VARCHAR2);
dt (IN)- DOMDocumentType fileName (IN)- File to write to charset (IN)- Character set
Nothing
writeExternalDTDToBuffer(dt DOMDocumentType, buffer IN OUT VARCHAR2, charset VARCHAR2);
Writes DTD to specified buffer using the given character set
writeExternalDTDToBuffer(dt DOMDocumentType, buffer IN OUT VARCHAR2, charset VARCHAR2);
dt (IN)- DOMDocumentType buffer (OUT)- buffer to write to charset (IN)- Character set
Nothing
writeExternalDTDToClob(dt DOMDocumentType, cl IN OUT CLOB, charset VARCHAR2);
Writes DTD to specified clob using the given character set
PROCEDURE writeExternalDTDToClob(dt DOMDocumentType, cl IN OUT CLOB, charset VARCHAR2);
dt (IN)- DOMDocumentType cl (OUT)- CLOB to write to charset (IN)- Character set
Nothing
isNull(elem DOMElement)
BOOLEAN;
Checks if the given DOM Element is null
FUNCTION isNull(elem DOMElement) RETURN BOOLEAN;
elem (IN)- DOMElement to check
Whether given DOM Element is null: TRUE - is null, FALSE - is not null
makeNode(elem DOMElement)
DOMNode;
Casts given DOMElement to a DOMNode
FUNCTION makeNode(elem DOMElement) RETURN DOMNode;
elem (IN)- DOMElement to cast
The DOMNode
getQualifiedName(elem DOMElement)
VARCHAR2;
Returns the qualified name of the DOMElem
getQualifiedName(elem DOMElement)
VARCHAR2;
elem (IN)- DOMElement
The qualified name
getNamespace(elem DOMElement)
VARCHAR2;
Returns the namespace of the DOMElem
FUNCTION getNamespace(elem DOMElement) RETURN VARCHAR2;
elem (IN)- DOMElement
The namespace
VARCHAR2;
Returns the local name of the DOMElem
FUNCTION getLocalName(elem DOMElement) RETURN VARCHAR2;
elem (IN)- DOMElement
The local name
getExpandedName(elem DOMElement)
VARCHAR2;
Returns the expanded name of the DOMElem
FUNCTION getExpandedName(elem DOMElement) RETURN VARCHAR2;
elem (IN)- DOMElement
The expanded name
getChildrenByTagName(elem DOMElement, name varchar2)
DOMNodeList;
Returns the children of the DOMElem having the given tag name
FUNCTION getChildrenByTagName(elem DOMElement, name varchar2) RETURN DOMNodeList;
elem (IN)- DOMElement name (IN)- tag name (* matches any tag)
Children with the given tag name
getElementsByTagName(elem DOMElement, name varchar2, ns VARCHAR2)
DOMNodeList;
Returns the element children of the DOMElem having the given tag name and namespace
FUNCTION getElementsByTagName(elem DOMElement, name varchar2, ns VARCHAR2 ) RETURN DOMNodeList;
elem (IN)- DOMElement name (IN)- tag name (* matches any tag) ns (IN)- namespace
Elements with the given tag name and namespace
getChildrenByTagName(elem DOMElement, name varchar2, ns VARCHAR2)
DOMNodeList;
Returns the children of the DOMElem having the given tag name and namespace
FUNCTION getChildrenByTagName(elem DOMElement, name varchar2, ns VARCHAR2 ) RETURN DOMNodeList;
elem (IN)- DOMElement name (IN)- tag name (* matches any tag) ns (IN)- namespace
Children with the given tag name and namespace
resolveNamespacePrefix(elem DOMElement, prefix VARCHAR2)
VARCHAR2;
Resolves the given namespace prefix
FUNCTION resolveNamespacePrefix(elem DOMElement, prefix VARCHAR2) RETURN VARCHAR2;
elem (IN)- DOMElement prefix (IN)- namespace prefix
The resolved namespace
isNull(ent DOMEntity)
BOOLEAN;
Checks if the given DOM Entity is null
FUNCTION isNull(ent DOMEntity) RETURN BOOLEAN;
ent (IN)- DOMEntity to check
Whether given DOM Entity is null: TRUE - is null, FALSE - is not null
makeNode(ent DOMEntity)
DOMNode;
Casts given DOMEntity to a DOMNode
FUNCTION makeNode(ent DOMEntity) RETURN DOMNode;
ent (IN)- DOMEntity to cast
The DOMNode
isNull(eref DOMEntityReference)
BOOLEAN;
Checks if the given DOM EntityReference is null
FUNCTION isNull(eref DOMEntityReference) RETURN BOOLEAN;
eref (IN)- DOMEntityReference to check
Whether given DOM EntityReference is null : TRUE - is null, FALSE - is not null
makeNode(eref DOMEntityReference)
DOMNode;
Casts given DOMEntityReference to a DOMNode
FUNCTION makeNode(eref DOMEntityReference) RETURN DOMNode;
eref (IN)- DOMEntityReference to cast
The DOMNode
isNull(n DOMNotation)
BOOLEAN;
Checks if the given DOM Notation is null
FUNCTION isNull(n DOMNotation) RETURN BOOLEAN;
n (IN)- DOMNotation to check
Whether given DOM Notation is null : TRUE - is null, FALSE - is not null
makeNode(n DOMNotation)
DOMNode;
Casts given DOMNotation to a DOMNode
FUNCTION makeNode(n DOMNotation) RETURN DOMNode;
n (IN)- DOMNotation to cast
The DOMNode
isNull(pi DOMProcessingInstruction)
BOOLEAN;
Checks if the given DOM ProcessingInstruction is null
FUNCTION isNull(pi DOMProcessingInstruction) RETURN BOOLEAN;
pi (IN)- DOMProcessingInstruction to check
Whether given DOM ProcessingInstruction is null : TRUE - is null, FALSE - is not null
makeNode(pi DOMProcessingInstruction)
DOMNode;
Casts given DOMProcessingInstruction to a DOMNode
FUNCTION makeNode(pi DOMProcessingInstruction) RETURN DOMNode;
pi (IN)- DOMProcessingInstruction to cast
The DOMNode
isNull(t DOMText)
BOOLEAN;
Checks if the given DOMText is null
FUNCTION isNull(t DOMText) RETURN BOOLEAN;
t (IN)- DOMText to check
Whether given DOMText is null : TRUE - is null, FALSE - is not null
makeNode(t DOMText)
DOMNode;
Casts given DOMText to a DOMNode
FUNCTION makeNode(t DOMText) RETURN DOMNode;
t (IN)- DOMText to cast
The DOMNode
isNull(doc DOMDocument)
BOOLEAN;
Checks if the given DOMDocument is null
FUNCTION isNull(doc DOMDocument) RETURN BOOLEAN;
doc (IN)- DOMDocument to check
Whether given DOMDocument is null : TRUE - is null, FALSE - is not null
makeNode(doc DOMDocument)
DOMNode;
Casts given DOMDocument to a DOMNode
FUNCTION makeNode(doc DOMDocument) RETURN DOMNode;
doc (IN)- DOMDocument to cast
The DOMNode
newDOMDocument
DOMDocument;
Returns a new DOM Document instance
FUNCTION newDOMDocument RETURN DOMDocument;
None
A new DOMDocument instance
freeDocument(doc DOMDocument)
Frees Document object
PROCEDURE freeDocument(doc DOMDocument)
doc (IN)- DOMDocument
getVersion(doc DOMDocument)
VARCHAR2;
Gets version information for the XML document
FUNCTION getVersion(doc DOMDocument) RETURN VARCHAR2;
doc (IN)- DOMDocument
Version information
setVersion(doc DOMDocument, version VARCHAR2);
Sets version information for the XML document
PROCEDURE setVersion(doc DOMDocument, version VARCHAR2);
doc (IN)- DOMDocument version (IN)- version information
Nothing
getCharset(doc DOMDocument)
VARCHAR2;
Gets character set of the XML document
FUNCTION getCharset(doc DOMDocument) RETURN VARCHAR2;
doc (IN)- DOMDocument
Character set of the XML document
setCharset(doc DOMDocument, charset VARCHAR2);
Sets character set of the XML document
PROCEDURE setCharset(doc DOMDocument, charset VARCHAR2);
doc (IN)- DOMDocument charset (IN)- Character set
Nothing
getStandalone(doc DOMDocument)
VARCHAR2;
Gets standalone information for the XML document
FUNCTION getStandalone(doc DOMDocument) RETURN VARCHAR2;
doc (IN)- DOMDocument
Standalone information
setStandalone(doc DOMDocument, value VARCHAR2);
Sets standalone information for the XML document
PROCEDURE setStandalone(doc DOMDocument, value VARCHAR2);
doc (IN)- DOMDocument value (IN)- standalone information
Nothing
writeToFile(doc DOMDocument, fileName VARCHAR2);
Writes XML document to specified file using the database character set
PROCEDURE writeToFile(doc DOMDocument, fileName VARCHAR2);
doc (IN)- DOMDocument fileName (IN)- File to write to
Nothing
writeToBuffer(doc DOMDocument, buffer IN OUT VARCHAR2);
Writes XML document to specified buffer using the database character set
PROCEDURE writeToBuffer(doc DOMDocument, buffer IN OUT VARCHAR2);
doc (IN)- DOMDocument buffer (OUT)- buffer to write to
Nothing
writeToClob(doc DOMDocument, cl IN OUT CLOB);
Writes XML document to specified clob using the database character set
PROCEDURE writeToClob(doc DOMDocument, cl IN OUT CLOB);
doc (IN)- DOMDocument cl (OUT)- CLOB to write to
Nothing
writeToFile(doc DOMDocument, fileName VARCHAR2, charset VARCHAR2);
Writes XML document to specified file using the given character set
PROCEDURE writeToFile(doc DOMDocument, fileName VARCHAR2, charset VARCHAR2);
doc (IN)- DOMDocument fileName (IN)- File to write to charset (IN)- Character set
Nothing
writeToBuffer(doc DOMDocument, buffer IN OUT VARCHAR2, charset VARCHAR2);
Writes XML document to specified buffer using the given character set
PROCEDURE writeToBuffer(doc DOMDocument, buffer IN OUT VARCHAR2, charset VARCHAR2);
doc (IN)- DOMDocument buffer (OUT)- buffer to write to charset (IN)- Character set
Nothing
writeToClob(doc DOMDocument, cl IN OUT CLOB, charset VARCHAR2);
Writes XML document to specified clob using the given character set
PROCEDURE writeToClob(doc DOMDocument, cl IN OUT CLOB, charset VARCHAR2);
doc (IN)- DOMDocument cl (OUT)- CLOB to write to charset (IN)- Character set
Nothing
writeExternalDTDToFile(doc DOMDocument, fileName VARCHAR2);
Writes an external DTD to specified file using the database character set
PROCEDURE writeExternalDTDToFile(doc DOMDocument, fileName VARCHAR2);
doc (IN)- DOMDocument fileName (IN)- File to write to
Nothing
writeExternalDTDToBuffer(doc DOMDocument, buffer IN OUT VARCHAR2);
Writes an external DTD to specified buffer using the database character set
PROCEDURE writeExternalDTDToBuffer(doc DOMDocument, buffer IN OUT VARCHAR2);
doc (IN)- DOMDocument buffer (OUT)- buffer to write to
Nothing
writeExternalDTDToClob(doc DOMDocument, cl IN OUT CLOB);
Writes an external DTD to specified clob using the database character set
PROCEDURE writeExternalDTDToClob(doc DOMDocument, cl IN OUT CLOB);
doc (IN)- DOMDocument cl (OUT)- CLOB to write to
Nothing
writeExternalDTDToFile(doc DOMDocument, fileName VARCHAR2, charset VARCHAR2);
Writes an external DTD to specified file using the given character set
PROCEDURE writeExternalDTDToFile(doc DOMDocument, fileName VARCHAR2, charset VARCHAR2);
doc (IN)- DOMDocument fileName (IN)- File to write to charset (IN)- Character set
Nothing
writeExternalDTDToBuffer(doc DOMDocument, buffer IN OUT VARCHAR2, charset VARCHAR2);
Writes an external DTD to specified buffer using the given character set
PROCEDURE writeExternalDTDToBuffer(doc DOMDocument, buffer IN OUT VARCHAR2, charset VARCHAR2);
doc (IN)- DOMDocument buffer (OUT)- buffer to write to charset (IN)- Character set
Nothing
writeExternalDTDToClob(doc DOMDocument, cl IN OUT CLOB, charset VARCHAR2);
Writes an external DTD to specified clob using the given character set
PROCEDURE writeExternalDTDToClob(doc DOMDocument, cl IN OUT CLOB, charset VARCHAR2);
doc (IN)- DOMDocument cl (OUT)- CLOB to write to charset (IN)- Character set
Nothing
Public interface Attr extends Node.
The Attr interface represents an attribute in an Element object. Typically the allowable values for the attribute are defined in a document type definition.
Attr objects inherit the Node interface, but since they are not actually child nodes of the element they describe, the DOM does not consider them part of the document tree. Thus, the Node attributes parentNode, previousSibling, and nextSibling have a null value for Attr objects. The DOM takes the view that attributes are properties of elements rather than having a separate identity from the elements they are associated with; this should make it more efficient to implement such features as default attributes associated with all elements of a given type. Furthermore, Attr nodes may not be immediate children of a DocumentFragment. However, they can be associated with Element nodes contained within a DocumentFragment. In short, users of DOM need to be aware that Attr nodes have some things in common with other objects inheriting the Node interface, but they also are quite distinct. The attribute's effective value is determined as follows: if this attribute has been explicitly assigned any value, that value is the attribute's effective value; otherwise, if there is a declaration for this attribute, and that declaration includes a default value, then that default value is the attribute's effective value; otherwise, the attribute does not exist on this element in the structure model until it has been explicitly added. Note that the nodeValue attribute on the Attr instance can also be used to retrieve the string version of the attribute's value(s). In XML, where the value of an attribute can contain entity references, the child nodes of the Attr node provide a representation in which entity references are not expanded. These child nodes may be either Text or EntityReference nodes. Because the attribute type may be unknown, there are no tokenized attribute values.
Returns the name of this attribute.
If this attribute was explicitly given a value in the original document, this is true; otherwise, it is false.
On retrieval, the value of the attribute is returned as a string.
Enter an appropriate value.
public abstract String getName()
Returns the name of this attribute.
public abstract boolean getSpecified()
If this attribute was explicitly given a value in the original document, this is true; otherwise, it is false. Note that the implementation is in charge of this attribute, not the user. If the user changes the value of the attribute (even if it ends up having the same value as the default value) then the specified flag is automatically flipped to true. To re-specify the attribute as the default value from the DTD, the user must delete the attribute. The implementation will then make a new attribute available with specified set to false and the default value (if one exists).
In summary: If the attribute has an assigned value in the document then specified is true, and the value is the assigned value. If the attribute has no assigned value in the document and has a default value in the DTD, then specified is false, and the value is the default value in the DTD. If the attribute has no assigned value in the document and has a value of #IMPLIED in the DTD, then the attribute does not appear in the structure model of the document.
public abstract String getValue()
On retrieval, the value of the attribute is returned as a string. Character and general entity references are replaced with their values.
On setting, this creates a Text node with the unparsed contents of the string.
public abstract void setValue(String value)
Public interface CDATASection extends Text.
CDATA sections are used to escape blocks of text containing characters that would otherwise be regarded as markup. The only delimiter that is recognized in a CDATA section is the "]]>" string that ends the CDATA section. CDATA sections can not be nested. The primary purpose is for including material such as XML fragments, without needing to escape all the delimiters.
The DOMString attribute of the Text node holds the text that is contained by the CDATA section. Note that this may contain characters that need to be escaped outside of CDATA sections and that, depending on the character encoding ("charset") chosen for serialization, it may be impossible to write out some characters as part of a CDATA section.
The CDATASection interface inherits the CharacterData interface through the Text interface. Adjacent CDATASections nodes are not merged by use of the Element.normalize() method.
Public interface CharacterData extends Node.
The CharacterData interface extends Node with a set of attributes and methods for accessing character data in the DOM. For clarity this set is defined here rather than on each object that uses these attributes and methods. No DOM objects correspond directly to CharacterData, though Text and others do inherit the interface from it. All offsets in this interface start from 0.
Append the string to the end of the character data of the node.
Remove a range of characters from the node.
The character data of the node that implements this interface.
The number of characters that are available through data and the substringData method below.
Insert a string at the specified character offset.
Replace the characters starting at the specified character offset with the specified string.
Extracts a range of data from the node.
public abstract String getData() throws DOMExecption
The character data of the node that implements this interface. The DOM implementation may not put arbitrary limits on the amount of data that may be stored in a CharacterData node. However, implementation limits may mean that the entirety of a node's data may not fit into a single DOMString. In such cases, the user may call substringData to retrieve the data in appropriately sized pieces.
DOMExecption
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is read only.
DOMExecption
DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a DOMString variable on the implementation platform.
public abstract void setData(String data) throws DOMExecption
public abstract int getLength()
The number of characters that are available through data and the substringData method below. This may have the value zero, i.e., CharacterData nodes may be empty.
public abstract String substringData(int offset, int count) throws DOMExecption
Extracts a range of data from the node.
offset - Start offset of substring to extract.
count - The number of characters to extract.
The specified substring. If the sum of offset and count exceeds the length, then all characters to the end of the data are returned.
DOMExecption
INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of characters in data, or if the specified count is negative.
DOMSTRING_SIZE_ERR: Raised if the specified range of text does not fit into a DOMString.
public abstract void appendData(String arg) throws DOMExecption
Append the string to the end of the character data of the node. Upon success, data provides access to the concatenation of data and the DOMString specified.
arg - The DOMString to append.
DOMExecption
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is read only.
public abstract void insertData(int offset, String arg) throws DOMExecption
Insert a string at the specified character offset.
offset - The character offset at which to insert.
arg - The DOMString to insert.
DOMExecption
INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of characters in data.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is read only.
public abstract void deleteData(int offset, int count) throws DOMExecption
Remove a range of characters from the node. Upon success, data and length reflect the change.
offset - The offset from which to remove characters.
count - The number of characters to delete. If the sum of offset and count exceeds length then all characters from offset to the end of the data are deleted.
DOMExecption
INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of characters in data, or if the specified count is negative.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is read only.
public abstract void replaceData(int offset, int count, String arg) throws DOMExecption
Replace the characters starting at the specified character offset with the specified string.
offset - The offset from which to start replacing.
count - The number of characters to replace. If the sum of offset and count exceeds length , then all characters to the end of the data are replaced (i.e., the effect is the same as a remove method call with the same range, followed by an append method invocation).
arg - The DOMString with which the range must be replaced.
DOMExecption
INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of characters in data, or if the specified count is negative.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is read only.
Public interface Comment extends Node.
This represents the content of a comment, i.e., all the characters between the starting '<!--' and ending '-->'. Note that this is the definition of a comment in XML, and, in practice, HTML, although some HTML tools may implement the full SGML comment structure.
Public interface Document extends Node.
The Document interface represents the entire HTML or XML document. Conceptually, it is the root of the document tree, and provides the primary access to the document's data.
Since elements, text nodes, comments, processing instructions, etc. cannot exist outside the context of a Document, the Document interface also contains the factory methods needed to create these objects. The Node objects created have a ownerDocument attribute which associates them with the Document within whose context they were created.
Creates an Attr of the given name.
Creates a CDATASection node whose value is the specified string.
Creates a Comment node given the specified string.
Creates an empty DocumentFragment object.
Creates an element of the type specified.
Creates an EntityReference object.
Creates a ProcessingInstruction node given the specified name and data strings.
Creates a Text node given the specified string.
The Document Type Declaration (see DocumentType) associated with this document.
This is a convenience attribute that allows direct access to the child node that is the root element of the document.
Returns a NodeList of all the Elements with a given tag name in the order in which they would be encountered in a preorder traversal of the Document tree.
The DOMImplementation object that handles this document.
public abstract getDoctype()
The Document Type Declaration (see DocumentType) associated with this document. For HTML documents as well as XML documents without a document type declaration this returns null. The DOM Level 1 does not support editing the Document Type Declaration, therefore docType cannot be altered in any way.
public abstract getImplementation()
The DOMImplementation object that handles this document. A DOM application may use objects from multiple implementations.
public abstract getDocumentElement()
This is a convenience attribute that allows direct access to the child node that is the root element of the document. For HTML documents, this is the element with the tagName "HTML".
public abstract createElement(String tagName) throws DOMExecption
Creates an element of the type specified. Note that the instance returned implements the Element interface, so attributes can be specified directly on the returned object.
tagName - The name of the element type to instantiate. For XML, this is case-sensitive. For HTML, the tagName parameter may be provided in any case, but it must be mapped to the canonical uppercase form by the DOM implementation.
A new Element object.
DOMExecption
INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.
public abstract createDocumentFragment()
Creates an empty DocumentFragment object.
A new DocumentFragment.
public abstract createTextNode(String data)
Creates a Text node given the specified string.
data - The data for the node.
The new Text object.
public abstract createComment(String data)
Creates a Comment node given the specified string.
data - The data for the node.
public abstract createCDATASection(String data) throws DOMExecption
Creates a CDATASection node whose value is the specified string.
data - The data for the CDATASection contents.
The new CDATASection object.
DOMExecption
NOT_SUPPORTED_ERR: Raised if this document is an HTML document.
public abstract createProcessingInstruction(String target,String data) throws DOMExecption
Creates a ProcessingInstruction node given the specified name and data strings.
target - The target part of the processing instruction.
data - The data for the node.
The new ProcessingInstruction object.
DOMExecption
INVALID_CHARACTER_ERR: Raised if an invalid character is specified.
NOT_SUPPORTED_ERR: Raised if this document is an HTML document.
public abstract createAttribute(String name) throws DOMExecption
Creates an Attr of the given name. Note that the Attr instance can then be set on an Element using the setAttribute method.
name - The name of the attribute.
A new Attr object.
DOMExecption
INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.
public abstract createEntityReference(String name) throws DOMExecption
Creates an EntityReference object.
name - The name of the entity to reference.
The new EntityReference object.
INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.
NOT_SUPPORTED_ERR: Raised if this document is an HTML document.
public abstract getElementsByTagName(String tagname)
Returns a NodeList of all the Elements with a given tag name in the order in which they would be encountered in a preorder traversal of the Document tree.
tagname - The name of the tag to match on. The special value "*" matches all tags.
A new NodeList object containing all the matched Elements.
Public interface DocumentFragment extends Node.
DocumentFragment is a "lightweight" or "minimal" Document object. It is very common to want to be able to extract a portion of a document's tree or to create a new fragment of a document. Imagine implementing a user command like cut or rearranging a document by moving fragments around. It is desirable to have an object which can hold such fragments and it is quite natural to use a Node for this purpose. While it is true that a Document object could fulfil this role, a Document object can potentially be a heavyweight object, depending on the underlying implementation. What is really needed for this is a very lightweight object. DocumentFragment is such an object.
Furthermore, various operations -- such as inserting nodes as children of another Node -- may take DocumentFragment objects as arguments; this results in all the child nodes of the DocumentFragment being moved to the child list of this node.
The children of a DocumentFragment node are zero or more nodes representing the tops of any sub-trees defining the structure of the document. DocumentFragment nodes do not need to be well-formed XML documents (although they do need to follow the rules imposed upon well-formed XML parsed entities, which can have multiple top nodes). For example, a DocumentFragment might have only one child and that child node could be a Text node. Such a structure model represents neither an HTML document nor a well-formed XML document.
When a DocumentFragment is inserted into a Document (or indeed any other Node that may take children) the children of the DocumentFragment and not the DocumentFragment itself are inserted into the Node. This makes the DocumentFragment very useful when the user wishes to create nodes that are siblings; the DocumentFragment acts as the parent of these nodes so that the user can use the standard methods from the Node interface, such as insertBefore() and appendChild().
Public interface DocumentType extends Node.
Each Document has a doctype attribute whose value is either null or a DocumentType object. The DocumentType interface in the DOM Level 1 Core provides an interface to the list of entities that are defined for the document, and little else because the effect of namespaces and the various XML scheme efforts on DTD representation are not clearly understood as of this writing.
The DOM Level 1 doesn't support editing DocumentType nodes.
A NamedNodeMap containing the general entities, both external and internal, declared in the DTD.
The name of DTD; i.e., the name immediately following the DOCTYPE keyword.
A NamedNodeMap containing the notations declared in the DTD.
public abstract String getName()
The name of DTD; i.e., the name immediately following the DOCTYPE keyword.
public abstract getEntities()
A NamedNodeMap containing the general entities, both external and internal, declared in the DTD. Duplicates are discarded. For example in:<!DOCTYPE ex SYSTEM "ex.dtd" [ <!ENTITY foo "foo"> <!ENTITY bar "bar"> <!ENTITY % baz "baz">]> <ex/> the interface provides access to foo and bar but not baz. Every node in this map also implements the Entity interface.
The DOM Level 1 does not support editing entities, therefore entities cannot be altered in any way.
public abstract getNotations()
A NamedNodeMap containing the notations declared in the DTD. Duplicates are discarded. Every node in this map also implements the Notation interface.
The DOM Level 1 does not support editing notations, therefore notations cannot be altered in any way.
java.lang.Object | +---java.lang.Throwable | +---java.lang.Exception | +---java.lang.RuntimeException | +---org.w3c.dom.DOMException
Public abstract class DOMException extends RuntimeException.
DOM operations only raise exceptions in "exceptional" circumstances, i.e., when an operation is impossible to perform (either for logical reasons, because data is lost, or because the implementation has become unstable). In general, DOM methods return specific error values in ordinary processing situation, such as out-of-bound errors when using NodeList.
Implementations may raise other exceptions under other circumstances. For example, implementations may raise an implementation-dependent exception if a null argument is passed.
Some languages and object systems do not support the concept of exceptions. For such systems, error conditions may be indicated using native error reporting mechanisms. For some bindings, for example, methods may return error codes similar to those listed in the corresponding method descriptions.
public static final short INDEX_SIZE_ERR
public static final short DOMSTRING_SIZE_ERR
public static final short HIERARCHY_REQUEST_ERR
public static final short WRONG_DOCUMENT_ERR
public static final short INVALID_CHARACTER_ERR
public static final short NO_DATA_ALLOWED_ERR
public static final short NO_MODIFICATION_ALLOWED_ERR
public static final short NOT_FOUND_ERR
public static final short NOT_SUPPORTED_ERR
public static final short INUSE_ATTRIBUTE_ERR
public DOMException(short code, String message)
Public interface DOMImplementation
The DOMImplementation interface provides a number of methods for performing operations that are independent of any particular instance of the document object model.
The DOM Level 1 does not specify a way of creating a document instance, and hence document creation is an operation specific to an implementation. Future Levels of the DOM specification are expected to provide methods for creating documents directly.
Tests if the DOM implementation implements a specific feature.
public abstract boolean hasFeature(String feature, String version)
Test if the DOM implementation implements a specific feature.
feature - The package name of the feature to test. In Level 1, the legal values are "HTML" and "XML" (case-insensitive).
version - This is the version number of the package name to test. In Level 1, this is the string "1.0". If the version is not specified, supporting any version of the feature will cause the method to return true.
true if the feature is implemented in the specified version, false otherwise.
Public interface Element extends Node.
By far the vast majority of objects (apart from text) that authors encounter when traversing a document are Element nodes. Assume the following XML document:<elementExample id="demo"> <subelement1/> <subelement2><subsubelement/></subelement2> </elementExample>
When represented using DOM, the top node is an Element node for "elementExample", which contains two child Element nodes, one for "subelement1" and one for "subelement2". "subelement1" contains no child nodes.
Elements may have attributes associated with them; since the Element interface inherits from Node, the generic Node interface method getAttributes may be used to retrieve the set of all attributes for an element. There are methods on the Element interface to retrieve either an Attr object by name or an attribute value by name. In XML, where an attribute value may contain entity references, an Attr object should be retrieved to examine the possibly fairly complex sub-tree representing the attribute value. On the other hand, in HTML, where all attributes have simple string values, methods to directly access an attribute value can safely be used as a convenience.
Retrieves an attribute value by name.
Retrieves an Attr node by name.
Returns a NodeList of all descendant elements with a given tag name, in the order in which they would be encountered in a preorder traversal of the Element tree.
The name of the element.
Puts all Text nodes in the full depth of the sub-tree underneath this Element into a "normal" form where only markup (e.g., tags, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are no adjacent Text nodes.
Removes an attribute by name.
Removes the specified attribute.
Adds a new attribute.
Adds a new attribute.
public abstract String getTagName()
The name of the element. For example, in: <elementExample id="demo"> ... </elementExample> , tagName has the value "elementExample". Note that this is case-preserving in XML, as are all of the operations of the DOM. The HTML DOM returns the tagName of an HTML element in the canonical uppercase form, regardless of the case in the source HTML document.
public abstract String getAttribute(String name)
Retrieves an attribute value by name.
name - The name of the attribute to retrieve.
The Attr value as a string, or the empty string if that attribute does not have a specified or default value.
public abstract void setAttribute(String name, String value) throws DOMException
Adds a new attribute. If an attribute with that name is already present in the element, its value is changed to be that of the value parameter. This value is a simple string, it is not parsed as it is being set. So any markup (such as syntax to be recognized as an entity reference) is treated as literal text, and needs to be appropriately escaped by the implementation when it is written out. In order to assign an attribute value that contains entity references, the user must create an Attr node plus any Text and EntityReference nodes, build the appropriate subtree, and use setAttributeNode to assign it as the value of an attribute.
name - The name of the attribute to create or alter.
value - Value to set in string form.
DOMException
INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is read only.
public abstract void removeAttribute(String name) throws DOMException
Removes an attribute by name. If the removed attribute has a default value it is immediately replaced.
name - The name of the attribute to remove.
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is read only.
public abstract Attr getAttributeNode(String name)
Retrieves an Attr node by name.
name - The name of the attribute to retrieve.
The Attr node with the specified attribute name or null if there is no such attribute.
public abstract Attr setAttributeNode(Attr newAttr) throws
Adds a new attribute. If an attribute with that name is already present in the element, it is replaced by the new one.
newAttr - The Attr node to add to the attribute list.
If the newAttr attribute replaces an existing attribute with the same name, the previously existing Attr node is returned, otherwise null is returned.
DOMException
WRONG_DOCUMENT_ERR: Raised if newAttr was created from a different document than the one that created the element.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is read only.
INUSE_ATTRIBUTE_ERR: Raised if newAttr is already an attribute of another Element object. The DOM user must explicitly clone Attr nodes to re-use them in other elements.
public abstract Attr removeAttributeNode(Attr oldAttr) throws DOMException
Removes the specified attribute.
oldAttr - The Attr node to remove from the attribute list. If the removed Attr has a default value it is immediately replaced.
The Attr node that was removed.
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is read only.
NOT_FOUND_ERR: Raised if oldAttr is not an attribute of the element.
public abstract getElementsByTagName(String name)
Returns a NodeList of all descendant elements with a given tag name, in the order in which they would be encountered in a preorder traversal of the Element tree.
name - The name of the tag to match on. The special value "*" matches all tags.
A list of matching Element nodes.
public abstract void normalize()
Puts all Text nodes in the full depth of the sub-tree underneath this Element into a "normal" form where only markup (e.g., tags, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are no adjacent Text nodes. This can be used to ensure that the DOM view of a document is the same as if it were saved and re-loaded, and is useful when operations (such as XPointer lookups) that depend on a particular document tree structure are to be used.
Public interface Entity extends Node.
This interface represents an entity, either parsed or unparsed, in an XML document. Note that this models the entity itself not the entity declaration. Entity declaration modeling has been left for a later Level of the DOM specification.
The nodeName attribute that is inherited from Node contains the name of the entity.
An XML processor may choose to completely expand entities before the structure model is passed to the DOM; in this case there will be no EntityReference nodes in the document tree.
XML does not mandate that a non-validating XML processor read and process entity declarations made in the external subset or declared in external parameter entities. This means that parsed entities declared in the external subset need not be expanded by some classes of applications, and that the replacement value of the entity may not be available. When the replacement value is available, the corresponding Entity node's child list represents the structure of that replacement text. Otherwise, the child list is empty.
The resolution of the children of the Entity (the replacement value) may be lazily evaluated; actions by the user (such as calling the childNodes method on the Entity Node) are assumed to trigger the evaluation.
The DOM Level 1 does not support editing Entity nodes; if a user wants to make changes to the contents of an Entity, every related EntityReference node has to be replaced in the structure model by a clone of the Entity's contents, and then the desired changes must be made to each of those clones instead. All the descendants of an Entity node are read only.
An Entity node does not have any parent.
For unparsed entities, the name of the notation for the entity.
The public identifier associated with the entity, if specified.
The system identifier associated with the entity, if specified.
public abstract String getPublicId()
The public identifier associated with the entity, if specified. If the public identifier was not specified, this is null.
public abstract String getSystemId()
The system identifier associated with the entity, if specified. If the system identifier was not specified, this is null.
public abstract String getNotationName()
For unparsed entities, the name of the notation for the entity. For parsed entities, this is null.
Public interface EntityReference extends Node.
EntityReference objects may be inserted into the structure model when an entity reference is in the source document, or when the user wishes to insert an entity reference. Note that character references and references to predefined entities are considered to be expanded by the HTML or XML processor so that characters are represented by their Unicode equivalent rather than by an entity reference. Moreover, the XML processor may completely expand references to entities while building the structure model, instead of providing EntityReference objects. If it does provide such objects, then for a given EntityReference node, it may be that there is no Entity node representing the referenced entity; but if such an Entity exists, then the child list of the EntityReference node is the same as that of the Entity node. As with the Entity node, all descendants of the EntityReference are read only.
The resolution of the children of the EntityReference (the replacement value of the referenced Entity) may be lazily evaluated; actions by the user (such as calling the childNodes method on the EntityReference node) are assumed to trigger the evaluation.
Public interface NamedNodeMap
Objects implementing the NamedNodeMap interface are used to represent collections of nodes that can be accessed by name. Note that NamedNodeMap does not inherit from NodeList; NamedNodeMaps are not maintained in any particular order. Objects contained in an object implementing NamedNodeMap may also be accessed by an ordinal index, but this is simply to allow convenient enumeration of the contents of a NamedNodeMap, and does not imply that the DOM specifies an order to these Nodes.
The number of nodes in the map.
Retrieves a node specified by name.
Returns the indexth item in the map.
Removes a node specified by name.
Adds a node using its nodeName attribute.
public abstract getNamedItem(String name)
Retrieves a node specified by name.
name - Name of a node to retrieve.
A Node (of any type) with the specified name, or null if the specified name did not identify any node in the map.
public abstract Node setNamedItem(Node arg) throws DOMException
Adds a node using its nodeName attribute.
As the nodeName attribute is used to derive the name which the node must be stored under, multiple nodes of certain types (those that have a "special" string value) cannot be stored as the names would clash. This is seen as preferable to allowing nodes to be aliased.
arg - A node to store in a named node map. The node will later be accessible using the value of the nodeName attribute of the node. If a node with that name is already present in the map, it is replaced by the new one.
If the new Node replaces an existing node with the same name the previously existing Node is returned, otherwise null is returned.
DOMException
WRONG_DOCUMENT_ERR: Raised if arg was created from a different document than the one that created the NamedNodeMap.
NO_MODIFICATION_ALLOWED_ERR: Raised if this NamedNodeMap is read only.
INUSE_ATTRIBUTE_ERR: Raised if arg is an Attr that is already an attribute of another Element object. The DOM user must explicitly clone Attr nodes to re-use them in other elements.
public abstract Node removeNamedItem(String name) throws DOMException
Removes a node specified by name. If the removed node is an Attr with a default value it is immediately replaced.
name - The name of a node to remove.
The node removed from the map or null if no node with such a name exists.
DOMException
NOT_FOUND_ERR: Raised if there is no node named name in the map.
public abstract Node item(int index)
Returns the indexth item in the map. If index is greater than or equal to the number of nodes in the map, this returns null.
index - Index into the map.
The node at the indexth position in the NamedNodeMap, or null if that is not a valid index.
public abstract int getLength()
The number of nodes in the map. The range of valid child node indices is 0 to length-1 inclusive.
Public interface Node
The Node interface is the primary datatype for the entire Document Object Model. It represents a single node in the document tree. While all objects implementing the Node interface expose methods for dealing with children, not all objects implementing the Node interface may have children. For example, Text nodes may not have children, and adding children to such nodes results in a DOMException being raised.
The attributes nodeName, nodeValue and attributes are included as a mechanism to get at node information without casting down to the specific derived interface. In cases where there is no obvious mapping of these attributes for a specific nodeType (e.g., nodeValue for an Element or attributes for a Comment), this returns null. Note that the specialized interfaces may contain additional and more convenient mechanisms to get and set the relevant information.
Adds the node newChild to the end of the list of children of this node.
Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes.
A NamedNodeMap containing the attributes of this node (if it is an Element) or null otherwise.
A NodeList that contains all children of this node.
The first child of this node.
The last child of this node.
The node immediately following this node.
The name of this node, depending on its type; see the table above.
A code representing the type of the underlying object, as defined above.
The value of this node, depending on its type; see the table above.
The Document object associated with this node.
The parent of this node.
The node immediately preceding this node.
This is a convenience method to allow easy determination of whether a node has any children.
Inserts the node newChild before the existing child node refChild.
Removes the child node indicated by oldChild from the list of children, and returns it.
Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.
public static final short ELEMENT_NODE
public static final short ATTRIBUTE_NODE
public static final short TEXT_NODE
public static final short CDATA_SECTION_NODE
public static final short ENTITY_REFERENCE_NODE
public static final short ENTITY_NODE
public static final short PROCESSING_INSTRUCTION_NODE
public static final short COMMENT_NODE
public static final short DOCUMENT_NODE
public static final short DOCUMENT_TYPE_NODE
public static final short DOCUMENT_FRAGMENT_NODE
public static final short NOTATION_NODE
public abstract String getNodeName()
The name of this node, depending on its type; see the table above.
public abstract String getNodeValue() throws
The value of this node, depending on its type; see the table above.
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is read only.
DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a DOMString variable on the implementation platform.
public abstract void setNodeValue(String nodeValue) throws DOMException
public abstract short getNodeType()
A code representing the type of the underlying object, as defined above.
public abstract Node getParentNode()
The parent of this node. All nodes, except Document, DocumentFragment, and Attr may have a parent. However, if a node has just been created and not yet added to the tree, or if it has been removed from the tree, this is null.
public abstract NodeList getChildNodes()
A NodeList that contains all children of this node. If there are no children, this is a NodeList containing no nodes. The content of the returned NodeList is "live" in the sense that, for instance, changes to the children of the node object that it was created from are immediately reflected in the nodes returned by the NodeList accessors; it is not a static snapshot of the content of the node. This is true for every NodeList, including the ones returned by the getElementsByTagName method.
public abstract Node getFirstChild()
The first child of this node. If there is no such node, this returns null.
public abstract Node getLastChild()
The last child of this node. If there is no such node, this returns null.
public abstract Node getPreviousSibling()
The node immediately preceding this node. If there is no such node, this returns null.
public abstract Node getNextSibling()
The node immediately following this node. If there is no such node, this returns null.
public abstract NamedNodeMap getAttributes()
A NamedNodeMap containing the attributes of this node (if it is an Element) or null otherwise.
public abstract Document getOwnerDocument()
The Document object associated with this node. This is also the Document object used to create new nodes. When this node is a Document this is null.
public abstract Node insertBefore(Node newChild,Node refChild) throws DOMException
Inserts the node newChild before the existing child node refChild. If refChild is null, insert newChild at the end of the list of children.
If newChild is a DocumentFragment object, all of its children are inserted, in the same order, before refChild. If the newChild is already in the tree, it is first removed.
newChild - The node to insert.
refChild - The reference node, i.e., the node before which the new node must be inserted.
The node being inserted.
DOMException
HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to insert is one of this node's ancestors.
WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is read only.
NOT_FOUND_ERR: Raised if refChild is not a child of this node.
public abstract Node replaceChild(Node newChild,Node oldChild) throws DOMException
Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node. If the newChild is already in the tree, it is first removed.
newChild - The new node to put in the child list.
oldChild - The node being replaced in the list.
The node replaced.
DOMException
HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or it the node to put in is one of this node's ancestors.
WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is read only.
NOT_FOUND_ERR: Raised if oldChild is not a child of this node.
public abstract Node removeChild(Node oldChild) throws DOMException
Removes the child node indicated by oldChild from the list of children, and returns it.
oldChild - The node being removed.
The node removed.
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is read only.
NOT_FOUND_ERR: Raised if oldChild is not a child of this node.
public abstract appendChild( newChild) throws DOMException
Adds the node newChild to the end of the list of children of this node. If the newChild is already in the tree, it is first removed.
newChild - The node to add.If it is a DocumentFragment object, the entire contents of the document fragment are moved into the child list of this node
The node added.
DOMException
HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to append is one of this node's ancestors.
WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is read only.
public abstract boolean hasChildNodes()
This is a convenience method to allow easy determination of whether a node has any children.
true if the node has any children, false if the node has no children.
public abstract Node cloneNode(boolean deep)
Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. The duplicate node has no parent ( parentNode returns null.).
Cloning an Element copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any text it contains unless it is a deep clone, since the text is contained in a child Text node. Cloning any other type of node simply returns a copy of this node.
deep - If true, recursively clone the subtree under the specified node; if false, clone only the node itself (and its attributes, if it is an Element).
The duplicate node.
Public interface NodeList
The NodeList interface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented.
The items in the NodeList are accessible via an integral index, starting from 0.
The number of nodes in the list.
Returns the indexth item in the collection.
public abstract Node item(int index)
Returns the indexth item in the collection. If index is greater than or equal to the number of nodes in the list, this returns null.
index - Index into the collection.
The node at the indexth position in the NodeList, or null if that is not a valid index.
public abstract int getLength()
The number of nodes in the list. The range of valid child node indices is 0 to length-1 inclusive.
Public interface Notation extends Node.
This interface represents a notation declared in the DTD. A notation either declares, by name, the format of an unparsed entity (see section 4.7 of the XML 1.0 specification), or is used for formal declaration of Processing Instruction targets (see section 2.6 of the XML 1.0 specification). The nodeName attribute inherited from Node is set to the declared name of the notation.
The DOM Level 1 does not support editing Notation nodes; they are therefore read only.
A Notation node does not have any parent.
The public identifier of this notation.
The system identifier of this notation.
public abstract String getPublicId()
The public identifier of this notation. If the public identifier was not specified, this is null.
public abstract String getSystemId()
The system identifier of this notation. If the system identifier was not specified, this is null.
Public interface ProcessingInstruction extends Node.
The ProcessingInstruction interface represents a "processing instruction", used in XML as a way to keep processor-specific information in the text of the document.
The content of this processing instruction.
The target of this processing instruction.
public abstract String getTarget()
The target of this processing instruction. XML defines this as being the first token following the markup that begins the processing instruction.
public abstract String getData()
The content of this processing instruction. This is from the first non white space character after the target to the character immediately preceding the ?>.
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is read only.
public abstract void setData(String data) throws
Public interface Text extends CharacterData.
The Text interface represents the textual content (termed character data in XML) of an Element or Attr. If there is no markup inside an element's content, the text is contained in a single object implementing the Text interface that is the only child of the element. If there is markup, it is parsed into a list of elements and Text nodes that form the list of children of the element.
When a document is first made available via the DOM, there is only one Text node for each block of text. Users may create adjacent Text nodes that represent the contents of a given element without any intervening markup, but should be aware that there is no way to represent the separations between these nodes in XML or HTML, so they will not (in general) persist between DOM editing sessions. The normalize() method on Element merges any such adjacent Text objects into a single node for each block of text; this is recommended before employing operations that depend on a particular document structure, such as navigation with XPointers.
Breaks this Text node into two Text nodes at the specified offset, keeping both in the tree as siblings.
public abstract Text splitText(int offset) throws DOMException
Breaks this Text node into two Text nodes at the specified offset, keeping both in the tree as siblings. This node then only contains all the content up to the offset point. And a new Text node, which is inserted as the next sibling of this node, contains all the content at and after the offset point.
offset - The offset at which to split, starting from 0.
The new Text node.
DOMException
INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of characters in data.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is read only.
|
![]() Copyright © 1996-2001, Oracle Corporation. All Rights Reserved. |
|