PREV NEXT
XML DOM:
- DOM is a language and platform neutral definition i.e. interfaces are defined for different objects comprising the DOM but no specifics of implementation are provided.
- XML document can be represented as a tree that shows all elements and their relationships to one another.
- Each item in the tree is a node – an atomic piece of information that can be manipulated
- 2 unicode formats are the basis of XML characters – UTF-8 and UTF-16.
- DOM working:
- Parses the file, breaking the file into individual elements, attributes etc.
- Creates a representation of XML file as a node tree
- Access the contents of the document through the node tree
- DOM loads an entire document into memory and parses it into a document tree. It tends to consume an inordinate amount of memory.
- Node parentNode – a property in object Node : For Document, DocumentFragment and Attr nodes, parentNode is always null
- Node cloneNode(boolean deep) – a method in object Node : Duplicate node that is created has no parent
- Element createElement (DOMString tagName) – a method in Document : This does not actually attach the element to the node tree. For that appendChild() method is called.
- Node setNamedItem(Node nodeArg) – a method in NamedNodeMap : Same Attr node may not be added to more than one element, the Attr node needs to be first cloned before it may be added elsewhere.
- Node removeNamedItem(DOMString name) – a method in NamedNodeMap : Attr nodes with defaults removed in this way are instead modified to take the default values.
Post Your Thoughts