views:

22

answers:

1

Hi ppl,

I need a clarification on one of scenarios of <xsd:any>.

What if namespace attribute's value is ##any and the attribute processContents doesn't exist (the default value is strict)?

What will be the case here, Should the processor validate the elements against any schemes!?

Ex for clarification: Here's XSD section:

......
<xsd:complexType name="reservedType"> <!-- a declaration for an element `reserved` -->
 <xsd:sequence>
  <xsd:any namespace="##any"/>
 </xsd:sequence>
</xsd:complexType>
..........

And here's the XML:

<c:reserved>
<message xmlns="unknown_schema">
 <msg>Hello</msg>
</message>
</c:reserved>

Whenever I try to validate this xml against the above schema, I get:

The matching wildcard is strict, but no declaration can be found for element 'message'.

How this come, and the namespace is ##any ??!!!!!!!!

Please help.

+1  A: 

The default processing model for xsd:any is strict. So yes, you will have to set this element to lax or skip:

<xsd:sequence>
  <xsd:any namespace="##any" processContents="lax"/>
</xsd:sequence>

Please refer to Section 3.10.2 of the XML Schema specification. See the table just below, on "Wildcard Schema Components", in particular the process contents attribute.

xcut