You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Dan Hwang <sa...@gmail.com> on 2008/03/19 22:12:26 UTC
What's wrong with the following XML??
Hello,
I've beening using inst2xsd script to generate xsd from xml.
I added <relationships> block to add some new features.
After regenerating the xsd, I noticed that <subComponents> has been changed.
------------before------------
...
<xs:element name="subComponents">
<xs:complexType>
<xs:sequence>
<xs:element name="subComponent" maxOccurs="unbounded"
minOccurs="0">
...
------------after------------
...
<xs:element name="subComponents">
<xs:complexType>
<xs:choice maxOccurs="unbounded" minOccurs="0">
<xs:element name="subComponent">
...
I'm running the following to generate xsd.
./xmlbeans-2.0.0/bin/inst2xsd -design rd -enumerations never
-simple-content-types string rail.xml
------------rail.xml------------------
<?xml version="1.0" encoding="UTF-8"?>
<rail>
<keyword>
<first/>
<second/>
<third/>
</keyword>
<relationships>
<displayType/>
<relationship>
<type/>
<content/>
</relationship>
</relationships>
<component>
<sequence/>
<name/>
<header>
<graphic>
<image/>
<altText/>
<URL/>
</graphic>
<html>
<text/>
<URL/>
</html>
</header>
<subComponents>
<subComponent/>
<subComponent>
<sequence/>
</subComponent>
</subComponents>
</component>
</rail>
--------------------------
Thanks for your help~
-Dan
PS: I noticed that putting the <relationships> block underneath the
<component> seems to leave the <subComponents> unchanged...
However, there's gotta be something wrong with the way I'm using it.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org
Re: What's wrong with the following XML??
Posted by Dan Hwang <sa...@gmail.com>.
Hi,
Thanks for the answer.
However, making both <subComponent>s include <sequence/> didn't work.
I guess my main questions is "how does <relationships> affect <subComponent>?"
It was working fine before the <relationships> was introduced.
Thanks again,
Dan
On Wed, Mar 19, 2008 at 6:37 PM, Jacob Danner <ja...@gmail.com> wrote:
> I can see why inst2xsd tool is doing that.
>
>
> <subComponents>
> <subComponent/>
> <subComponent>
> <sequence/>
> </subComponent>
> </subComponents>
>
> The tools sees:
> <subcomponent />
>
> and <subComponent><sequence /> ...
> As 2 different types, if you want to correct that, you can try making
> them both subComponent Elements as
> <subComponent>
> <sequence/>
> ...
>
> HTH,
> -jacobd
>
>
>
> On Wed, Mar 19, 2008 at 2:12 PM, Dan Hwang <sa...@gmail.com> wrote:
> > Hello,
> >
> > I've beening using inst2xsd script to generate xsd from xml.
> > I added <relationships> block to add some new features.
> > After regenerating the xsd, I noticed that <subComponents> has been changed.
> >
> > ------------before------------
> > ...
> > <xs:element name="subComponents">
> > <xs:complexType>
> > <xs:sequence>
> > <xs:element name="subComponent" maxOccurs="unbounded"
> > minOccurs="0">
> > ...
> > ------------after------------
> > ...
> > <xs:element name="subComponents">
> > <xs:complexType>
> > <xs:choice maxOccurs="unbounded" minOccurs="0">
> > <xs:element name="subComponent">
> > ...
> >
> >
> >
> > I'm running the following to generate xsd.
> > ./xmlbeans-2.0.0/bin/inst2xsd -design rd -enumerations never
> > -simple-content-types string rail.xml
> >
> >
> > ------------rail.xml------------------
> > <?xml version="1.0" encoding="UTF-8"?>
> > <rail>
> > <keyword>
> > <first/>
> > <second/>
> > <third/>
> > </keyword>
> > <relationships>
> > <displayType/>
> > <relationship>
> > <type/>
> > <content/>
> > </relationship>
> > </relationships>
> > <component>
> > <sequence/>
> > <name/>
> > <header>
> > <graphic>
> > <image/>
> > <altText/>
> > <URL/>
> > </graphic>
> > <html>
> > <text/>
> > <URL/>
> > </html>
> > </header>
> > <subComponents>
> > <subComponent/>
> > <subComponent>
> > <sequence/>
> > </subComponent>
> > </subComponents>
> > </component>
> > </rail>
> >
> > --------------------------
> >
> > Thanks for your help~
> > -Dan
> >
> > PS: I noticed that putting the <relationships> block underneath the
> > <component> seems to leave the <subComponents> unchanged...
> > However, there's gotta be something wrong with the way I'm using it.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> > For additional commands, e-mail: user-help@xmlbeans.apache.org
> >
> >
>
>
>
> --
> I'm competing in a Half-Ironman distance triathlon to raise money for
> the fight against cancer!
> Please help support my efforts by going to:
> http://www.active.com/donate/tntwaak/jacobd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org
Re: What's wrong with the following XML??
Posted by Jacob Danner <ja...@gmail.com>.
I can see why inst2xsd tool is doing that.
<subComponents>
<subComponent/>
<subComponent>
<sequence/>
</subComponent>
</subComponents>
The tools sees:
<subcomponent />
and <subComponent><sequence /> ...
As 2 different types, if you want to correct that, you can try making
them both subComponent Elements as
<subComponent>
<sequence/>
...
HTH,
-jacobd
On Wed, Mar 19, 2008 at 2:12 PM, Dan Hwang <sa...@gmail.com> wrote:
> Hello,
>
> I've beening using inst2xsd script to generate xsd from xml.
> I added <relationships> block to add some new features.
> After regenerating the xsd, I noticed that <subComponents> has been changed.
>
> ------------before------------
> ...
> <xs:element name="subComponents">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="subComponent" maxOccurs="unbounded"
> minOccurs="0">
> ...
> ------------after------------
> ...
> <xs:element name="subComponents">
> <xs:complexType>
> <xs:choice maxOccurs="unbounded" minOccurs="0">
> <xs:element name="subComponent">
> ...
>
>
>
> I'm running the following to generate xsd.
> ./xmlbeans-2.0.0/bin/inst2xsd -design rd -enumerations never
> -simple-content-types string rail.xml
>
>
> ------------rail.xml------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <rail>
> <keyword>
> <first/>
> <second/>
> <third/>
> </keyword>
> <relationships>
> <displayType/>
> <relationship>
> <type/>
> <content/>
> </relationship>
> </relationships>
> <component>
> <sequence/>
> <name/>
> <header>
> <graphic>
> <image/>
> <altText/>
> <URL/>
> </graphic>
> <html>
> <text/>
> <URL/>
> </html>
> </header>
> <subComponents>
> <subComponent/>
> <subComponent>
> <sequence/>
> </subComponent>
> </subComponents>
> </component>
> </rail>
>
> --------------------------
>
> Thanks for your help~
> -Dan
>
> PS: I noticed that putting the <relationships> block underneath the
> <component> seems to leave the <subComponents> unchanged...
> However, there's gotta be something wrong with the way I'm using it.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
>
--
I'm competing in a Half-Ironman distance triathlon to raise money for
the fight against cancer!
Please help support my efforts by going to:
http://www.active.com/donate/tntwaak/jacobd
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org