0% found this document useful (0 votes)
15 views1 page

DOM Quickref

The document defines interfaces and classes for working with XML documents using the Document Object Model (DOM) in Java. It includes: 1. The Node interface which defines common methods for nodes in an XML document tree like getting/setting attributes and child nodes. 2. Classes like DOMException for handling exceptions and interfaces for specific node types like Element, Attr, Text. 3. The Document interface for accessing/creating nodes in an XML document like elements, comments, and document structure. 4. Other interfaces for common DOM tasks like DOMImplementation for capabilities, NodeList for collections of nodes.

Uploaded by

Mirela Marinescu
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views1 page

DOM Quickref

The document defines interfaces and classes for working with XML documents using the Document Object Model (DOM) in Java. It includes: 1. The Node interface which defines common methods for nodes in an XML document tree like getting/setting attributes and child nodes. 2. Classes like DOMException for handling exceptions and interfaces for specific node types like Element, Attr, Text. 3. The Document interface for accessing/creating nodes in an XML document like elements, comments, and document structure. 4. Other interfaces for common DOM tasks like DOMImplementation for capabilities, NodeList for collections of nodes.

Uploaded by

Mirela Marinescu
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

JavaDOMLevel2QuickReference(packageorg.w3c.

dom)
publicinterfaceNode
Constants: short ATTRIBUTE_NODE short CDATA_SECTION_NODE short COMMENT_NODE short DOCUMENT_FRAGMENT_NODE short DOCUMENT_NODE short DOCUMENT_TYPE_NODE short ELEMENT_NODE short ENTITY_NODE short ENTITY_REFERENCE_NODE short NOTATION_NODE short PROCESSING_INSTRUCTION_NODE short TEXT_NODE Methods: short getNodeType(); String getNodeName(); String getLocalName(); String getPrefix(); void setPrefix(Stringprefix)throwsDOMException; String getNamespaceURI(); String getNodeValue()throwsDOMException; void setNodeValue(StringnodeValue)throwsDOMException; Document getOwnerDocument(); Node getParentNode(); boolean hasChildNodes(); NodeList getChildNodes(); Node getFirstChild(); Node getLastChild(); Node getPreviousSibling(); Node getNextSibling(); boolean hasAttributes(); NamedNodeMap getAttributes(); Node appendChild(NodenewChild)throwsDOMException; Node insertBefore(NodenewChild,NoderefChild)throwsDOMException; Node replaceChild(NodenewChild,NodeoldChild)throwsDOMException; Node removeChild(NodeoldChild)throwsDOMException; Node cloneNode(booleandeep); void normalize(); boolean isSupported(Stringfeature,Stringversion);

publicclassDOMException
Fields: short code staticshort DOMSTRING_SIZE_ERR staticshort HIERARCHY_REQUEST_ERR staticshort INDEX_SIZE_ERR staticshort INUSE_ATTRIBUTE_ERR staticshort INVALID_ACCESS_ERR staticshort INVALID_CHARACTER_ERR staticshort INVALID_MODIFICATION_ERR staticshort INVALID_STATE_ERR staticshort NAMESPACE_ERR staticshort NO_DATA_ALLOWED_ERR staticshort NO_MODIFICATION_ALLOWED_ERR staticshort NOT_FOUND_ERR staticshort NOT_SUPPORTED_ERR staticshort SYNTAX_ERR staticshort WRONG_DOCUMENT_ERR Constructors: DOMException(shortcode,Stringmessage);

publicinterfaceAttr

Methods: String getName(); String getValue(); void setValue(Stringvalue) throwsDOMException; boolean getSpecified(); ElementgetOwnerElement();

publicinterfaceCharacterData
Methods: int getLength(); String getData()throwsDOMException; void setData(Stringdata)throwsDOMException; String substringData(intoffset,intcount)throwsDOMException; void appendData(Stringarg)throwsDOMException; void deleteData(intoffset,intcount)throwsDOMException; void insertData(intoffset,Stringarg)throwsDOMException; void replaceData(intoffset,intcount,Stringarg)throwsDOMException;

publicinterfaceComment
publicinterfaceText
Methods: TextsplitText(intoffset)throwsDOMException;

publicinterfaceDOMImplementation
Methods: boolean hasFeature(Stringfeature,Stringversion); DocumentType createDocumentType(StringqName,StringpublicId, StringsystemId)throwsDOMException; Document createDocument(StringnamespaceURI,StringqName, DocumentTypedocType)throwsDOMException;

publicinterfaceCDATASection

publicinterfaceNamedNodeMap
Methods: int getLength(); Node item(intindex); Node Node Node Node Node Node getNamedItem(Stringname); getNamedItemNS(StringnamespaceURI,StringlocalName); setNamedItem(Nodearg)throwsDOMException; setNamedItemNS(Nodearg)throwsDOMException; removeNamedItem(Stringname)throwsDOMException; removeNamedItemNS(StringnamespaceURI,StringlocalName) throwsDOMException;

publicinterfaceDocument
Methods: DocumentType getDoctype(); Element getDocumentElement(); DOMImplementation getImplementation(); Attr Attr createAttribute(Stringname)throwsDOMException; createAttributeNS(StringnamespaceURI,StringqName) throwsDOMException; createCDATASection(Stringdata) throwsDOMException;

Comment DocumentFragment Element Element

createComment(Stringdata); createDocumentFragment(); createElement(StringtagName)throwsDOMException; createElementNS(StringnamespaceURI,StringqName) throwsDOMException; EntityReference createEntityReference(Stringname)throwsDOMException; ProcessingInstruction createProcessingInstruction(Stringtarget,Stringdata) throwsDOMExcption; Text createTextNode(Stringdata); Node Element NodeList NodeList importNode(NodeimportedNode,booleandeep)throwsDOMException; getElementById(StringelementId); getElementsByTagName(StringtagName); getElementsByTagNameNS(StringnamespaceURI,StringlocalName);

publicinterface

CDATASection

DocumentType
Methods: String String String String NamedNodeMap NamedNodeMap getName(); getPublicId(); getSystemId(); getInternalSubset(); getEntities(); getNotations();

publicinterfaceNodeList
Methods: int getLength(); Node item(intindex);

publicinterfaceDocumentFragment
publicinterfaceElement
Methods: String getTagName(); String getAttribute(Stringname); String getAttributeNS(StringnamespaceURI,StringlocalName); void setAttribute(Stringname,Stringvalue)throwsDOMException; void setAttributeNS(StringnamespaceURI,StringqName,Stringvalue) throwsDOMException; void removeAttribute(Stringname)throwsDOMException; void removeAttributeNS(StringnamespaceURI,StringlocalName) throwsDOMException;

Attr Attr Attr Attr Attr NodeList NodeList boolean boolean

getAttributeNode(Stringname); getAttributeNodeNS(StringnamespaceuURI,StringlocalName); setAttributeNode(AttrnewAttr)throwsDOMException; setAttributeNodeNS(AttrnewAttr)throwsDOMException; removeAttributeNode(AttroldAttr)throwsDOMException; getElementsByTagName(Stringname); getElementsByTagNameNS(StringnamespaceURI, StringlocalName); hasAttribute(Stringname); hasAtributeNS(StringnamespaceURI,StringlocalName);

publicinterfaceEntity
Methods: String getPublicId(); String getSystemId(); String getNotationName();

publicinterfaceEntityReference

publicinterfaceNotation
Methods:

publicinterfaceProcessingInstruction
Methods: String String void getTarget(); getData(); setData(Stringdata)throwsDOMException;

String String

getPublicId(); getSystemId();

LayoutPekkaKilpelinen UniversityofKuopio,200305

You might also like