
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Putting Together an XML Document
|
861
See Also
See the “XmlDocument Class,” “XmlElement Class,” and “XmlAttribute Class” top-
ics in the MSDN documentation.
15.10 Putting Together an XML Document
Problem
You have various pieces of a document in XML form that need to be put together to
form a single XML document—the opposite of what was done in Recipe 15.9. In this
case, you have received various pieces of an invoice in XML form. For example, one
department sent the shipping information as an XML document, one sent the billing
information in XML, and another sent invoice line items, also as an XML document.
You need a way to put these XML pieces together to form a single XML invoice
document.
Solution
In order to reconstitute the original invoice, you need to reverse the process used to
create the pieces of the invoice using multiple
XmlDocuments. There are three parts
being sent back to you to help in re-forming the original invoice XML:
BillingEnvelope.
xml
, ShippingEnvelope.xml, and Fulfillment.xml. These are listed below:
BillingEnvelope XML
<BillingEnvelope invoiceDate="2003-10-05" invoiceNumber="INV-01">
<billInfo>
<name>Beerly Standing</name>
<attn>Accounting</attn>
<street>98 North Street</street>
<city>Intox</city>
<state>NH</state>
</billInfo>
</BillingEnvelope>
ShippingEnvelope XML ...