Question: Provide an XML Document Model with the following details: This project requires you to develop an XML parsing facility that reads XML strings or text

Provide an XML Document Model with the following details: This project requires you to develop an XML parsing facility that reads XML strings or text files, builds a Document object that can be queried for information about the XML contents, supports programmatic modification of the Document, and can write the revisions to another XML string or file. The project requires you to develop Java packages to: parse the input, build a tree-based in-memory representation of the XML called a parse tree1, and support modifications of that representation. This facility will support read and write operations. It will also support the programmatic creation of new XML strings and files. Requirements: Your XML Document project: 1. Shall use standard Java libraries, compile and link from the NetBeans. 2. Shall use services of the Scanner library for all input and output to and from the users console. 3. Shall provide a facility to read XML strings and files and build an internal parse tree representation wrapped in a Document object. Each XML element is represented by a node in the tree. Some elements may have a finite number of attributes, e.g., name-value pairs, stored in a container in the element node. Also, some elements may have child elements. 4. Shall provide the capability to find any element based on a unique id attribute2 for all those elements that possess id attributes. If an element with the specified id attribute is found, a reference to the element node is returned. If no such element exists a null reference is returned. 5. Shall provide the capability to find a collection of elements that have a specified tag. The elements are returned with a container that holds references to each element that has the specified tag. If no such elements exist, an empty list is returned. 6. Shall provide the capability to add a child element to, and remove a child from, any element in the tree that can hold child references, found by id or tag. Addition returns a boolean success value. Shall also provide the ability to add a root element to an empty document tree3. Shall provide the capability to remove a child from any element in the tree that can hold child references, found by id or tag. Removal returns a boolean success value. 7. Shall, given a pointer to any element, provide a facility to return a list containing all the name-value attribute pairs attached to that element. If the element has no attributes an empty list is returned. Shall also provide a facility to return a list of references to all the children of a specified element. If the element has no children an empty list is returned. 8. Shall provide the ability to add or remove an attribute name-value pair from any element node that supports attributes. 9. Shall provide the capability to read an XML string or file and build the corresponding internal tree representation. Shall also provide the capability to write an XML string or file corresponding to the internal tree representation. 10. Shall provide a test executive package that accepts a command line argument specifying an XML file to parse, displays the corresponding tree structure, and continues on to demonstrate each of the functional requirements given here. Note that there is no requirement to provide a graphical user interface. If you do so, you should also provide a command line interface, as required in #11. Please demonstrate that you meet all of the requirements, stated above.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!