By default the attribute 'processContents' for <any> is 'strict' which means
there must be a top-level declaration for the item available:

    processContents = (lax | skip | strict) : strict

So if the element <test> is not declared anywhere, then the parser will
issue an error saying 'not found'.   If you don't want the parser to locate
the declaration, please set processContents to lax or skip.

Besides you need to set mixed='true' in order to allow character content
model in <AnyNamespaceTest>.

So to validate your sample xml, the schems should look like:

<element name="AnyNamespaceTest">
<complexType mixed='true'>
<sequence>
<any processContents='lax'/>
</sequence>
</complexType>
</element>
</schema>

Tinny

----- Original Message -----
From: "Lindsey McNerney" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, February 22, 2002 3:47 PM
Subject: using <any> for schema validation with xerces 1.6


> I'm trying to validate an XML instance document using
> the <any> element as specified in the W3C Schema
> Primer with v1.6 of the Xerces parser.  I defined an
> element with the <any> tag in the schema and then in
> the XML instance document gave the element child
> elements.  The parser complained that these child
> elements had not been declared.  I thought the <any>
> element allowed you to use other elements without
> having to explicitly defined them in the schemas.  Is
> this functionality supported by this version of the
> parser and the syntax I'm using incorrect.  I've
> included an excerpt from my schema and sample XML
> below:
>
> schema:
> <element name="AnyNamespaceTest">
> <complexType>
> <sequence>
> <any/>
> </sequence>
> </complexType>
> </element>
>
> XML:
> <AnyNamespaceTest>
> <test>data</test>asdasd
> </AnyNamespaceTest>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Sports - Coverage of the 2002 Olympic Games
> http://sports.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to