XSchema Problem with xs:any

T

Tjerk Wolterink

I've a element definition like this:

--
<xs:element name="content">
<xs:complexType>
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:any namespace="http://www.w3.org/1999/xhtml"/>
<xs:element ref="message"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
--

But when i validate the following xml:

--
<content>
<p xmlns="http://www.w3.org/1999/xhtml">
Welkom bij <b>Wolterink</b> Webdesign<br/>
</p>
</content>
--


I get the following error:

--
[Xerces-J 2.7.1] Validating "index.xml" against
"file:/D:/development/webapps/XCManager/web/WEB-INF/schemas/page.xsd" ...
Ln 8 Col 43 - cvc-complex-type.2.4.c: The matching wildcard is strict,
but no declaration can be found for element 'p'.
1 Errors
--

Ln 8 Col 43 is the following line:
<p xmlns="http://www.w3.org/1999/xhtml">

How can this be??
p is a element in the xhtml namespace so it is
valid for:
<xs:any namespace="http://www.w3.org/1999/xhtml"/>

What am i doing wrong?
 
H

Henry S. Thompson

Tjerk said:
<xs:any namespace="http://www.w3.org/1999/xhtml"/>

But when i validate the following xml:

--
<content>
<p xmlns="http://www.w3.org/1999/xhtml">
Welkom bij <b>Wolterink</b> Webdesign<br/>
</p>
</content>
--


I get the following error:

--
[Xerces-J 2.7.1] Validating "index.xml" against
"file:/D:/development/webapps/XCManager/web/WEB-INF/schemas/page.xsd"
...
Ln 8 Col 43 - cvc-complex-type.2.4.c: The matching wildcard is strict,
but no declaration can be found for element 'p'.
1 Errors

The error message tells you what you need to know --- "The matching
wildcard is strict".

If you don't want strict processing, you have to say

<xs:any namespace="http://www.w3.org/1999/xhtml"
processContents="lax"/>

ht
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: (e-mail address removed)
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
 
T

Tjerk Wolterink

Henry said:
Tjerk Wolterink writes:

<xs:any namespace="http://www.w3.org/1999/xhtml"/>

But when i validate the following xml:

--
<content>
<p xmlns="http://www.w3.org/1999/xhtml">
Welkom bij <b>Wolterink</b> Webdesign<br/>
</p>
</content>
--


I get the following error:

--
[Xerces-J 2.7.1] Validating "index.xml" against
"file:/D:/development/webapps/XCManager/web/WEB-INF/schemas/page.xsd"
...
Ln 8 Col 43 - cvc-complex-type.2.4.c: The matching wildcard is strict,
but no declaration can be found for element 'p'.
1 Errors


The error message tells you what you need to know --- "The matching
wildcard is strict".

If you don't want strict processing, you have to say

<xs:any namespace="http://www.w3.org/1999/xhtml"
processContents="lax"/>

ht


Hmm okay, i did not know what strict meant,
i will look into it further, anyway thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top