If you want an error, why did you put "lax" there? If you use strict, which
seems to be what you want from your description, then you will get an
error.

Or if what you really want is if the instance has an element that's from
your schema's namespace, then there has to be an element declaration, and
skip/lax if it's from some other namespace. Then you can change:

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

to

      <choice>
        <any namespace="##targetNamespace" processContents="strict"/>
        <any namespace="##local" processContents="lax/skip"/>
        <any namespace="##other" processContents="lax/skip"/>
      </sequence>

Cheers,
Sandy Gao
Software Developer, IBM Canada
(1-905) 413-3255
[EMAIL PROTECTED]


Lucian Holland <[EMAIL PROTECTED]> wrote on 07/21/2004 05:00:54 AM:

> Hi,
>
> If I validate this:
>
> <test:Root xmlns:test="http://www.example.com";>
>   <test:Wrong/>
> </test:Root>
>
> against this schema:
>
> <schema xmlns="http://www.w3.org/2001/XMLSchema";
>         targetNamespace="http://www.example.com";>
>   <element name="Root">
>     <complexType>
>       <sequence>
>         <any namespace="##any" processContents="lax"/>
>       </sequence>
>     </complexType>
>   </element>
> </schema>
>
> Xerces doesn't *report* any problems. This is, of course, legitimate,
> because xerces is falling back on validation against the urType as
allowed
> by the schema spec for lax validation. Examination of the PSVI reveals
> that "Root" has only been partially validated, and that "Wrong" has
> validity "notKnown".
>
> In the real world outside of schema spec logical formality, however,
> there's clearly a problem here: we've got the schema for the "Wrong"'s
> namespace, and we know that there is no "Wrong" element (at least as the
> contents of that namespace are defined for the purposes of the current
> validation episode). As a client of Xerces, the only way I can see to
> report this is an error to the user is to examine all of the PSVI after
> parsing until I find the node that caused the problem; recreating a
useful
> error message then becomes a real headache as well :( Is there any chance

> that Xerces could report a warning when it can't find an element
> declaration but does have a grammar for the relevant namespace? I am at a

> loss to think of any real world use case where this behaviour would
> actually be harmful, and in many cases I think it would be quite
useful...
>
> Lucian
>
> --
> Lucian Holland, Technical Architect    +44-1865-203192
> DecisionSoft Limited                   http://www.decisionsoft.com
> XML Development and Services
>
> ---------------------------------------------------------------------
> 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