XML Flashcards
What is the Document Object Model (DOM)
a framework for manipulating XML documents
What are the language-specific versions of DOM methods and objects called?
bindings
What is parsing (DOM)?
reading from a file to a DOM tree
What is serialisation (DOM)?
writing DOM tree to a file by converting the DOM tree into an XML character stream
What is processing (DOM)?
manipulating the DOM tree
In Java, how would you get the root/document element of a document?
doc.getDocumentElement()
Code to create a parser in Java
DocumentBuilderFactory factory
= DocumentBuilderFactory . newInstance (); DocumentBuilder parser
= factory . newDocumentBuilder ();
what are the three types of node?
- Element
- Attribute
- Text
What is the very top of the DOM hierarchy called?
Document node
What two children does the document node always have?
- Document element
- Document type
What is canonicalization?
a process used to ensure that data is represented in a standardized and consistent form, resulting in a single DOM tree
Advantages of DOM (5)
- Conceptually clear
- Random access to entire doc
- Change documents
- Create documents
- Output results
Disadvantages of DOM (5)
- We hold entire syntax tree in memory
- Costly if document is very large
- Or if the document is never complete
- We also have to wait for complete tree before we output results
- Can’t start output based on partial
tree.
How does event-based parsing (SAX) differ from tree-based parsing (DOM)?
is it not required that the entire document is loaded into memory as a tree structure