during parsing when we come across start and end elements we hit upon start and end elements
elements and to display the text we use the characters.
Now we are using the DOM,
http://www.w3schools.com/dom/dom_intro.asp
Some points of interest:
1. Objective of DOM has been to provide a standard programming interface to a wide variety applications.
2. With XML DOM one can create an XML document, navigate its structure and add, modify or delete its elements.
3. DOM represents a tree view of the XMl document
4.
Node Type | Example |
---|---|
Document type | <!DOCTYPE food SYSTEM "food.dtd"> |
Processing instruction | <?xml version="1.0"?> |
Element | <drink type="beer">Carlsberg</drink> |
Attribute | type="beer" |
Text | Carlsberg |
5.
One of the first things many programmers want to know is how to read an XML file and generate a DOM Document object from it. Use the DOMEcho example to learn how to do this in three steps. The important lines are:
// Step 1: create a DocumentBuilderFactoryMore on this
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
// Step 2: create a DocumentBuilder
DocumentBuilder db = dbf.newDocumentBuilder();
// Step 3: parse the input file to get a Document object
Document doc = db.parse(new File(filename));
No comments:
Post a Comment