Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Schema Design for common global element

Reply
Thread Tools

Schema Design for common global element

 
 
Gordon Dickens
Guest
Posts: n/a
 
      08-04-2004
I have target xml to generate from schema. All of the XML instances
have the same global element i.e. <base>. I would like to combine all
of the schemas into a single schema where I could generate any of the
specific instances.

sample schema one:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlnss="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="base">
<xs:complexType>
<xs:attribute name="myNodeABC" type="xs:string"/>
<xs:attribute name="myNodeDEF" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:schema>

sample schema two:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlnss="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="base">
<xs:complexType>
<xs:attribute name="myNodeABC" type="xs:string"/>
<xs:attribute name="myNodeXYZ" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:schema>

Can anyone suggest how to join these two into a single schema where
the instance document does not have namespace prefixed
elements/attributes?

I tried attributeGroups, groups, import and include elements, without
any luck.

Any help is appreciated.

Thanks,
Gordon
 
Reply With Quote
 
 
 
 
Ingrid
Guest
Posts: n/a
 
      08-05-2004
Hi Gordon

Had a similar problem and it took me ages to sort something out (just
writing a dissertation about DTD vs Schema use..)

This is what worked for me, but I am not an expert so my solution
might not be how it should be done...

Sample Schema 1 (file: untitled8.xsd):

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlnss="http://www.w3.org/2001/XMLSchema"
xmlns:in="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:import namespace="http://www.w3.org/2001/XMLSchema"
schemaLocation="untitled9.xsd"></xs:import>
<xs:element name="base">
<xs:complexType>
<xs:sequence>
<xs:element ref="in:base"></xs:element>
</xs:sequence>
<xs:attribute name="myNodeABC"></xs:attribute>
<xs:attribute name="myNodeDEF"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>
which is your main Schema, note the <xs:import> tag, which references
the location of your "to be imported" element (here in the same
directory so just referenced "untitled9.xsd"). Also note above the
<xs:import> - tag a new xmlns namespace abbreviation is introduced
ie... xmlns:in - this is because I have given your second Schema a new
namespace prefix (in)...:

Sample Schema 2: This is the "to be imported" schema (my doc called
untitled9.xsd - referenced in Schema 1 in the <xs:import> tag) with
the new namespace prefix in:

<?xml version="1.0" encoding="UTF-8"?>
<in:schema xmlns:in="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<in:element name="base">
<in:complexType>
<in:attribute name="myNodeABC" type="in:string"/>
<in:attribute name="myNodeXYZ" type="in:string"/>
</in:complexType>
</in:element>
</in:schema>

The resulting XML instance document:

<?xml version="1.0" encoding="UTF-8"?>
<base xmlnssi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="file:untitled8.xsd"
myNodeABC="" myNodeDEF="">
<base xmlns="http://www.w3.org/2001/XMLSchema"
myNodeABC="" myNodeXYZ="">Content of base element of Schema 2
nested in the base element of Schema 1 </base>
</base>

By the way, I used the oXygen XML editor for this, for some reason
Altova's XML Spy does not like my new namespace prefix... but oXygen
validates it all..

Again, this might be complete gibberish but I hope it helps..

Cheers
Ingrid

PS let me know what you think of it anyway, might be helpful for my
dissertation to know if I am thinking on the right lines..And if you
find an easier way to do it, could you please post it??

http://www.velocityreviews.com/forums/(E-Mail Removed) (Gordon Dickens) wrote in message news:<(E-Mail Removed) om>...
> I have target xml to generate from schema. All of the XML instances
> have the same global element i.e. <base>. I would like to combine all
> of the schemas into a single schema where I could generate any of the
> specific instances.
>
> sample schema one:
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlnss="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified">
> <xs:element name="base">
> <xs:complexType>
> <xs:attribute name="myNodeABC" type="xs:string"/>
> <xs:attribute name="myNodeDEF" type="xs:string"/>
> </xs:complexType>
> </xs:element>
> </xs:schema>
>
> sample schema two:
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlnss="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified">
> <xs:element name="base">
> <xs:complexType>
> <xs:attribute name="myNodeABC" type="xs:string"/>
> <xs:attribute name="myNodeXYZ" type="xs:string"/>
> </xs:complexType>
> </xs:element>
> </xs:schema>
>
> Can anyone suggest how to join these two into a single schema where
> the instance document does not have namespace prefixed
> elements/attributes?
>
> I tried attributeGroups, groups, import and include elements, without
> any luck.
>
> Any help is appreciated.
>
> Thanks,
> Gordon

 
Reply With Quote
 
 
 
 
Ingrid
Guest
Posts: n/a
 
      08-07-2004
Re my answer below...

Even better than that: SCHEMA 1 (Untitled8.xsd):

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlnss="http://www.w3.org/2001/XMLSchema"
xmlns:in="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" targetNamespace="http://Untitled8">
<xs:import namespace="http://Untitled9/in"
schemaLocation="untitled9.xsd"></xs:import>
<xs:element name="base">
<xs:complexType>
<xs:sequence>
<in:element name="base">
<in:complexType>
<in:attribute name="myNodeABC" type="in:string"/>
<in:attribute name="myNodeXYZ" type="in:string"/>
</in:complexType></in:element>
</xs:sequence>
<xs:attribute name="myNodeABC"></xs:attribute>
<xs:attribute name="myNodeDEF"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>


SCHEMA 2 (Untitled9.xsd):

<?xml version="1.0" encoding="UTF-8"?>
<in:schema xmlns:in="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://Untitled9/in"
elementFormDefault="qualified">
<in:element name="base">
<in:complexType>
<in:attribute name="myNodeABC" type="in:string"/>
<in:attribute name="myNodeXYZ" type="in:string"/>
</in:complexType>
</in:element>
</in:schema>

Resulting XML doc:

<?xml version="1.0" encoding="UTF-8"?>
<base xmlns="http://Untitled8"
xmlnssi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://Untitled8
file:/C:/Documents%20and%20Settings/Ingrid/Desktop/Untitled8.xsd"
myNodeABC="" myNodeDEF="">
<base myNodeABC="" myNodeXYZ="">SCHEMA 2 content </base>
</base>

Ingrid

So the solution below is probably not strictly speaking the correct
way...


(E-Mail Removed) (Ingrid) wrote in message news:<(E-Mail Removed) om>...
> Hi Gordon
>
> Had a similar problem and it took me ages to sort something out (just
> writing a dissertation about DTD vs Schema use..)
>
> This is what worked for me, but I am not an expert so my solution
> might not be how it should be done...
>
> Sample Schema 1 (file: untitled8.xsd):
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlnss="http://www.w3.org/2001/XMLSchema"
> xmlns:in="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified">
> <xs:import namespace="http://www.w3.org/2001/XMLSchema"
> schemaLocation="untitled9.xsd"></xs:import>
> <xs:element name="base">
> <xs:complexType>
> <xs:sequence>
> <xs:element ref="in:base"></xs:element>
> </xs:sequence>
> <xs:attribute name="myNodeABC"></xs:attribute>
> <xs:attribute name="myNodeDEF"></xs:attribute>
> </xs:complexType>
> </xs:element>
> </xs:schema>
> which is your main Schema, note the <xs:import> tag, which references
> the location of your "to be imported" element (here in the same
> directory so just referenced "untitled9.xsd"). Also note above the
> <xs:import> - tag a new xmlns namespace abbreviation is introduced
> ie... xmlns:in - this is because I have given your second Schema a new
> namespace prefix (in)...:
>
> Sample Schema 2: This is the "to be imported" schema (my doc called
> untitled9.xsd - referenced in Schema 1 in the <xs:import> tag) with
> the new namespace prefix in:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <in:schema xmlns:in="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified">
> <in:element name="base">
> <in:complexType>
> <in:attribute name="myNodeABC" type="in:string"/>
> <in:attribute name="myNodeXYZ" type="in:string"/>
> </in:complexType>
> </in:element>
> </in:schema>
>
> The resulting XML instance document:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <base xmlnssi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="file:untitled8.xsd"
> myNodeABC="" myNodeDEF="">
> <base xmlns="http://www.w3.org/2001/XMLSchema"
> myNodeABC="" myNodeXYZ="">Content of base element of Schema 2
> nested in the base element of Schema 1 </base>
> </base>
>
> By the way, I used the oXygen XML editor for this, for some reason
> Altova's XML Spy does not like my new namespace prefix... but oXygen
> validates it all..
>
> Again, this might be complete gibberish but I hope it helps..
>
> Cheers
> Ingrid
>
> PS let me know what you think of it anyway, might be helpful for my
> dissertation to know if I am thinking on the right lines..And if you
> find an easier way to do it, could you please post it??
>
> (E-Mail Removed) (Gordon Dickens) wrote in message news:<(E-Mail Removed) om>...
> > I have target xml to generate from schema. All of the XML instances
> > have the same global element i.e. <base>. I would like to combine all
> > of the schemas into a single schema where I could generate any of the
> > specific instances.
> >
> > sample schema one:
> > <?xml version="1.0" encoding="UTF-8"?>
> > <xs:schema xmlnss="http://www.w3.org/2001/XMLSchema"
> > elementFormDefault="qualified">
> > <xs:element name="base">
> > <xs:complexType>
> > <xs:attribute name="myNodeABC" type="xs:string"/>
> > <xs:attribute name="myNodeDEF" type="xs:string"/>
> > </xs:complexType>
> > </xs:element>
> > </xs:schema>
> >
> > sample schema two:
> > <?xml version="1.0" encoding="UTF-8"?>
> > <xs:schema xmlnss="http://www.w3.org/2001/XMLSchema"
> > elementFormDefault="qualified">
> > <xs:element name="base">
> > <xs:complexType>
> > <xs:attribute name="myNodeABC" type="xs:string"/>
> > <xs:attribute name="myNodeXYZ" type="xs:string"/>
> > </xs:complexType>
> > </xs:element>
> > </xs:schema>
> >
> > Can anyone suggest how to join these two into a single schema where
> > the instance document does not have namespace prefixed
> > elements/attributes?
> >
> > I tried attributeGroups, groups, import and include elements, without
> > any luck.
> >
> > Any help is appreciated.
> >
> > Thanks,
> > Gordon

 
Reply With Quote
 
Ingrid
Guest
Posts: n/a
 
      08-07-2004
************************************************** ***********
(E-Mail Removed) (Ingrid) wrote in message news:<(E-Mail Removed) om>...
> Re my answer below...
>
> Even better than that: SCHEMA 1 (Untitled8.xsd):
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlnss="http://www.w3.org/2001/XMLSchema"
> xmlns:in="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified" targetNamespace="http://Untitled8">
> <-- <xs:import namespace="http://Untitled9/in"
> schemaLocation="untitled9.xsd"></xs:import>-->
> <xs:element name="base">
> <xs:complexType>
> <xs:sequence>
> <in:element name="base">
> <in:complexType>
> <in:attribute name="myNodeABC" type="in:string"/>
> <in:attribute name="myNodeXYZ" type="in:string"/>
> </in:complexType></in:element>
> </xs:sequence>
> <xs:attribute name="myNodeABC"></xs:attribute>
> <xs:attribute name="myNodeDEF"></xs:attribute>
> </xs:complexType>
> </xs:element>
> </xs:schema>
>
>
> SCHEMA 2 (Untitled9.xsd):
>
> <?xml version="1.0" encoding="UTF-8"?>
> <in:schema xmlns:in="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://Untitled9/in"
> elementFormDefault="qualified">
> <in:element name="base">
> <in:complexType>
> <in:attribute name="myNodeABC" type="in:string"/>
> <in:attribute name="myNodeXYZ" type="in:string"/>
> </in:complexType>
> </in:element>
> </in:schema>
>
> Resulting XML doc:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <base xmlns="http://Untitled8"
> xmlnssi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://Untitled8
> file:/C:/Documents%20and%20Settings/Ingrid/Desktop/Untitled8.xsd"
> myNodeABC="" myNodeDEF="">
> <base myNodeABC="" myNodeXYZ="">SCHEMA 2 content </base>
> </base>
>
> Ingrid
>
> So the solution below is probably not strictly speaking the correct
> way...
>
>
> (E-Mail Removed) (Ingrid) wrote in message news:<(E-Mail Removed) om>...
> > Hi Gordon
> >
> > Had a similar problem and it took me ages to sort something out (just
> > writing a dissertation about DTD vs Schema use..)
> >
> > This is what worked for me, but I am not an expert so my solution
> > might not be how it should be done...
> >
> > Sample Schema 1 (file: untitled8.xsd):
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <xs:schema xmlnss="http://www.w3.org/2001/XMLSchema"
> > xmlns:in="http://www.w3.org/2001/XMLSchema"
> > elementFormDefault="qualified">
> > <xs:import namespace="http://www.w3.org/2001/XMLSchema"
> > schemaLocation="untitled9.xsd"></xs:import>
> > <xs:element name="base">
> > <xs:complexType>
> > <xs:sequence>
> > <xs:element ref="in:base"></xs:element>
> > </xs:sequence>
> > <xs:attribute name="myNodeABC"></xs:attribute>
> > <xs:attribute name="myNodeDEF"></xs:attribute>
> > </xs:complexType>
> > </xs:element>
> > </xs:schema>
> > which is your main Schema, note the <xs:import> tag, which references
> > the location of your "to be imported" element (here in the same
> > directory so just referenced "untitled9.xsd"). Also note above the
> > <xs:import> - tag a new xmlns namespace abbreviation is introduced
> > ie... xmlns:in - this is because I have given your second Schema a new
> > namespace prefix (in)...:
> >
> > Sample Schema 2: This is the "to be imported" schema (my doc called
> > untitled9.xsd - referenced in Schema 1 in the <xs:import> tag) with
> > the new namespace prefix in:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <in:schema xmlns:in="http://www.w3.org/2001/XMLSchema"
> > targetNamespace="http://www.w3.org/2001/XMLSchema"
> > elementFormDefault="qualified">
> > <in:element name="base">
> > <in:complexType>
> > <in:attribute name="myNodeABC" type="in:string"/>
> > <in:attribute name="myNodeXYZ" type="in:string"/>
> > </in:complexType>
> > </in:element>
> > </in:schema>
> >
> > The resulting XML instance document:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <base xmlnssi="http://www.w3.org/2001/XMLSchema-instance"
> > xsi:noNamespaceSchemaLocation="file:untitled8.xsd"
> > myNodeABC="" myNodeDEF="">
> > <base xmlns="http://www.w3.org/2001/XMLSchema"
> > myNodeABC="" myNodeXYZ="">Content of base element of Schema 2
> > nested in the base element of Schema 1 </base>
> > </base>
> >
> > By the way, I used the oXygen XML editor for this, for some reason
> > Altova's XML Spy does not like my new namespace prefix... but oXygen
> > validates it all..
> >
> > Again, this might be complete gibberish but I hope it helps..
> >
> > Cheers
> > Ingrid
> >
> > PS let me know what you think of it anyway, might be helpful for my
> > dissertation to know if I am thinking on the right lines..And if you
> > find an easier way to do it, could you please post it??
> >
> > (E-Mail Removed) (Gordon Dickens) wrote in message news:<(E-Mail Removed) om>...
> > > I have target xml to generate from schema. All of the XML instances
> > > have the same global element i.e. <base>. I would like to combine all
> > > of the schemas into a single schema where I could generate any of the
> > > specific instances.
> > >
> > > sample schema one:
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <xs:schema xmlnss="http://www.w3.org/2001/XMLSchema"
> > > elementFormDefault="qualified">
> > > <xs:element name="base">
> > > <xs:complexType>
> > > <xs:attribute name="myNodeABC" type="xs:string"/>
> > > <xs:attribute name="myNodeDEF" type="xs:string"/>
> > > </xs:complexType>
> > > </xs:element>
> > > </xs:schema>
> > >
> > > sample schema two:
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <xs:schema xmlnss="http://www.w3.org/2001/XMLSchema"
> > > elementFormDefault="qualified">
> > > <xs:element name="base">
> > > <xs:complexType>
> > > <xs:attribute name="myNodeABC" type="xs:string"/>
> > > <xs:attribute name="myNodeXYZ" type="xs:string"/>
> > > </xs:complexType>
> > > </xs:element>
> > > </xs:schema>
> > >
> > > Can anyone suggest how to join these two into a single schema where
> > > the instance document does not have namespace prefixed
> > > elements/attributes?
> > >
> > > I tried attributeGroups, groups, import and include elements, without
> > > any luck.
> > >
> > > Any help is appreciated.
> > >
> > > Thanks,
> > > Gordon

 
Reply With Quote
 
Gordon Dickens
Guest
Posts: n/a
 
      08-14-2004
Thank you everyone for your help. Here is what I needed to do (a lot
simpler than I thought)... just add "targetNamespace" to the
definition for each XML schema document with a unique value.

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://Untitled8/in"
xmlnss="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="base">
<xs:complexType>
<xs:attribute name="myNodeABC" type="xs:string"/>
<xs:attribute name="myNodeXYZ" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:schema>

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://Untitled9/in"
xmlnss="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="base">
<xs:complexType>
<xs:attribute name="myNodeABC" type="xs:string"/>
<xs:attribute name="myNodeXYZ" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:schema>

Thanks again.

Regards,
Gordon Dickens


------------------------------------------------------------------------
(E-Mail Removed) (Ingrid) wrote in message news:<(E-Mail Removed) om>...
> ************************************************** ***********
> (E-Mail Removed) (Ingrid) wrote in message news:<(E-Mail Removed) om>...
> > Re my answer below...
> >
> > Even better than that: SCHEMA 1 (Untitled8.xsd):
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <xs:schema xmlnss="http://www.w3.org/2001/XMLSchema"
> > xmlns:in="http://www.w3.org/2001/XMLSchema"
> > elementFormDefault="qualified" targetNamespace="http://Untitled8">
> > <-- <xs:import namespace="http://Untitled9/in"
> > schemaLocation="untitled9.xsd"></xs:import>-->
> > <xs:element name="base">
> > <xs:complexType>
> > <xs:sequence>
> > <in:element name="base">
> > <in:complexType>
> > <in:attribute name="myNodeABC" type="in:string"/>
> > <in:attribute name="myNodeXYZ" type="in:string"/>
> > </in:complexType></in:element>
> > </xs:sequence>
> > <xs:attribute name="myNodeABC"></xs:attribute>
> > <xs:attribute name="myNodeDEF"></xs:attribute>
> > </xs:complexType>
> > </xs:element>
> > </xs:schema>
> >
> >
> > SCHEMA 2 (Untitled9.xsd):
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <in:schema xmlns:in="http://www.w3.org/2001/XMLSchema"
> > targetNamespace="http://Untitled9/in"
> > elementFormDefault="qualified">
> > <in:element name="base">
> > <in:complexType>
> > <in:attribute name="myNodeABC" type="in:string"/>
> > <in:attribute name="myNodeXYZ" type="in:string"/>
> > </in:complexType>
> > </in:element>
> > </in:schema>
> >
> > Resulting XML doc:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <base xmlns="http://Untitled8"
> > xmlnssi="http://www.w3.org/2001/XMLSchema-instance"
> > xsi:schemaLocation="http://Untitled8
> > file:/C:/Documents%20and%20Settings/Ingrid/Desktop/Untitled8.xsd"
> > myNodeABC="" myNodeDEF="">
> > <base myNodeABC="" myNodeXYZ="">SCHEMA 2 content </base>
> > </base>
> >
> > Ingrid
> >
> > So the solution below is probably not strictly speaking the correct
> > way...
> >
> >
> > (E-Mail Removed) (Ingrid) wrote in message news:<(E-Mail Removed) om>...
> > > Hi Gordon
> > >
> > > Had a similar problem and it took me ages to sort something out (just
> > > writing a dissertation about DTD vs Schema use..)
> > >
> > > This is what worked for me, but I am not an expert so my solution
> > > might not be how it should be done...
> > >
> > > Sample Schema 1 (file: untitled8.xsd):
> > >
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <xs:schema xmlnss="http://www.w3.org/2001/XMLSchema"
> > > xmlns:in="http://www.w3.org/2001/XMLSchema"
> > > elementFormDefault="qualified">
> > > <xs:import namespace="http://www.w3.org/2001/XMLSchema"
> > > schemaLocation="untitled9.xsd"></xs:import>
> > > <xs:element name="base">
> > > <xs:complexType>
> > > <xs:sequence>
> > > <xs:element ref="in:base"></xs:element>
> > > </xs:sequence>
> > > <xs:attribute name="myNodeABC"></xs:attribute>
> > > <xs:attribute name="myNodeDEF"></xs:attribute>
> > > </xs:complexType>
> > > </xs:element>
> > > </xs:schema>
> > > which is your main Schema, note the <xs:import> tag, which references
> > > the location of your "to be imported" element (here in the same
> > > directory so just referenced "untitled9.xsd"). Also note above the
> > > <xs:import> - tag a new xmlns namespace abbreviation is introduced
> > > ie... xmlns:in - this is because I have given your second Schema a new
> > > namespace prefix (in)...:
> > >
> > > Sample Schema 2: This is the "to be imported" schema (my doc called
> > > untitled9.xsd - referenced in Schema 1 in the <xs:import> tag) with
> > > the new namespace prefix in:
> > >
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <in:schema xmlns:in="http://www.w3.org/2001/XMLSchema"
> > > targetNamespace="http://www.w3.org/2001/XMLSchema"
> > > elementFormDefault="qualified">
> > > <in:element name="base">
> > > <in:complexType>
> > > <in:attribute name="myNodeABC" type="in:string"/>
> > > <in:attribute name="myNodeXYZ" type="in:string"/>
> > > </in:complexType>
> > > </in:element>
> > > </in:schema>
> > >
> > > The resulting XML instance document:
> > >
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <base xmlnssi="http://www.w3.org/2001/XMLSchema-instance"
> > > xsi:noNamespaceSchemaLocation="file:untitled8.xsd"
> > > myNodeABC="" myNodeDEF="">
> > > <base xmlns="http://www.w3.org/2001/XMLSchema"
> > > myNodeABC="" myNodeXYZ="">Content of base element of Schema 2
> > > nested in the base element of Schema 1 </base>
> > > </base>
> > >
> > > By the way, I used the oXygen XML editor for this, for some reason
> > > Altova's XML Spy does not like my new namespace prefix... but oXygen
> > > validates it all..
> > >
> > > Again, this might be complete gibberish but I hope it helps..
> > >
> > > Cheers
> > > Ingrid
> > >
> > > PS let me know what you think of it anyway, might be helpful for my
> > > dissertation to know if I am thinking on the right lines..And if you
> > > find an easier way to do it, could you please post it??
> > >
> > > (E-Mail Removed) (Gordon Dickens) wrote in message news:<(E-Mail Removed) om>...
> > > > I have target xml to generate from schema. All of the XML instances
> > > > have the same global element i.e. <base>. I would like to combine all
> > > > of the schemas into a single schema where I could generate any of the
> > > > specific instances.
> > > >
> > > > sample schema one:
> > > > <?xml version="1.0" encoding="UTF-8"?>
> > > > <xs:schema xmlnss="http://www.w3.org/2001/XMLSchema"
> > > > elementFormDefault="qualified">
> > > > <xs:element name="base">
> > > > <xs:complexType>
> > > > <xs:attribute name="myNodeABC" type="xs:string"/>
> > > > <xs:attribute name="myNodeDEF" type="xs:string"/>
> > > > </xs:complexType>
> > > > </xs:element>
> > > > </xs:schema>
> > > >
> > > > sample schema two:
> > > > <?xml version="1.0" encoding="UTF-8"?>
> > > > <xs:schema xmlnss="http://www.w3.org/2001/XMLSchema"
> > > > elementFormDefault="qualified">
> > > > <xs:element name="base">
> > > > <xs:complexType>
> > > > <xs:attribute name="myNodeABC" type="xs:string"/>
> > > > <xs:attribute name="myNodeXYZ" type="xs:string"/>
> > > > </xs:complexType>
> > > > </xs:element>
> > > > </xs:schema>
> > > >
> > > > Can anyone suggest how to join these two into a single schema where
> > > > the instance document does not have namespace prefixed
> > > > elements/attributes?
> > > >
> > > > I tried attributeGroups, groups, import and include elements, without
> > > > any luck.
> > > >
> > > > Any help is appreciated.
> > > >
> > > > Thanks,
> > > > Gordon

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Including element from one schema namespace in another schema namespace mflll@wiu.edu XML 1 07-20-2006 06:48 AM
[XML Schema] Including a schema document with absent target namespace to a schema with specified target namespace Stanimir Stamenkov XML 3 04-25-2005 09:59 AM
per the active schema, the element <BR> must be included within a parent element MSNews ASP .Net 1 04-22-2004 04:45 PM
schema unordered element list with any element CJ XML 0 12-17-2003 07:48 PM
In Schema, how to say "If one element exist, another element must exist"? Y.S. XML 3 09-17-2003 02:51 PM



Advertisments