| ||||||||
Subdocuments and Fragments of XML DocumentsThis article discusses the terminology of document fragments and the details of CMarkup's support for them. A subdocument is an element with its attributes and all its content as a unit, even if the element contains a whole tree of elements. Also, a subdocument is a well-formed document on its own, for example: <R>
<NAME form="f">John</NAME>
<MSG flag="1">Pay <B>Attention!</B></MSG>
<ID>10</ID>
</R>
A document fragment can be anything that you would find in the content of an element. It might be text or elements, or both in the case of mixed content. So, while a subdocument is a type of document fragment it is limited to those document fragments that have exactly one element at the top level. The following document fragment is taken from the content of the R element above and it consists of three sibling elements with no parent element so it would not be considered a subdocument: <NAME form="f">John</NAME>
<MSG flag="1">Pay <B>Attention!</B></MSG>
<ID>10</ID>
CMarkup has these methods for handling subdocuments: AddSubDoc, AddChildSubDoc, InsertSubDoc, InsertChildSubDoc, GetSubDoc, GetChildSubDoc. There are two methods for content: GetElemContent, SetElemContent.
<MSG flag="1">Pay <B>Attention!</B></MSG>
Pay <B>Attention!</B>
As of release 8.0, CMarkup takes a lenient approach to document fragments that are not well formed.
Use
| ||||||
|
Posted December 3, 2005. Question or comment about this article? ©Copyright 2008 First Objective Software, Inc. All rights reserved. |