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 Eric Lilja <mi...@gmail.com> on 2008/12/02 14:12:54 UTC
Detecting xsd:any
Hello, I'm parsing schemas (by getting an XSModel and then getting the
top element and going from there) and what the program basically does is
creating a relational model of the schema. Complex element become tables
and their children that are attributes or simple elements that can occur
at most 1 time become columns in the tables. Now I need to handle
xsd:any. Consider the following schema:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
targetNamespace="myns" xmlns="myns">
<xsd:element name="persons">
<xsd:complexType>
<xsd:sequence maxOccurs="unbounded">
<xsd:element name="person" type="personType"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="personType">
<xsd:sequence>
<xsd:element name="name" type="xsd:string"/>
<xsd:any namespace="##any" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
What I want to happen here is that the complex element personType should
become a table in my relational model and it should get "name" as a
column (of type string) and the xsd:any should become a column of type
xml. However, during parsing I don't detect the xsd:any "construct". How
can I solve this?
- EL
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
Re: Detecting xsd:any
Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hi Eric,
The validator knows that it matched a wildcard. There's no spot in the PSVI
for reporting it, so I suppose in that sense it's lost.
Thanks.
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org
Eric Lilja <mi...@gmail.com> wrote on 12/08/2008 04:58:12 AM:
> Hello Mr Glavassevich and thanks for your reply. So basically what
> you're saying is that it is not possible, while parsing the schema, to
> be informated that (for example): "this complex element has these simple
> elements as child elements, it also has an xsd:any"? The information
> that there's an xsd:any is completely lost?
>
> - Eric
>
> Michael Glavassevich wrote:
> > Hi Eric,
> >
> > You're basically looking for which particle matched each element in the
> > instance. This information is not available in the PSVI and not readily
> > available from Xerces. Someone else asked a related question [1] a few
> > years back. Might not be too difficult to handle yourself if you know
> > that the sequences will always be simple.
> >
> > Thanks.
> >
> > [1] http://marc.info/?l=xerces-j-user&m=117066289132061&w=2
> > <http://marc.info/?l=xerces-j-user&m=117066289132061&w=2>
> >
> > Michael Glavassevich
> > XML Parser Development
> > IBM Toronto Lab
> > E-mail: mrglavas@ca.ibm.com
> > E-mail: mglavas@apache.org
> >
> > Eric Lilja <mi...@gmail.com> wrote on 12/02/2008 08:12:54 AM:
> >
> > > Hello, I'm parsing schemas (by getting an XSModel and then getting
the
> > > top element and going from there) and what the program basically
does is
> > > creating a relational model of the schema. Complex element become
tables
> > > and their children that are attributes or simple elements that can
occur
> > > at most 1 time become columns in the tables. Now I need to handle
> > > xsd:any. Consider the following schema:
> > >
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > > elementFormDefault="qualified"
> > > targetNamespace="myns" xmlns="myns">
> > > <xsd:element name="persons">
> > > <xsd:complexType>
> > > <xsd:sequence maxOccurs="unbounded">
> > > <xsd:element name="person" type="personType"/>
> > > </xsd:sequence>
> > > </xsd:complexType>
> > > </xsd:element>
> > > <xsd:complexType name="personType">
> > > <xsd:sequence>
> > > <xsd:element name="name" type="xsd:string"/>
> > > <xsd:any namespace="##any" minOccurs="0"/>
> > > </xsd:sequence>
> > > </xsd:complexType>
> > > </xsd:schema>
> > >
> > > What I want to happen here is that the complex element personType
should
> > > become a table in my relational model and it should get "name" as a
> > > column (of type string) and the xsd:any should become a column of
type
> > > xml. However, during parsing I don't detect the xsd:any "construct".
How
> > > can I solve this?
> > >
> > > - EL
> > >
> > >
---------------------------------------------------------------------
> > > To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> > > For additional commands, e-mail: j-users-help@xerces.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
Re: Detecting xsd:any
Posted by Eric Lilja <mi...@gmail.com>.
Hello Mr Glavassevich and thanks for your reply. So basically what
you're saying is that it is not possible, while parsing the schema, to
be informated that (for example): "this complex element has these simple
elements as child elements, it also has an xsd:any"? The information
that there's an xsd:any is completely lost?
- Eric
Michael Glavassevich wrote:
> Hi Eric,
>
> You're basically looking for which particle matched each element in the
> instance. This information is not available in the PSVI and not readily
> available from Xerces. Someone else asked a related question [1] a few
> years back. Might not be too difficult to handle yourself if you know
> that the sequences will always be simple.
>
> Thanks.
>
> [1] http://marc.info/?l=xerces-j-user&m=117066289132061&w=2
> <http://marc.info/?l=xerces-j-user&m=117066289132061&w=2>
>
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mglavas@apache.org
>
> Eric Lilja <mi...@gmail.com> wrote on 12/02/2008 08:12:54 AM:
>
> > Hello, I'm parsing schemas (by getting an XSModel and then getting the
> > top element and going from there) and what the program basically does is
> > creating a relational model of the schema. Complex element become tables
> > and their children that are attributes or simple elements that can occur
> > at most 1 time become columns in the tables. Now I need to handle
> > xsd:any. Consider the following schema:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > elementFormDefault="qualified"
> > targetNamespace="myns" xmlns="myns">
> > <xsd:element name="persons">
> > <xsd:complexType>
> > <xsd:sequence maxOccurs="unbounded">
> > <xsd:element name="person" type="personType"/>
> > </xsd:sequence>
> > </xsd:complexType>
> > </xsd:element>
> > <xsd:complexType name="personType">
> > <xsd:sequence>
> > <xsd:element name="name" type="xsd:string"/>
> > <xsd:any namespace="##any" minOccurs="0"/>
> > </xsd:sequence>
> > </xsd:complexType>
> > </xsd:schema>
> >
> > What I want to happen here is that the complex element personType should
> > become a table in my relational model and it should get "name" as a
> > column (of type string) and the xsd:any should become a column of type
> > xml. However, during parsing I don't detect the xsd:any "construct". How
> > can I solve this?
> >
> > - EL
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> > For additional commands, e-mail: j-users-help@xerces.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
Re: Detecting xsd:any
Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hi Eric,
You're basically looking for which particle matched each element in the
instance. This information is not available in the PSVI and not readily
available from Xerces. Someone else asked a related question [1] a few
years back. Might not be too difficult to handle yourself if you know that
the sequences will always be simple.
Thanks.
[1] http://marc.info/?l=xerces-j-user&m=117066289132061&w=2
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mglavas@apache.org
Eric Lilja <mi...@gmail.com> wrote on 12/02/2008 08:12:54 AM:
> Hello, I'm parsing schemas (by getting an XSModel and then getting the
> top element and going from there) and what the program basically does is
> creating a relational model of the schema. Complex element become tables
> and their children that are attributes or simple elements that can occur
> at most 1 time become columns in the tables. Now I need to handle
> xsd:any. Consider the following schema:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified"
> targetNamespace="myns" xmlns="myns">
> <xsd:element name="persons">
> <xsd:complexType>
> <xsd:sequence maxOccurs="unbounded">
> <xsd:element name="person" type="personType"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> <xsd:complexType name="personType">
> <xsd:sequence>
> <xsd:element name="name" type="xsd:string"/>
> <xsd:any namespace="##any" minOccurs="0"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:schema>
>
> What I want to happen here is that the complex element personType should
> become a table in my relational model and it should get "name" as a
> column (of type string) and the xsd:any should become a column of type
> xml. However, during parsing I don't detect the xsd:any "construct". How
> can I solve this?
>
> - EL
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org