Is global attribute in XSD supported? [message #25169] |
Tue, 22 July 2003 18:26  |
Eclipse User |
|
|
|
Originally posted by: user.domain.invalid
I am trying to generate an EMF model from an XML
schema which contains a global attribute using
the EMF Model Generation Wizard. It thinks the
schema is invalid.
When will global attribute be supported?
Here is a minimal XSD with a global attribute:
<?xml version="1.0"?>
<xs:schema targetNamespace="http://localhost/gattr"
xmlns:xs="http://www.w3.org/2001/XMLSchema" >
<xs:attribute name="global_attr" type="xs:NCName"/>
</xs:schema>
It couldn't be loaded.
Raymond Leung
|
|
|
|
Re: Is global attribute in XSD supported? [message #25415 is a reply to message #25210] |
Thu, 24 July 2003 12:28  |
Eclipse User |
|
|
|
Originally posted by: user.domain.invalid
We will be using the global attributes dynamically
with the <anyAttribute>.
For example, the SOAP Envelope model
http://www.w3.org/2002/12/soap-envelope/
defines the global attributes "mustUnderstand".
<xs:schema
targetNamespace="http://www.w3.org/2002/12/soap-envelope"
xmlns:tns="http://www.w3.org/2002/12/soap-envelope"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
...
<xs:attribute name="mustUnderstand"
type="xs:boolean"
default="false" />
...
</xs:schema
And in the WS-addressing model
http://schemas.xmlsoap.org/ws/2003/03/addressing
it defines the element "To" (of type "AttributedURI")
which can have any attribute from other namespace
through the <anyAttribute>:
<xs:schema
targetNamespace="http://schemas.xmlsoap.org/ws/2003/03/addressing"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2003/03/addressing"
xmlns:xs="http://www.w3.org/2001/XMLSchema" >
...
<xs:element name="To" type="wsa:AttributedURI"/>
...
<xs:complexType name="AttributedURI">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:schema>
So, I can have a document like this:
<env:Envelope xmlns:env="http://www.w3.org/2002/12/soap-envelope/"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2003/03/addressing">
...
<env:Header>
<wsa:To env:mustUnderStand="1">mailto:joe@fabrikam123.com</wsa:To>
</env:Header>
</env:Envelope>
When I generate the soap envelope EMF model,
the attribute "mustUnderstand" is not used in any
global element. And when I generate the EMF model
for the ws-addressing model, I don't know what
the attribute will be. Only at runtime the two
are tied together.
Can EMF/XSD support such scenario? Probably not in the current
release. What about future releases?
There seems to be usage like this in many standard
XML schemas. It would be good if EMF/XSD supports
it and we don't have to keep reinventing the design
with every models.
Raymond Leung
Dave Steinberg wrote:
> user@domain.invalid wrote:
>
>> I am trying to generate an EMF model from an XML
>> schema which contains a global attribute using
>> the EMF Model Generation Wizard. It thinks the
>> schema is invalid.
>>
>> When will global attribute be supported?
>
>
> Hi Raymond,
>
> Global attribute declarations are supported, but your minimal example is
> a little too minimal. :)
>
> Your schema is valid, but its set of valid instance documents is empty,
> since it doesn't include a global element declaration. The attribute
> isn't enough; it can only show up within an element that references it.
>
> Try this schema:
>
> <?xml version="1.0"?>
> <xs:schema targetNamespace="http://localhost/gattr"
> xmlns:Q1="http://localhost/gattr"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
> <xs:element name="gloabl_el">
> <xs:complexType>
> <xs:attribute ref="Q1:global_attr"/>
> </xs:complexType>
> </xs:element>
> <xs:attribute name="global_attr" type="xs:NCName"/>
> </xs:schema>
>
> EMF will create a perfectly reasonable core model for it:
>
> <?xml version="1.0" encoding="ASCII"?>
> <ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI""
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="gattr"
> nsURI="http://localhost/gattr" nsPrefix="localhost.gattr">
> <eAnnotations ... />
> <eClassifiers xsi:type="ecore:EClass" name="GloablEl">
> <eAnnotations ... />
> <eAttributes name="globalAttr" eType="ecore:EDataType
> http://www.eclipse.org/emf/2002/Ecore#//EString">
> <eAnnotations ... />
> </eAttributes>
> </eClassifiers>
> </ecore:EPackage>
>
> Hope that helps.
>
> Cheers,
> Dave
>
|
|
|
Re: Is global attribute in XSD supported? [message #25455 is a reply to message #25415] |
Thu, 24 July 2003 01:28  |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
Raymond,
We will be working on better support for wildcards in the coming weeks and
months.
user@domain.invalid wrote:
> We will be using the global attributes dynamically
> with the <anyAttribute>.
>
> For example, the SOAP Envelope model
> http://www.w3.org/2002/12/soap-envelope/
> defines the global attributes "mustUnderstand".
>
> <xs:schema
> targetNamespace="http://www.w3.org/2002/12/soap-envelope"
> xmlns:tns="http://www.w3.org/2002/12/soap-envelope"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
>
> ...
> <xs:attribute name="mustUnderstand"
> type="xs:boolean"
> default="false" />
> ...
> </xs:schema
>
> And in the WS-addressing model
> http://schemas.xmlsoap.org/ws/2003/03/addressing
> it defines the element "To" (of type "AttributedURI")
> which can have any attribute from other namespace
> through the <anyAttribute>:
>
> <xs:schema
> targetNamespace="http://schemas.xmlsoap.org/ws/2003/03/addressing"
> xmlns:wsa="http://schemas.xmlsoap.org/ws/2003/03/addressing"
> xmlns:xs="http://www.w3.org/2001/XMLSchema" >
>
> ...
> <xs:element name="To" type="wsa:AttributedURI"/>
> ...
> <xs:complexType name="AttributedURI">
> <xs:simpleContent>
> <xs:extension base="xs:string">
> <xs:anyAttribute namespace="##other" processContents="lax"/>
> </xs:extension>
> </xs:simpleContent>
> </xs:complexType>
> </xs:schema>
>
> So, I can have a document like this:
> <env:Envelope xmlns:env="http://www.w3.org/2002/12/soap-envelope/"
> xmlns:wsa="http://schemas.xmlsoap.org/ws/2003/03/addressing">
> ...
> <env:Header>
> <wsa:To env:mustUnderStand="1">mailto:joe@fabrikam123.com</wsa:To>
> </env:Header>
> </env:Envelope>
>
> When I generate the soap envelope EMF model,
> the attribute "mustUnderstand" is not used in any
> global element. And when I generate the EMF model
> for the ws-addressing model, I don't know what
> the attribute will be. Only at runtime the two
> are tied together.
>
> Can EMF/XSD support such scenario? Probably not in the current
> release. What about future releases?
>
> There seems to be usage like this in many standard
> XML schemas. It would be good if EMF/XSD supports
> it and we don't have to keep reinventing the design
> with every models.
>
> Raymond Leung
>
> Dave Steinberg wrote:
>
> > user@domain.invalid wrote:
> >
> >> I am trying to generate an EMF model from an XML
> >> schema which contains a global attribute using
> >> the EMF Model Generation Wizard. It thinks the
> >> schema is invalid.
> >>
> >> When will global attribute be supported?
> >
> >
> > Hi Raymond,
> >
> > Global attribute declarations are supported, but your minimal example is
> > a little too minimal. :)
> >
> > Your schema is valid, but its set of valid instance documents is empty,
> > since it doesn't include a global element declaration. The attribute
> > isn't enough; it can only show up within an element that references it.
> >
> > Try this schema:
> >
> > <?xml version="1.0"?>
> > <xs:schema targetNamespace="http://localhost/gattr"
> > xmlns:Q1="http://localhost/gattr"
> > xmlns:xs="http://www.w3.org/2001/XMLSchema">
> > <xs:element name="gloabl_el">
> > <xs:complexType>
> > <xs:attribute ref="Q1:global_attr"/>
> > </xs:complexType>
> > </xs:element>
> > <xs:attribute name="global_attr" type="xs:NCName"/>
> > </xs:schema>
> >
> > EMF will create a perfectly reasonable core model for it:
> >
> > <?xml version="1.0" encoding="ASCII"?>
> > <ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI""
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="gattr"
> > nsURI="http://localhost/gattr" nsPrefix="localhost.gattr">
> > <eAnnotations ... />
> > <eClassifiers xsi:type="ecore:EClass" name="GloablEl">
> > <eAnnotations ... />
> > <eAttributes name="globalAttr" eType="ecore:EDataType
> > http://www.eclipse.org/emf/2002/Ecore#//EString">
> > <eAnnotations ... />
> > </eAttributes>
> > </eClassifiers>
> > </ecore:EPackage>
> >
> > Hope that helps.
> >
> > Cheers,
> > Dave
> >
|
|
|
Re: Is global attribute in XSD supported? [message #574646 is a reply to message #25169] |
Wed, 23 July 2003 16:10  |
Eclipse User |
|
|
|
user@domain.invalid wrote:
> I am trying to generate an EMF model from an XML
> schema which contains a global attribute using
> the EMF Model Generation Wizard. It thinks the
> schema is invalid.
>
> When will global attribute be supported?
Hi Raymond,
Global attribute declarations are supported, but your minimal example is a
little too minimal. :)
Your schema is valid, but its set of valid instance documents is empty,
since it doesn't include a global element declaration. The attribute isn't
enough; it can only show up within an element that references it.
Try this schema:
<?xml version="1.0"?>
<xs:schema targetNamespace="http://localhost/gattr"
xmlns:Q1="http://localhost/gattr"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="gloabl_el">
<xs:complexType>
<xs:attribute ref="Q1:global_attr"/>
</xs:complexType>
</xs:element>
<xs:attribute name="global_attr" type="xs:NCName"/>
</xs:schema>
EMF will create a perfectly reasonable core model for it:
<?xml version="1.0" encoding="ASCII"?>
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI""
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="gattr"
nsURI="http://localhost/gattr" nsPrefix="localhost.gattr">
<eAnnotations ... />
<eClassifiers xsi:type="ecore:EClass" name="GloablEl">
<eAnnotations ... />
<eAttributes name="globalAttr" eType="ecore:EDataType
http://www.eclipse.org/emf/2002/Ecore#//EString">
<eAnnotations ... />
</eAttributes>
</eClassifiers>
</ecore:EPackage>
Hope that helps.
Cheers,
Dave
|
|
|
Re: Is global attribute in XSD supported? [message #574929 is a reply to message #25210] |
Thu, 24 July 2003 12:28  |
Eclipse User |
|
|
|
We will be using the global attributes dynamically
with the <anyAttribute>.
For example, the SOAP Envelope model
http://www.w3.org/2002/12/soap-envelope/
defines the global attributes "mustUnderstand".
<xs:schema
targetNamespace="http://www.w3.org/2002/12/soap-envelope"
xmlns:tns="http://www.w3.org/2002/12/soap-envelope"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
...
<xs:attribute name="mustUnderstand"
type="xs:boolean"
default="false" />
...
</xs:schema
And in the WS-addressing model
http://schemas.xmlsoap.org/ws/2003/03/addressing
it defines the element "To" (of type "AttributedURI")
which can have any attribute from other namespace
through the <anyAttribute>:
<xs:schema
targetNamespace="http://schemas.xmlsoap.org/ws/2003/03/addressing"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2003/03/addressing"
xmlns:xs="http://www.w3.org/2001/XMLSchema" >
...
<xs:element name="To" type="wsa:AttributedURI"/>
...
<xs:complexType name="AttributedURI">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:schema>
So, I can have a document like this:
<env:Envelope xmlns:env="http://www.w3.org/2002/12/soap-envelope/"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2003/03/addressing">
...
<env:Header>
<wsa:To env:mustUnderStand="1">mailto:joe@fabrikam123.com</wsa:To>
</env:Header>
</env:Envelope>
When I generate the soap envelope EMF model,
the attribute "mustUnderstand" is not used in any
global element. And when I generate the EMF model
for the ws-addressing model, I don't know what
the attribute will be. Only at runtime the two
are tied together.
Can EMF/XSD support such scenario? Probably not in the current
release. What about future releases?
There seems to be usage like this in many standard
XML schemas. It would be good if EMF/XSD supports
it and we don't have to keep reinventing the design
with every models.
Raymond Leung
Dave Steinberg wrote:
> user@domain.invalid wrote:
>
>> I am trying to generate an EMF model from an XML
>> schema which contains a global attribute using
>> the EMF Model Generation Wizard. It thinks the
>> schema is invalid.
>>
>> When will global attribute be supported?
>
>
> Hi Raymond,
>
> Global attribute declarations are supported, but your minimal example is
> a little too minimal. :)
>
> Your schema is valid, but its set of valid instance documents is empty,
> since it doesn't include a global element declaration. The attribute
> isn't enough; it can only show up within an element that references it.
>
> Try this schema:
>
> <?xml version="1.0"?>
> <xs:schema targetNamespace="http://localhost/gattr"
> xmlns:Q1="http://localhost/gattr"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
> <xs:element name="gloabl_el">
> <xs:complexType>
> <xs:attribute ref="Q1:global_attr"/>
> </xs:complexType>
> </xs:element>
> <xs:attribute name="global_attr" type="xs:NCName"/>
> </xs:schema>
>
> EMF will create a perfectly reasonable core model for it:
>
> <?xml version="1.0" encoding="ASCII"?>
> <ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI""
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="gattr"
> nsURI="http://localhost/gattr" nsPrefix="localhost.gattr">
> <eAnnotations ... />
> <eClassifiers xsi:type="ecore:EClass" name="GloablEl">
> <eAnnotations ... />
> <eAttributes name="globalAttr" eType="ecore:EDataType
> http://www.eclipse.org/emf/2002/Ecore#//EString">
> <eAnnotations ... />
> </eAttributes>
> </eClassifiers>
> </ecore:EPackage>
>
> Hope that helps.
>
> Cheers,
> Dave
>
|
|
|
Re: Is global attribute in XSD supported? [message #574954 is a reply to message #25415] |
Thu, 24 July 2003 01:28  |
Eclipse User |
|
|
|
Raymond,
We will be working on better support for wildcards in the coming weeks and
months.
user@domain.invalid wrote:
> We will be using the global attributes dynamically
> with the <anyAttribute>.
>
> For example, the SOAP Envelope model
> http://www.w3.org/2002/12/soap-envelope/
> defines the global attributes "mustUnderstand".
>
> <xs:schema
> targetNamespace="http://www.w3.org/2002/12/soap-envelope"
> xmlns:tns="http://www.w3.org/2002/12/soap-envelope"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
>
> ...
> <xs:attribute name="mustUnderstand"
> type="xs:boolean"
> default="false" />
> ...
> </xs:schema
>
> And in the WS-addressing model
> http://schemas.xmlsoap.org/ws/2003/03/addressing
> it defines the element "To" (of type "AttributedURI")
> which can have any attribute from other namespace
> through the <anyAttribute>:
>
> <xs:schema
> targetNamespace="http://schemas.xmlsoap.org/ws/2003/03/addressing"
> xmlns:wsa="http://schemas.xmlsoap.org/ws/2003/03/addressing"
> xmlns:xs="http://www.w3.org/2001/XMLSchema" >
>
> ...
> <xs:element name="To" type="wsa:AttributedURI"/>
> ...
> <xs:complexType name="AttributedURI">
> <xs:simpleContent>
> <xs:extension base="xs:string">
> <xs:anyAttribute namespace="##other" processContents="lax"/>
> </xs:extension>
> </xs:simpleContent>
> </xs:complexType>
> </xs:schema>
>
> So, I can have a document like this:
> <env:Envelope xmlns:env="http://www.w3.org/2002/12/soap-envelope/"
> xmlns:wsa="http://schemas.xmlsoap.org/ws/2003/03/addressing">
> ...
> <env:Header>
> <wsa:To env:mustUnderStand="1">mailto:joe@fabrikam123.com</wsa:To>
> </env:Header>
> </env:Envelope>
>
> When I generate the soap envelope EMF model,
> the attribute "mustUnderstand" is not used in any
> global element. And when I generate the EMF model
> for the ws-addressing model, I don't know what
> the attribute will be. Only at runtime the two
> are tied together.
>
> Can EMF/XSD support such scenario? Probably not in the current
> release. What about future releases?
>
> There seems to be usage like this in many standard
> XML schemas. It would be good if EMF/XSD supports
> it and we don't have to keep reinventing the design
> with every models.
>
> Raymond Leung
>
> Dave Steinberg wrote:
>
> > user@domain.invalid wrote:
> >
> >> I am trying to generate an EMF model from an XML
> >> schema which contains a global attribute using
> >> the EMF Model Generation Wizard. It thinks the
> >> schema is invalid.
> >>
> >> When will global attribute be supported?
> >
> >
> > Hi Raymond,
> >
> > Global attribute declarations are supported, but your minimal example is
> > a little too minimal. :)
> >
> > Your schema is valid, but its set of valid instance documents is empty,
> > since it doesn't include a global element declaration. The attribute
> > isn't enough; it can only show up within an element that references it.
> >
> > Try this schema:
> >
> > <?xml version="1.0"?>
> > <xs:schema targetNamespace="http://localhost/gattr"
> > xmlns:Q1="http://localhost/gattr"
> > xmlns:xs="http://www.w3.org/2001/XMLSchema">
> > <xs:element name="gloabl_el">
> > <xs:complexType>
> > <xs:attribute ref="Q1:global_attr"/>
> > </xs:complexType>
> > </xs:element>
> > <xs:attribute name="global_attr" type="xs:NCName"/>
> > </xs:schema>
> >
> > EMF will create a perfectly reasonable core model for it:
> >
> > <?xml version="1.0" encoding="ASCII"?>
> > <ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI""
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="gattr"
> > nsURI="http://localhost/gattr" nsPrefix="localhost.gattr">
> > <eAnnotations ... />
> > <eClassifiers xsi:type="ecore:EClass" name="GloablEl">
> > <eAnnotations ... />
> > <eAttributes name="globalAttr" eType="ecore:EDataType
> > http://www.eclipse.org/emf/2002/Ecore#//EString">
> > <eAnnotations ... />
> > </eAttributes>
> > </eClassifiers>
> > </ecore:EPackage>
> >
> > Hope that helps.
> >
> > Cheers,
> > Dave
> >
|
|
|
Powered by
FUDForum. Page generated in 0.05466 seconds