Hi Kurt,

Kurt Riede <[EMAIL PROTECTED]> wrote on 11/20/2006 06:15:32 PM:

> Hello xerces users,
> 
> the Schema API of xerces offers the element and attribute 
> declarations to the DOM nodes in an XML document:
> I might have a DOM element in form of a PSVIElementNSImpl instance 
> with the associated element declaration as an instance of type 
> XSElementDeclaration. Futhermore, the element declaration has a 
> complex type with several particles. So far that's fine, but is 
> there also an easy way with xerces to associate the child elements 
> to the particles of a complex content model?

Xerces transforms the content model into a DFA (see [1]) which it uses for 
validation. We don't store the XSParticles in this representation but it 
should give you some idea of the complexity and perhaps a starting point.

> schema fragment sample:
> <xs:element name="a">
>   <xs:complexType>
>     <xs:sequence>
>       <xs:element name="b" maxOccurs="unbound"/>
>       <xs:element name="c" maxOccurs="unbound"/>
>     </xs:sequence>
>   </xs:complexType>
> <xs:element>
> 
> instance sample:
> <a>
>   <b/><b/><b/>
>   <c/><c/><c/><c/>
> </a>
> 
> result sample structure:
> 
> element a
>   particle[0]
>     <xs:sequence>
>       particle[0]
>         <xs:element name="b"/>
>         { b, b, b }
>       particle[1]
>         <xs:element name="c"/>
>         { c, c, c, c }
>     { }
> 
> Simmilar of course for possibly nested sequence, choice or all 
> particles. So the resulting data model is a combination of the 
> particles hierarchy of a complex type and the nodes of a concret 
> instance. I'm thinking e.g. of a traverser that traverses the 
> particles hierarchy and emits events as a pair of a particle and a 
> list of all corresponsing child elements.
> 
> Any hints are welcome.
> 
> Regards,
> Kurt
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

[1] 
http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/models/XSDFACM.java

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [EMAIL PROTECTED]
E-mail: [EMAIL PROTECTED]

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

Reply via email to