Question: Write a document builder that turns an invoice object, as defined in Chapter 12, into an XML file of the format described in How To

Write a document builder that turns an invoice object, as defined in Chapter 12, into an XML file of the format described in How To 25.2.

Data from how to 25.2

M cars C HOW TO 25.2 Writing an XML Document What is

the best way to write an XML document? This How To shows

you how to produce a Document object and generate an XML document

from it. Step 1 Provide the outline of a document builder class.

To construct the Document object from an object of some class, you

M cars C HOW TO 25.2 Writing an XML Document What is the best way to write an XML document? This How To shows you how to produce a Document object and generate an XML document from it. Step 1 Provide the outline of a document builder class. To construct the Document object from an object of some class, you should implement a class such as this one: public class MyBuilder { } private DocumentBuilder builder; private Document doc; public Document build (Some Class x) {...} private Element createTextElement (String name, String text) { } Text t= doc.createTextNode(text); Elemente doc.createElement(name); e.appendChild(t); return e;

Step by Step Solution

3.45 Rating (161 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To build a document generator that converts an invoice object into an XML document as described in the provided images How To 252 steps you would define a builder class that takes an invoice object an... View full answer

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 Java Programming Questions!