The validating parser provides support for parsing XML document fragments. The W3C XML specification allows parsing of such document fragments as external parsed entities. The document fragment can be the value of a single attribute, as well as a single element and its descendants. It may be followed by comments and processing instructions. The parser must be provided ancestor and namespace context information to ensure proper validation.
<root>
<Person>
<name mgr = "NO">Bill</name>
<age>60</age>
</Person>
....
<Person>
<name mgr = "NO">Joe</name>
<age>45</age>
</Person>
</root>
Each Person element is a fragment. If
the caller wants to add another Person element fragment
and validate that it adheres to an associated schema, with validating
fragment support, the caller can perform a validating parse of just
the individual fragment to be added and then insert the fragment into
the document. Prior to this support, the caller would have had to
perform a validating parse of the entire document after inserting
the new fragment.