You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Drake J <ba...@hotmail.com> on 2004/06/06 18:26:26 UTC

What is the sequence of elements in a schema that validate a particular tag?

I have been working on an issue involving xml schema for a while now that 
seems like it should have a simple solution but at this point I have not 
been able to find one.

I have xml defined as follows

<start>
	<myelement>test</myelement>
</start>

I validate it against the following schema.

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<xsd:group name='mygroup1'>
  <xsd:sequence>
    <xsd:element name='myelement' type='xsd:string'/>
  </xsd:sequence>
</xsd:group>

<xsd:complexType name='mycomplextype'>
  <xsd:choice>
   <xsd:group ref='mygroup1'/>
   <xsd:element name='myelement' type='xsd:string'/>
  </xsd:choice>
</xsd:complexType>

<xsd:element name='start' type='mycomplextype'/>

</xsd:schema>

The issue I am having is that I need to know what elements in the xml schema 
were used to validate the "myelement" tag.  Within the mycomplextype the 
group reference may of been used or the element definition may of been used. 
  Is there anyway which I can figure out what the path was that was done for 
validation?

For example was it element/complexType/choice/group/sequence/element or was 
it element/complexType/choice/element

I looked into using PSVI to determine what it was, but it does not appear to 
contain the functionality I need.

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar – get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: What is the sequence of elements in a schema that validate a particular tag?

Posted by Neil Delima <nd...@ca.ibm.com>.




"Drake J" <ba...@hotmail.com> wrote on 06/06/2004 12:26:26 PM:

> ...
>
> I have xml defined as follows
>
> <start>
>    <myelement>test</myelement>
> </start>
>
> I validate it against the following schema.
>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>
> <xsd:group name='mygroup1'>
>   <xsd:sequence>
>     <xsd:element name='myelement' type='xsd:string'/>
>   </xsd:sequence>
> </xsd:group>
>
> <xsd:complexType name='mycomplextype'>
>   <xsd:choice>
>    <xsd:group ref='mygroup1'/>
>    <xsd:element name='myelement' type='xsd:string'/>
>   </xsd:choice>
> </xsd:complexType>
>
> <xsd:element name='start' type='mycomplextype'/>
>
> </xsd:schema>
>
> The issue I am having is that I need to know what elements in the xml
schema
> were used to validate the "myelement" tag.  Within the mycomplextype the
> group reference may of been used or the element definition may of been
used.
>   Is there anyway which I can figure out what the path was that was done
for
> validation?
>
>  ...

The schema is invalid since it violates the Unique Particle Attribution
rule (http://www.w3.org/TR/xmlschema-1/#non-ambig).



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org