Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » EClass for prefix and namespace definition?
EClass for prefix and namespace definition? [message #72812] Sun, 05 August 2007 16:47 Go to next message
Eclipse UserFriend
Originally posted by: rb_account.yahoo.de

Hello,

I just started to work with the XML Schema Infoset.

My goal is to create a schema which rererences some namespaces:
************************************************************ ***
<schema targetNamespace=3D"http://www.eclipse.org/xsd/examples/createxsd=
"
xmlns=3D"http://www.w3.org/2001/XMLSchema"
xmlns:address=3D"http://www.eclipse.org/xsd/examples/address"/>


Using the API, I just need the following line (according to the develope=
r =

works article "XMLSchemaInfosetModel,Part1"):
************************************************************ ***
qNamePrefixToNamespaceMap.put("address","http://www.eclipse.org/xsd/exam=
ples/address");


However, I need to know the concrete Model element, which stores the =

information and is referenced by the XSDSchema-EClass, since I want use =
=

the xsd.ecore for model transformation with ATL.
I can't find an element that defines a prefix - any help?

Although this is not an ATL newsgroup, I post the following example whic=
h =

demonstrates, why I need to know the EReference-Feature in the XSDSchema=
=

ECLass and the EClass representing the prefixes and namespaces. I hope t=
he =

example clarifies my question:
************************************************************ ***
rule Schema2Schema {
from
inputSchema XSD!XSDSchema
to
schema : XSD!XSDSchema(
targetNamespace <- 'de.uba.wiai.seda.soad.fallstudie',
<REFERENCE-FEATURE> <- refNamespaces
),
refNamespaces : XSD!<MODELELEMENT> (
prefix <- '...',
namespace <- '....'
)
}



Best regards

Rainer Bernhard


-- =

Erstellt mit Operas revolution=E4rem E-Mail-Modul: http://www.opera.com/=
mail/
Re: EClass for prefix and namespace definition? [message #72829 is a reply to message #72812] Sun, 05 August 2007 18:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Rainer,

Unfortunately, I don't really understand the question you are asking.
Setting a prefix as you show below will produce the right xmlns
declaration in the XSDSchema's corresponding DOM element. For the
simple example below, there is only just the XSDSchema instance an
nothing else besides the underlying DOM Element where the xmlns prefix
declarations are concretely represented. You might want to have a look
at XSDPrototypicalSchema because it shows a small example of how to
construct pretty much everything. You might also be interested in
EcoreSchemaBuilder which takes an Ecore model and builds a corresponding
schema for it. Maybe you want to show a larger example of what you are
trying to produce



Rainer Bernhard wrote:
> Hello,
>
> I just started to work with the XML Schema Infoset.
>
> My goal is to create a schema which rererences some namespaces:
> ************************************************************ ***
> <schema targetNamespace="http://www.eclipse.org/xsd/examples/createxsd"
> xmlns="http://www.w3.org/2001/XMLSchema"
> xmlns:address="http://www.eclipse.org/xsd/examples/address"/>
>
>
> Using the API, I just need the following line (according to the
> developer works article "XMLSchemaInfosetModel,Part1"):
> ************************************************************ ***
> qNamePrefixToNamespaceMap.put("address","http://www.eclipse.org/xsd/examples/address");
>
>
>
> However, I need to know the concrete Model element, which stores the
> information and is referenced by the XSDSchema-EClass, since I want
> use the xsd.ecore for model transformation with ATL.
> I can't find an element that defines a prefix - any help?
>
> Although this is not an ATL newsgroup, I post the following example
> which demonstrates, why I need to know the EReference-Feature in the
> XSDSchema ECLass and the EClass representing the prefixes and
> namespaces. I hope the example clarifies my question:
> ************************************************************ ***
> rule Schema2Schema {
> from
> inputSchema XSD!XSDSchema
> to
> schema : XSD!XSDSchema(
> targetNamespace <- 'de.uba.wiai.seda.soad.fallstudie',
> <REFERENCE-FEATURE> <- refNamespaces
> ),
> refNamespaces : XSD!<MODELELEMENT> (
> prefix <- '...',
> namespace <- '....'
> )
> }
>
>
>
> Best regards
>
> Rainer Bernhard
>
>
Re: EClass for prefix and namespace definition? [message #72874 is a reply to message #72829] Tue, 07 August 2007 20:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rb_account.yahoo.de

Hello Ed,

another try to explain my problem ;-)

An example for the concrete syntax of a schema-element is:
<schema targetNamespace=3D"http://www.eclipse.org/xsd/examples/createxsd=
"
xmlns=3D"http://www.w3.org/2001/XMLSchema"
xmlns:address=3D"http://www.eclipse.org/xsd/examples/address"/>

The XSDSchema abstract syntax is specified in the xsd.ecore and has =

features like (see relevant part of the ecore above):
schemaLocation: <eStructuralFeatures xsi:type=3D"ecore:EAttribute"=
=

name=3D"schemaLocation" ordered=3D"false"
unique=3D"false" eType=3D"ecore:EDataType =

http://www.eclipse.org/emf/2002/Ecore#//EString"/>
targetNamespace: <eStructuralFeatures xsi:type=3D"ecore:EAttribute=
" =

name=3D"targetNamespace" ordered=3D"false"
unique=3D"false" eType=3D"ecore:EDataType =

http://www.eclipse.org/emf/2002/Ecore#//EString"/>

However, I don't see any attribute or reference in the abstract syntax o=
f =

the schema that holds the namespace-prefixes like =

xmlns:address=3D"http://www.eclipse.org/xsd/examples/address".

I don't create the model using the API. Instead, I directly use the the =
=

xsd.ecore within a model2model transformation. Thus the code-examples =

don't help me that much. The problem is that I don't understand the =

underlying metamodel yet ;-)

Rainer


****************************************
relevant part of the XSD.Ecore
****************************************
<eClassifiers xsi:type=3D"ecore:EClass" name=3D"XSDSchema" =

eSuperTypes=3D"#/0/XSDScope">
<eStructuralFeatures xsi:type=3D"ecore:EAttribute" name=3D"docume=
nt" =

ordered=3D"false"
unique=3D"false" eType=3D"#/0/XSDDOMDocument"/>
<eStructuralFeatures xsi:type=3D"ecore:EAttribute" =

name=3D"schemaLocation" ordered=3D"false"
unique=3D"false" eType=3D"ecore:EDataType =

http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type=3D"ecore:EAttribute" =

name=3D"targetNamespace" ordered=3D"false"
unique=3D"false" eType=3D"ecore:EDataType =

http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type=3D"ecore:EAttribute" =

name=3D"attributeFormDefault"
ordered=3D"false" unique=3D"false" eType=3D"#/0/XSDForm"/>
<eStructuralFeatures xsi:type=3D"ecore:EAttribute" =

name=3D"elementFormDefault" ordered=3D"false"
unique=3D"false" eType=3D"#/0/XSDForm"/>
<eStructuralFeatures xsi:type=3D"ecore:EAttribute" name=3D"finalD=
efault" =

upperBound=3D"-1"
eType=3D"#/0/XSDProhibitedSubstitutions"/>
<eStructuralFeatures xsi:type=3D"ecore:EAttribute" name=3D"blockD=
efault" =

upperBound=3D"-1"
eType=3D"#/0/XSDDisallowedSubstitutions"/>
<eStructuralFeatures xsi:type=3D"ecore:EAttribute" name=3D"versio=
n" =

ordered=3D"false"
unique=3D"false" eType=3D"ecore:EDataType =

http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type=3D"ecore:EReference" name=3D"conten=
ts" =

upperBound=3D"-1"
eType=3D"#/0/XSDSchemaContent" containment=3D"true"/>
<eStructuralFeatures xsi:type=3D"ecore:EReference" =

name=3D"elementDeclarations"
upperBound=3D"-1" eType=3D"#/0/XSDElementDeclaration"/>
<eStructuralFeatures xsi:type=3D"ecore:EReference" =

name=3D"attributeDeclarations"
upperBound=3D"-1" eType=3D"#/0/XSDAttributeDeclaration"/>
<eStructuralFeatures xsi:type=3D"ecore:EReference" =

name=3D"attributeGroupDefinitions"
upperBound=3D"-1" eType=3D"#/0/XSDAttributeGroupDefinition"/>=

<eStructuralFeatures xsi:type=3D"ecore:EReference" =

name=3D"typeDefinitions" upperBound=3D"-1"
eType=3D"#/0/XSDTypeDefinition"/>
<eStructuralFeatures xsi:type=3D"ecore:EReference" =

name=3D"modelGroupDefinitions"
upperBound=3D"-1" eType=3D"#/0/XSDModelGroupDefinition"/>
<eStructuralFeatures xsi:type=3D"ecore:EReference" =

name=3D"identityConstraintDefinitions"
upperBound=3D"-1" eType=3D"#/0/XSDIdentityConstraintDefinitio=
n"/>
<eStructuralFeatures xsi:type=3D"ecore:EReference" =

name=3D"notationDeclarations"
upperBound=3D"-1" eType=3D"#/0/XSDNotationDeclaration"/>
<eStructuralFeatures xsi:type=3D"ecore:EReference" name=3D"annota=
tions" =

upperBound=3D"-1"
eType=3D"#/0/XSDAnnotation"/>
<eStructuralFeatures xsi:type=3D"ecore:EReference" =

name=3D"allDiagnostics" upperBound=3D"-1"
eType=3D"#/0/XSDDiagnostic"/>
<eStructuralFeatures xsi:type=3D"ecore:EReference" =

name=3D"referencingDirectives"
upperBound=3D"-1" eType=3D"#/0/XSDSchemaDirective"/>
<eStructuralFeatures xsi:type=3D"ecore:EReference" name=3D"rootVe=
rsion" =

ordered=3D"false"
lowerBound=3D"1" eType=3D"#/0/XSDSchema"/>
<eStructuralFeatures xsi:type=3D"ecore:EReference" =

name=3D"originalVersion" ordered=3D"false"
eType=3D"#/0/XSDSchema"/>
<eStructuralFeatures xsi:type=3D"ecore:EReference" =

name=3D"incorporatedVersions"
upperBound=3D"-1" eType=3D"#/0/XSDSchema" containment=3D"true=
"/>
<eStructuralFeatures xsi:type=3D"ecore:EReference" =

name=3D"schemaForSchema" ordered=3D"false"
lowerBound=3D"1" eType=3D"#/0/XSDSchema"/>
</eClassifiers>


> Rainer,
>
> Unfortunately, I don't really understand the question you are asking. =
=

> Setting a prefix as you show below will produce the right xmlns =

> declaration in the XSDSchema's corresponding DOM element. For the =

> simple example below, there is only just the XSDSchema instance an =

> nothing else besides the underlying DOM Element where the xmlns prefix=
=

> declarations are concretely represented. You might want to have a loo=
k =

> at XSDPrototypicalSchema because it shows a small example of how to =

> construct pretty much everything. You might also be interested in =

> EcoreSchemaBuilder which takes an Ecore model and builds a correspondi=
ng =

> schema for it. Maybe you want to show a larger example of what you ar=
e =

> trying to produce
>
>
>
> Rainer Bernhard wrote:
>> Hello,
>>
>> I just started to work with the XML Schema Infoset.
>>
>> My goal is to create a schema which rererences some namespaces:
>> ************************************************************ ***
>> <schema targetNamespace=3D"http://www.eclipse.org/xsd/examples/create=
xsd"
>> xmlns=3D"http://www.w3.org/2001/XMLSchema"
>> xmlns:address=3D"http://www.eclipse.org/xsd/examples/address"/>
>>
>>
>> Using the API, I just need the following line (according to the =

>> developer works article "XMLSchemaInfosetModel,Part1"):
>> ************************************************************ ***
>> qNamePrefixToNamespaceMap.put("address","http://www.eclipse.org/xsd/e=
xamples/address"); =

>>
>> However, I need to know the concrete Model element, which stores the =
=

>> information and is referenced by the XSDSchema-EClass, since I want u=
se =

>> the xsd.ecore for model transformation with ATL.
>> I can't find an element that defines a prefix - any help?
>>
>> Although this is not an ATL newsgroup, I post the following example =

>> which demonstrates, why I need to know the EReference-Feature in the =
=

>> XSDSchema ECLass and the EClass representing the prefixes and =

>> namespaces. I hope the example clarifies my question:
>> ************************************************************ ***
>> rule Schema2Schema {
>> from
>> inputSchema XSD!XSDSchema
>> to
>> schema : XSD!XSDSchema(
>> targetNamespace <- 'de.uba.wiai.seda.soad.fallstudie',
>> <REFERENCE-FEATURE> <- refNamespaces
>> ),
>> refNamespaces : XSD!<MODELELEMENT> (
>> prefix <- '...',
>> namespace <- '....'
>> )
>> }
>>
>>
>>
>> Best regards
>>
>> Rainer Bernhard
>>
>>



-- =

Erstellt mit Operas revolution=E4rem E-Mail-Modul: http://www.opera.com/=
mail/
Re: EClass for prefix and namespace definition? [message #72893 is a reply to message #72874] Tue, 07 August 2007 22:05 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Rainer,

I see now. Unfortunately there is no feature in the Ecore model that
can be populated via EMF reflection to populate this aspect of the XSD
model's concrete syntax. :-(


Rainer Bernhard wrote:
> Hello Ed,
>
> another try to explain my problem ;-)
>
> An example for the concrete syntax of a schema-element is:
> <schema targetNamespace="http://www.eclipse.org/xsd/examples/createxsd"
> xmlns="http://www.w3.org/2001/XMLSchema"
> xmlns:address="http://www.eclipse.org/xsd/examples/address"/>
>
> The XSDSchema abstract syntax is specified in the xsd.ecore and has
> features like (see relevant part of the ecore above):
> schemaLocation: <eStructuralFeatures xsi:type="ecore:EAttribute"
> name="schemaLocation" ordered="false"
> unique="false" eType="ecore:EDataType
> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> targetNamespace: <eStructuralFeatures
> xsi:type="ecore:EAttribute" name="targetNamespace" ordered="false"
> unique="false" eType="ecore:EDataType
> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>
> However, I don't see any attribute or reference in the abstract syntax
> of the schema that holds the namespace-prefixes like
> xmlns:address="http://www.eclipse.org/xsd/examples/address".
>
> I don't create the model using the API. Instead, I directly use the
> the xsd.ecore within a model2model transformation. Thus the
> code-examples don't help me that much. The problem is that I don't
> understand the underlying metamodel yet ;-)
>
> Rainer
>
>
> ****************************************
> relevant part of the XSD.Ecore
> ****************************************
> <eClassifiers xsi:type="ecore:EClass" name="XSDSchema"
> eSuperTypes="#/0/XSDScope">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="document"
> ordered="false"
> unique="false" eType="#/0/XSDDOMDocument"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute"
> name="schemaLocation" ordered="false"
> unique="false" eType="ecore:EDataType
> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute"
> name="targetNamespace" ordered="false"
> unique="false" eType="ecore:EDataType
> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute"
> name="attributeFormDefault"
> ordered="false" unique="false" eType="#/0/XSDForm"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute"
> name="elementFormDefault" ordered="false"
> unique="false" eType="#/0/XSDForm"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute"
> name="finalDefault" upperBound="-1"
> eType="#/0/XSDProhibitedSubstitutions"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute"
> name="blockDefault" upperBound="-1"
> eType="#/0/XSDDisallowedSubstitutions"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="version"
> ordered="false"
> unique="false" eType="ecore:EDataType
> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="contents"
> upperBound="-1"
> eType="#/0/XSDSchemaContent" containment="true"/>
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="elementDeclarations"
> upperBound="-1" eType="#/0/XSDElementDeclaration"/>
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="attributeDeclarations"
> upperBound="-1" eType="#/0/XSDAttributeDeclaration"/>
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="attributeGroupDefinitions"
> upperBound="-1" eType="#/0/XSDAttributeGroupDefinition"/>
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="typeDefinitions" upperBound="-1"
> eType="#/0/XSDTypeDefinition"/>
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="modelGroupDefinitions"
> upperBound="-1" eType="#/0/XSDModelGroupDefinition"/>
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="identityConstraintDefinitions"
> upperBound="-1" eType="#/0/XSDIdentityConstraintDefinition"/>
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="notationDeclarations"
> upperBound="-1" eType="#/0/XSDNotationDeclaration"/>
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="annotations" upperBound="-1"
> eType="#/0/XSDAnnotation"/>
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="allDiagnostics" upperBound="-1"
> eType="#/0/XSDDiagnostic"/>
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="referencingDirectives"
> upperBound="-1" eType="#/0/XSDSchemaDirective"/>
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="rootVersion" ordered="false"
> lowerBound="1" eType="#/0/XSDSchema"/>
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="originalVersion" ordered="false"
> eType="#/0/XSDSchema"/>
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="incorporatedVersions"
> upperBound="-1" eType="#/0/XSDSchema" containment="true"/>
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="schemaForSchema" ordered="false"
> lowerBound="1" eType="#/0/XSDSchema"/>
> </eClassifiers>
>
>
>> Rainer,
>>
>> Unfortunately, I don't really understand the question you are
>> asking. Setting a prefix as you show below will produce the right
>> xmlns declaration in the XSDSchema's corresponding DOM element. For
>> the simple example below, there is only just the XSDSchema instance
>> an nothing else besides the underlying DOM Element where the xmlns
>> prefix declarations are concretely represented. You might want to
>> have a look at XSDPrototypicalSchema because it shows a small example
>> of how to construct pretty much everything. You might also be
>> interested in EcoreSchemaBuilder which takes an Ecore model and
>> builds a corresponding schema for it. Maybe you want to show a
>> larger example of what you are trying to produce
>>
>>
>>
>> Rainer Bernhard wrote:
>>> Hello,
>>>
>>> I just started to work with the XML Schema Infoset.
>>>
>>> My goal is to create a schema which rererences some namespaces:
>>> ************************************************************ ***
>>> <schema targetNamespace="http://www.eclipse.org/xsd/examples/createxsd"
>>> xmlns="http://www.w3.org/2001/XMLSchema"
>>> xmlns:address="http://www.eclipse.org/xsd/examples/address"/>
>>>
>>>
>>> Using the API, I just need the following line (according to the
>>> developer works article "XMLSchemaInfosetModel,Part1"):
>>> ************************************************************ ***
>>> qNamePrefixToNamespaceMap.put("address","http://www.eclipse.org/xsd/examples/address");
>>>
>>> However, I need to know the concrete Model element, which stores the
>>> information and is referenced by the XSDSchema-EClass, since I want
>>> use the xsd.ecore for model transformation with ATL.
>>> I can't find an element that defines a prefix - any help?
>>>
>>> Although this is not an ATL newsgroup, I post the following example
>>> which demonstrates, why I need to know the EReference-Feature in the
>>> XSDSchema ECLass and the EClass representing the prefixes and
>>> namespaces. I hope the example clarifies my question:
>>> ************************************************************ ***
>>> rule Schema2Schema {
>>> from
>>> inputSchema XSD!XSDSchema
>>> to
>>> schema : XSD!XSDSchema(
>>> targetNamespace <- 'de.uba.wiai.seda.soad.fallstudie',
>>> <REFERENCE-FEATURE> <- refNamespaces
>>> ),
>>> refNamespaces : XSD!<MODELELEMENT> (
>>> prefix <- '...',
>>> namespace <- '....'
>>> )
>>> }
>>>
>>>
>>>
>>> Best regards
>>>
>>> Rainer Bernhard
>>>
>>>
>
>
>
Re: EClass for prefix and namespace definition? [message #602532 is a reply to message #72812] Sun, 05 August 2007 18:44 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Rainer,

Unfortunately, I don't really understand the question you are asking.
Setting a prefix as you show below will produce the right xmlns
declaration in the XSDSchema's corresponding DOM element. For the
simple example below, there is only just the XSDSchema instance an
nothing else besides the underlying DOM Element where the xmlns prefix
declarations are concretely represented. You might want to have a look
at XSDPrototypicalSchema because it shows a small example of how to
construct pretty much everything. You might also be interested in
EcoreSchemaBuilder which takes an Ecore model and builds a corresponding
schema for it. Maybe you want to show a larger example of what you are
trying to produce



Rainer Bernhard wrote:
> Hello,
>
> I just started to work with the XML Schema Infoset.
>
> My goal is to create a schema which rererences some namespaces:
> ************************************************************ ***
> <schema targetNamespace="http://www.eclipse.org/xsd/examples/createxsd"
> xmlns="http://www.w3.org/2001/XMLSchema"
> xmlns:address="http://www.eclipse.org/xsd/examples/address"/>
>
>
> Using the API, I just need the following line (according to the
> developer works article "XMLSchemaInfosetModel,Part1"):
> ************************************************************ ***
> qNamePrefixToNamespaceMap.put("address","http://www.eclipse.org/xsd/examples/address");
>
>
>
> However, I need to know the concrete Model element, which stores the
> information and is referenced by the XSDSchema-EClass, since I want
> use the xsd.ecore for model transformation with ATL.
> I can't find an element that defines a prefix - any help?
>
> Although this is not an ATL newsgroup, I post the following example
> which demonstrates, why I need to know the EReference-Feature in the
> XSDSchema ECLass and the EClass representing the prefixes and
> namespaces. I hope the example clarifies my question:
> ************************************************************ ***
> rule Schema2Schema {
> from
> inputSchema XSD!XSDSchema
> to
> schema : XSD!XSDSchema(
> targetNamespace <- 'de.uba.wiai.seda.soad.fallstudie',
> <REFERENCE-FEATURE> <- refNamespaces
> ),
> refNamespaces : XSD!<MODELELEMENT> (
> prefix <- '...',
> namespace <- '....'
> )
> }
>
>
>
> Best regards
>
> Rainer Bernhard
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EClass for prefix and namespace definition? [message #602551 is a reply to message #72829] Tue, 07 August 2007 20:58 Go to previous message
Eclipse UserFriend
Originally posted by: rb_account.yahoo.de

Hello Ed,

another try to explain my problem ;-)

An example for the concrete syntax of a schema-element is:
<schema targetNamespace=3D"http://www.eclipse.org/xsd/examples/createxsd=
"
xmlns=3D"http://www.w3.org/2001/XMLSchema"
xmlns:address=3D"http://www.eclipse.org/xsd/examples/address"/>

The XSDSchema abstract syntax is specified in the xsd.ecore and has =

features like (see relevant part of the ecore above):
schemaLocation: <eStructuralFeatures xsi:type=3D"ecore:EAttribute"=
=

name=3D"schemaLocation" ordered=3D"false"
unique=3D"false" eType=3D"ecore:EDataType =

http://www.eclipse.org/emf/2002/Ecore#//EString"/>
targetNamespace: <eStructuralFeatures xsi:type=3D"ecore:EAttribute=
" =

name=3D"targetNamespace" ordered=3D"false"
unique=3D"false" eType=3D"ecore:EDataType =

http://www.eclipse.org/emf/2002/Ecore#//EString"/>

However, I don't see any attribute or reference in the abstract syntax o=
f =

the schema that holds the namespace-prefixes like =

xmlns:address=3D"http://www.eclipse.org/xsd/examples/address".

I don't create the model using the API. Instead, I directly use the the =
=

xsd.ecore within a model2model transformation. Thus the code-examples =

don't help me that much. The problem is that I don't understand the =

underlying metamodel yet ;-)

Rainer


****************************************
relevant part of the XSD.Ecore
****************************************
<eClassifiers xsi:type=3D"ecore:EClass" name=3D"XSDSchema" =

eSuperTypes=3D"#/0/XSDScope">
<eStructuralFeatures xsi:type=3D"ecore:EAttribute" name=3D"docume=
nt" =

ordered=3D"false"
unique=3D"false" eType=3D"#/0/XSDDOMDocument"/>
<eStructuralFeatures xsi:type=3D"ecore:EAttribute" =

name=3D"schemaLocation" ordered=3D"false"
unique=3D"false" eType=3D"ecore:EDataType =

http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type=3D"ecore:EAttribute" =

name=3D"targetNamespace" ordered=3D"false"
unique=3D"false" eType=3D"ecore:EDataType =

http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type=3D"ecore:EAttribute" =

name=3D"attributeFormDefault"
ordered=3D"false" unique=3D"false" eType=3D"#/0/XSDForm"/>
<eStructuralFeatures xsi:type=3D"ecore:EAttribute" =

name=3D"elementFormDefault" ordered=3D"false"
unique=3D"false" eType=3D"#/0/XSDForm"/>
<eStructuralFeatures xsi:type=3D"ecore:EAttribute" name=3D"finalD=
efault" =

upperBound=3D"-1"
eType=3D"#/0/XSDProhibitedSubstitutions"/>
<eStructuralFeatures xsi:type=3D"ecore:EAttribute" name=3D"blockD=
efault" =

upperBound=3D"-1"
eType=3D"#/0/XSDDisallowedSubstitutions"/>
<eStructuralFeatures xsi:type=3D"ecore:EAttribute" name=3D"versio=
n" =

ordered=3D"false"
unique=3D"false" eType=3D"ecore:EDataType =

http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type=3D"ecore:EReference" name=3D"conten=
ts" =

upperBound=3D"-1"
eType=3D"#/0/XSDSchemaContent" containment=3D"true"/>
<eStructuralFeatures xsi:type=3D"ecore:EReference" =

name=3D"elementDeclarations"
upperBound=3D"-1" eType=3D"#/0/XSDElementDeclaration"/>
<eStructuralFeatures xsi:type=3D"ecore:EReference" =

name=3D"attributeDeclarations"
upperBound=3D"-1" eType=3D"#/0/XSDAttributeDeclaration"/>
<eStructuralFeatures xsi:type=3D"ecore:EReference" =

name=3D"attributeGroupDefinitions"
upperBound=3D"-1" eType=3D"#/0/XSDAttributeGroupDefinition"/>=

<eStructuralFeatures xsi:type=3D"ecore:EReference" =

name=3D"typeDefinitions" upperBound=3D"-1"
eType=3D"#/0/XSDTypeDefinition"/>
<eStructuralFeatures xsi:type=3D"ecore:EReference" =

name=3D"modelGroupDefinitions"
upperBound=3D"-1" eType=3D"#/0/XSDModelGroupDefinition"/>
<eStructuralFeatures xsi:type=3D"ecore:EReference" =

name=3D"identityConstraintDefinitions"
upperBound=3D"-1" eType=3D"#/0/XSDIdentityConstraintDefinitio=
n"/>
<eStructuralFeatures xsi:type=3D"ecore:EReference" =

name=3D"notationDeclarations"
upperBound=3D"-1" eType=3D"#/0/XSDNotationDeclaration"/>
<eStructuralFeatures xsi:type=3D"ecore:EReference" name=3D"annota=
tions" =

upperBound=3D"-1"
eType=3D"#/0/XSDAnnotation"/>
<eStructuralFeatures xsi:type=3D"ecore:EReference" =

name=3D"allDiagnostics" upperBound=3D"-1"
eType=3D"#/0/XSDDiagnostic"/>
<eStructuralFeatures xsi:type=3D"ecore:EReference" =

name=3D"referencingDirectives"
upperBound=3D"-1" eType=3D"#/0/XSDSchemaDirective"/>
<eStructuralFeatures xsi:type=3D"ecore:EReference" name=3D"rootVe=
rsion" =

ordered=3D"false"
lowerBound=3D"1" eType=3D"#/0/XSDSchema"/>
<eStructuralFeatures xsi:type=3D"ecore:EReference" =

name=3D"originalVersion" ordered=3D"false"
eType=3D"#/0/XSDSchema"/>
<eStructuralFeatures xsi:type=3D"ecore:EReference" =

name=3D"incorporatedVersions"
upperBound=3D"-1" eType=3D"#/0/XSDSchema" containment=3D"true=
"/>
<eStructuralFeatures xsi:type=3D"ecore:EReference" =

name=3D"schemaForSchema" ordered=3D"false"
lowerBound=3D"1" eType=3D"#/0/XSDSchema"/>
</eClassifiers>


> Rainer,
>
> Unfortunately, I don't really understand the question you are asking. =
=

> Setting a prefix as you show below will produce the right xmlns =

> declaration in the XSDSchema's corresponding DOM element. For the =

> simple example below, there is only just the XSDSchema instance an =

> nothing else besides the underlying DOM Element where the xmlns prefix=
=

> declarations are concretely represented. You might want to have a loo=
k =

> at XSDPrototypicalSchema because it shows a small example of how to =

> construct pretty much everything. You might also be interested in =

> EcoreSchemaBuilder which takes an Ecore model and builds a correspondi=
ng =

> schema for it. Maybe you want to show a larger example of what you ar=
e =

> trying to produce
>
>
>
> Rainer Bernhard wrote:
>> Hello,
>>
>> I just started to work with the XML Schema Infoset.
>>
>> My goal is to create a schema which rererences some namespaces:
>> ************************************************************ ***
>> <schema targetNamespace=3D"http://www.eclipse.org/xsd/examples/create=
xsd"
>> xmlns=3D"http://www.w3.org/2001/XMLSchema"
>> xmlns:address=3D"http://www.eclipse.org/xsd/examples/address"/>
>>
>>
>> Using the API, I just need the following line (according to the =

>> developer works article "XMLSchemaInfosetModel,Part1"):
>> ************************************************************ ***
>> qNamePrefixToNamespaceMap.put("address","http://www.eclipse.org/xsd/e=
xamples/address"); =

>>
>> However, I need to know the concrete Model element, which stores the =
=

>> information and is referenced by the XSDSchema-EClass, since I want u=
se =

>> the xsd.ecore for model transformation with ATL.
>> I can't find an element that defines a prefix - any help?
>>
>> Although this is not an ATL newsgroup, I post the following example =

>> which demonstrates, why I need to know the EReference-Feature in the =
=

>> XSDSchema ECLass and the EClass representing the prefixes and =

>> namespaces. I hope the example clarifies my question:
>> ************************************************************ ***
>> rule Schema2Schema {
>> from
>> inputSchema XSD!XSDSchema
>> to
>> schema : XSD!XSDSchema(
>> targetNamespace <- 'de.uba.wiai.seda.soad.fallstudie',
>> <REFERENCE-FEATURE> <- refNamespaces
>> ),
>> refNamespaces : XSD!<MODELELEMENT> (
>> prefix <- '...',
>> namespace <- '....'
>> )
>> }
>>
>>
>>
>> Best regards
>>
>> Rainer Bernhard
>>
>>



-- =

Erstellt mit Operas revolution=E4rem E-Mail-Modul: http://www.opera.com/=
mail/
Re: EClass for prefix and namespace definition? [message #602558 is a reply to message #72874] Tue, 07 August 2007 22:05 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Rainer,

I see now. Unfortunately there is no feature in the Ecore model that
can be populated via EMF reflection to populate this aspect of the XSD
model's concrete syntax. :-(


Rainer Bernhard wrote:
> Hello Ed,
>
> another try to explain my problem ;-)
>
> An example for the concrete syntax of a schema-element is:
> <schema targetNamespace="http://www.eclipse.org/xsd/examples/createxsd"
> xmlns="http://www.w3.org/2001/XMLSchema"
> xmlns:address="http://www.eclipse.org/xsd/examples/address"/>
>
> The XSDSchema abstract syntax is specified in the xsd.ecore and has
> features like (see relevant part of the ecore above):
> schemaLocation: <eStructuralFeatures xsi:type="ecore:EAttribute"
> name="schemaLocation" ordered="false"
> unique="false" eType="ecore:EDataType
> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> targetNamespace: <eStructuralFeatures
> xsi:type="ecore:EAttribute" name="targetNamespace" ordered="false"
> unique="false" eType="ecore:EDataType
> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
>
> However, I don't see any attribute or reference in the abstract syntax
> of the schema that holds the namespace-prefixes like
> xmlns:address="http://www.eclipse.org/xsd/examples/address".
>
> I don't create the model using the API. Instead, I directly use the
> the xsd.ecore within a model2model transformation. Thus the
> code-examples don't help me that much. The problem is that I don't
> understand the underlying metamodel yet ;-)
>
> Rainer
>
>
> ****************************************
> relevant part of the XSD.Ecore
> ****************************************
> <eClassifiers xsi:type="ecore:EClass" name="XSDSchema"
> eSuperTypes="#/0/XSDScope">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="document"
> ordered="false"
> unique="false" eType="#/0/XSDDOMDocument"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute"
> name="schemaLocation" ordered="false"
> unique="false" eType="ecore:EDataType
> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute"
> name="targetNamespace" ordered="false"
> unique="false" eType="ecore:EDataType
> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute"
> name="attributeFormDefault"
> ordered="false" unique="false" eType="#/0/XSDForm"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute"
> name="elementFormDefault" ordered="false"
> unique="false" eType="#/0/XSDForm"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute"
> name="finalDefault" upperBound="-1"
> eType="#/0/XSDProhibitedSubstitutions"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute"
> name="blockDefault" upperBound="-1"
> eType="#/0/XSDDisallowedSubstitutions"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="version"
> ordered="false"
> unique="false" eType="ecore:EDataType
> http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="contents"
> upperBound="-1"
> eType="#/0/XSDSchemaContent" containment="true"/>
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="elementDeclarations"
> upperBound="-1" eType="#/0/XSDElementDeclaration"/>
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="attributeDeclarations"
> upperBound="-1" eType="#/0/XSDAttributeDeclaration"/>
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="attributeGroupDefinitions"
> upperBound="-1" eType="#/0/XSDAttributeGroupDefinition"/>
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="typeDefinitions" upperBound="-1"
> eType="#/0/XSDTypeDefinition"/>
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="modelGroupDefinitions"
> upperBound="-1" eType="#/0/XSDModelGroupDefinition"/>
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="identityConstraintDefinitions"
> upperBound="-1" eType="#/0/XSDIdentityConstraintDefinition"/>
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="notationDeclarations"
> upperBound="-1" eType="#/0/XSDNotationDeclaration"/>
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="annotations" upperBound="-1"
> eType="#/0/XSDAnnotation"/>
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="allDiagnostics" upperBound="-1"
> eType="#/0/XSDDiagnostic"/>
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="referencingDirectives"
> upperBound="-1" eType="#/0/XSDSchemaDirective"/>
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="rootVersion" ordered="false"
> lowerBound="1" eType="#/0/XSDSchema"/>
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="originalVersion" ordered="false"
> eType="#/0/XSDSchema"/>
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="incorporatedVersions"
> upperBound="-1" eType="#/0/XSDSchema" containment="true"/>
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="schemaForSchema" ordered="false"
> lowerBound="1" eType="#/0/XSDSchema"/>
> </eClassifiers>
>
>
>> Rainer,
>>
>> Unfortunately, I don't really understand the question you are
>> asking. Setting a prefix as you show below will produce the right
>> xmlns declaration in the XSDSchema's corresponding DOM element. For
>> the simple example below, there is only just the XSDSchema instance
>> an nothing else besides the underlying DOM Element where the xmlns
>> prefix declarations are concretely represented. You might want to
>> have a look at XSDPrototypicalSchema because it shows a small example
>> of how to construct pretty much everything. You might also be
>> interested in EcoreSchemaBuilder which takes an Ecore model and
>> builds a corresponding schema for it. Maybe you want to show a
>> larger example of what you are trying to produce
>>
>>
>>
>> Rainer Bernhard wrote:
>>> Hello,
>>>
>>> I just started to work with the XML Schema Infoset.
>>>
>>> My goal is to create a schema which rererences some namespaces:
>>> ************************************************************ ***
>>> <schema targetNamespace="http://www.eclipse.org/xsd/examples/createxsd"
>>> xmlns="http://www.w3.org/2001/XMLSchema"
>>> xmlns:address="http://www.eclipse.org/xsd/examples/address"/>
>>>
>>>
>>> Using the API, I just need the following line (according to the
>>> developer works article "XMLSchemaInfosetModel,Part1"):
>>> ************************************************************ ***
>>> qNamePrefixToNamespaceMap.put("address","http://www.eclipse.org/xsd/examples/address");
>>>
>>> However, I need to know the concrete Model element, which stores the
>>> information and is referenced by the XSDSchema-EClass, since I want
>>> use the xsd.ecore for model transformation with ATL.
>>> I can't find an element that defines a prefix - any help?
>>>
>>> Although this is not an ATL newsgroup, I post the following example
>>> which demonstrates, why I need to know the EReference-Feature in the
>>> XSDSchema ECLass and the EClass representing the prefixes and
>>> namespaces. I hope the example clarifies my question:
>>> ************************************************************ ***
>>> rule Schema2Schema {
>>> from
>>> inputSchema XSD!XSDSchema
>>> to
>>> schema : XSD!XSDSchema(
>>> targetNamespace <- 'de.uba.wiai.seda.soad.fallstudie',
>>> <REFERENCE-FEATURE> <- refNamespaces
>>> ),
>>> refNamespaces : XSD!<MODELELEMENT> (
>>> prefix <- '...',
>>> namespace <- '....'
>>> )
>>> }
>>>
>>>
>>>
>>> Best regards
>>>
>>> Rainer Bernhard
>>>
>>>
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:EClass for prefix and namespace definition?
Next Topic:Reading, editing and storing XML file
Goto Forum:
  


Current Time: Fri Mar 29 13:55:41 GMT 2024

Powered by FUDForum. Page generated in 0.02861 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top