Andy wrote:
Is there any way to validate XML document agains schema, but at the
same time ignore any attributes or elements that are not specified in
schema?
Example:
<Customer>
<LastName></LastName>
<FirstName></FirstName>
<Age></Age>
<AnyNode/>
</Customer >
Assume that schema only define LastName, and FirstName.
How can Age be ignored without knowing that it is Age?
How can AnyNode be ignored?
Here is a schema that specifies that <Customer> is a sequence of
<LastName>, <FirstName> and an unspecified number of elements that are
skipped during validation:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Customer">
<xs:complexType>
<xs:sequence>
<xs:element name="LastName" type="xs:string" />
<xs:element name="FirstName" type="xs:string" />
<xs:any processContents="skip" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
--
Martin Honnen
http://JavaScript.FAQTs.com/