We will build a basic XML processing infrastructure with Java.
We start with scanning and parsing XML documents to an internal storage representation (shredding).
Given our internal representation (our XML database) we reconstruct the well-formed XML file again (serialization).
The lecture introduced you to the concept of a separate scanning and parsing process to simplify the interpretation of computer languages. While the project is already equipped with a fully functional Scanner, the implementation of the Parser is not yet complete (see TODO: Exercise 1
comments in Parser.java). It should support the following (simplified) LL1 grammar:
document : element element : element1 element2 element1 : L_BR NAME attributeList1 element2 : R_BR content endTag | CLOSE_R_BR attributeList1 : ε | SPACE attributeList2 attributeList2 : ε | attribute attributeList1 attribute : NAME space EQ space QUOTE ATT_VAL QUOTE endTag : L_BR_CLOSE NAME space R_BR content : ε | TEXT content | element content optionalSpace : ε | SPACE
In this exercise you will add some basic functionality to our main memory XML database. Here is a quick review of some important classes:
To solve exercise 2 locate all TODO: Exercise 2
tasks and add your code:
The writeDoc() method in XMLDB is used to output the table’s document nodes in the well-known XML representation. Implement this method and
Some more comments on how to accomplish this are inside the source templates.