Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » getContent
getContent [message #59642] Tue, 26 April 2005 10:32 Go to next message
Eclipse UserFriend
Originally posted by: aaudevart.genigraph.fr

Hi,

I 've got a little problem.
I want to extract the simple type includes in the <xs:attribute>.

I manage to extract the name and the use of the attribute like this :

XSDAttributeUse attribute = (XSDAttributeUse) attributeList.get(i);
XSDAttributeUseCategory attUse = attribute.getUse();
String nameAttribut = attribute.getAttributeDeclaration().getName();

Here is my code :

<xs:attribute name="Etat" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Connu"/>
<xs:enumeration value="Inconnu"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>

I think using the function attribute.getContent(); But I can't extract the
value!!!
can somebody help me?
Thanks
Re: getContent [message #59667 is a reply to message #59642] Tue, 26 April 2005 10:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Alex,

Use XSDAttribute.getTypeDefinition(), e.g.,
attribute.getAttributeDeclaration().getTypeDefinition().
XSDAttributeDeclaration.getAnonymousTypeDefinition() will return the
same type, but only if it's the anonymous type.


Alex wrote:

> Hi,
>
> I 've got a little problem.
> I want to extract the simple type includes in the <xs:attribute>.
>
> I manage to extract the name and the use of the attribute like this :
>
> XSDAttributeUse attribute = (XSDAttributeUse) attributeList.get(i);
> XSDAttributeUseCategory attUse = attribute.getUse();
> String nameAttribut = attribute.getAttributeDeclaration().getName();
>
> Here is my code :
>
> <xs:attribute name="Etat" use="required">
> <xs:simpleType>
> <xs:restriction base="xs:string">
> <xs:enumeration value="Connu"/>
> <xs:enumeration value="Inconnu"/>
> </xs:restriction>
> </xs:simpleType>
> </xs:attribute>
>
> I think using the function attribute.getContent(); But I can't extract
> the value!!!
> can somebody help me? Thanks
>
Re: getContent [message #59690 is a reply to message #59667] Tue, 26 April 2005 12:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: aaudevart.genigraph.fr

I am agree with you but I want to have a XSDElementDeclaration. It ' s
possible?
We can't cast XSDSimpleTypeDefinition in a XSDElementDeclaration.
Thanks for your help!
Re: getContent [message #59760 is a reply to message #59690] Tue, 26 April 2005 15:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Alex,

You asked for about simple types used in attributes, and showed code
accessing a attribute declaration; could you explain with a little bit
more detail how wanting a element declaration fits into the picture?


alex wrote:

> I am agree with you but I want to have a XSDElementDeclaration. It ' s
> possible?
> We can't cast XSDSimpleTypeDefinition in a XSDElementDeclaration.
> Thanks for your help!
>
Re: getContent [message #59783 is a reply to message #59760] Tue, 26 April 2005 15:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: aaudevart.genigraph.fr

I'll try to explain you with more details.
So, i have a tree like this:
<xs:complexType name="ParentType">
<xs:sequence>
<xs:element name="Nom" type="NomType" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="Etat" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Connu"/>
<xs:enumeration value="Inconnu"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
I manage to extract the name and the use of the <xs:attribute>
But now, i want to extract this :
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Connu"/>
<xs:enumeration value="Inconnu"/>
</xs:restriction>
</xs:simpleType>
In my programm, i use a method who take a XSDElementDeclaration in
parameter.
My problem is to extract my simple Type and convert it in a
XSDSimpleTypeDefinition.
I hope it's more clear.
Thanks
Re: getContent [message #59806 is a reply to message #59783] Tue, 26 April 2005 16:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------020402030103010503080300
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Alex,

No, I'm still confused. The type of the XSDAttributeDeclaration is
extracted with the following method, so I would have thought you'd
already have exactly what you need:

/**
* Returns the value of the '<em><b>Type Definition</b></em>'
reference.
* <!-- begin-user-doc -->
* <p>
* This represents the
* <a
href="http://www.w3.org/TR/xmlschema-1/#a-simple_type_definition">type
definition</a>
* infoset property.
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Type Definition</em>' reference.
* @see #setTypeDefinition(XSDSimpleTypeDefinition)
* @see
org.eclipse.xsd.XSDPackage#getXSDAttributeDeclaration_TypeDe finition()
* @model resolveProxies="false" required="true"
* @generated
*/
XSDSimpleTypeDefinition getTypeDefinition();

I still don't understand how XSDElementDeclaration fits into the question...


Alex wrote:

> I'll try to explain you with more details.
> So, i have a tree like this:
> <xs:complexType name="ParentType">
> <xs:sequence>
> <xs:element name="Nom" type="NomType" minOccurs="0"/>
> </xs:sequence>
> <xs:attribute name="Etat" use="required">
> <xs:simpleType>
> <xs:restriction base="xs:string">
> <xs:enumeration value="Connu"/>
> <xs:enumeration value="Inconnu"/>
> </xs:restriction>
> </xs:simpleType>
> </xs:attribute>
> </xs:complexType>
> I manage to extract the name and the use of the <xs:attribute>
> But now, i want to extract this :
> <xs:simpleType>
> <xs:restriction base="xs:string">
> <xs:enumeration value="Connu"/>
> <xs:enumeration value="Inconnu"/>
> </xs:restriction>
> </xs:simpleType>
> In my programm, i use a method who take a XSDElementDeclaration in
> parameter.
> My problem is to extract my simple Type and convert it in a
> XSDSimpleTypeDefinition.
> I hope it's more clear.
> Thanks
>
>


--------------020402030103010503080300
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Alex,<br>
<br>
No, I'm still confused.
Re: getContent [message #59829 is a reply to message #59783] Tue, 26 April 2005 17:03 Go to previous messageGo to next message
Klaas Dellschaft is currently offline Klaas DellschaftFriend
Messages: 58
Registered: July 2009
Member
> I manage to extract the name and the use of the <xs:attribute>
> But now, i want to extract this :
> <xs:simpleType>
> <xs:restriction base="xs:string">
> <xs:enumeration value="Connu"/>
> <xs:enumeration value="Inconnu"/>
> </xs:restriction>
> </xs:simpleType>
> In my programm, i use a method who take a XSDElementDeclaration in
> parameter.
> My problem is to extract my simple Type and convert it in a
> XSDSimpleTypeDefinition.

I think there is a misunderstanding what an XSDElementDeclaration really is.
Unlike in DOM the schema elements (like simpleType, complexType, ...) aren't
all elements (or element declarations). An XSDElementDeclaration just is
something like this:

<xs:element name="foo" type="bar"/>

or

<xs:element name="foo">
<xs:complexType>
...
</xs:complexType>
</xs:element>


So if you want to extract the xs:simpleType the XSDSimpleTypeDefinition is
what you want (like Ed said). And there is no possibility to cast to an
XSDElementDeclaration.


Cheers
Klaas
Re: getContent [message #60189 is a reply to message #59829] Thu, 28 April 2005 15:16 Go to previous message
Eclipse UserFriend
Originally posted by: aaudevart.genigraph.fr

Thanks for your help!
I manage to do what i want!
Re: getContent [message #594964 is a reply to message #59642] Tue, 26 April 2005 10:43 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 26287
Registered: July 2009
Senior Member
Alex,

Use XSDAttribute.getTypeDefinition(), e.g.,
attribute.getAttributeDeclaration().getTypeDefinition().
XSDAttributeDeclaration.getAnonymousTypeDefinition() will return the
same type, but only if it's the anonymous type.


Alex wrote:

> Hi,
>
> I 've got a little problem.
> I want to extract the simple type includes in the <xs:attribute>.
>
> I manage to extract the name and the use of the attribute like this :
>
> XSDAttributeUse attribute = (XSDAttributeUse) attributeList.get(i);
> XSDAttributeUseCategory attUse = attribute.getUse();
> String nameAttribut = attribute.getAttributeDeclaration().getName();
>
> Here is my code :
>
> <xs:attribute name="Etat" use="required">
> <xs:simpleType>
> <xs:restriction base="xs:string">
> <xs:enumeration value="Connu"/>
> <xs:enumeration value="Inconnu"/>
> </xs:restriction>
> </xs:simpleType>
> </xs:attribute>
>
> I think using the function attribute.getContent(); But I can't extract
> the value!!!
> can somebody help me? Thanks
>
Re: getContent [message #594974 is a reply to message #59667] Tue, 26 April 2005 12:03 Go to previous message
alex is currently offline alexFriend
Messages: 16
Registered: July 2009
Junior Member
I am agree with you but I want to have a XSDElementDeclaration. It ' s
possible?
We can't cast XSDSimpleTypeDefinition in a XSDElementDeclaration.
Thanks for your help!
Re: getContent [message #595001 is a reply to message #59690] Tue, 26 April 2005 15:27 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 26287
Registered: July 2009
Senior Member
Alex,

You asked for about simple types used in attributes, and showed code
accessing a attribute declaration; could you explain with a little bit
more detail how wanting a element declaration fits into the picture?


alex wrote:

> I am agree with you but I want to have a XSDElementDeclaration. It ' s
> possible?
> We can't cast XSDSimpleTypeDefinition in a XSDElementDeclaration.
> Thanks for your help!
>
Re: getContent [message #595011 is a reply to message #59760] Tue, 26 April 2005 15:56 Go to previous message
Alex is currently offline AlexFriend
Messages: 65
Registered: July 2009
Member
I'll try to explain you with more details.
So, i have a tree like this:
<xs:complexType name="ParentType">
<xs:sequence>
<xs:element name="Nom" type="NomType" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="Etat" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Connu"/>
<xs:enumeration value="Inconnu"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
I manage to extract the name and the use of the <xs:attribute>
But now, i want to extract this :
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Connu"/>
<xs:enumeration value="Inconnu"/>
</xs:restriction>
</xs:simpleType>
In my programm, i use a method who take a XSDElementDeclaration in
parameter.
My problem is to extract my simple Type and convert it in a
XSDSimpleTypeDefinition.
I hope it's more clear.
Thanks
Re: getContent [message #595022 is a reply to message #59783] Tue, 26 April 2005 16:10 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 26287
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020402030103010503080300
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Alex,

No, I'm still confused. The type of the XSDAttributeDeclaration is
extracted with the following method, so I would have thought you'd
already have exactly what you need:

/**
* Returns the value of the '<em><b>Type Definition</b></em>'
reference.
* <!-- begin-user-doc -->
* <p>
* This represents the
* <a
href="http://www.w3.org/TR/xmlschema-1/#a-simple_type_definition">type
definition</a>
* infoset property.
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Type Definition</em>' reference.
* @see #setTypeDefinition(XSDSimpleTypeDefinition)
* @see
org.eclipse.xsd.XSDPackage#getXSDAttributeDeclaration_TypeDe finition()
* @model resolveProxies="false" required="true"
* @generated
*/
XSDSimpleTypeDefinition getTypeDefinition();

I still don't understand how XSDElementDeclaration fits into the question...


Alex wrote:

> I'll try to explain you with more details.
> So, i have a tree like this:
> <xs:complexType name="ParentType">
> <xs:sequence>
> <xs:element name="Nom" type="NomType" minOccurs="0"/>
> </xs:sequence>
> <xs:attribute name="Etat" use="required">
> <xs:simpleType>
> <xs:restriction base="xs:string">
> <xs:enumeration value="Connu"/>
> <xs:enumeration value="Inconnu"/>
> </xs:restriction>
> </xs:simpleType>
> </xs:attribute>
> </xs:complexType>
> I manage to extract the name and the use of the <xs:attribute>
> But now, i want to extract this :
> <xs:simpleType>
> <xs:restriction base="xs:string">
> <xs:enumeration value="Connu"/>
> <xs:enumeration value="Inconnu"/>
> </xs:restriction>
> </xs:simpleType>
> In my programm, i use a method who take a XSDElementDeclaration in
> parameter.
> My problem is to extract my simple Type and convert it in a
> XSDSimpleTypeDefinition.
> I hope it's more clear.
> Thanks
>
>


--------------020402030103010503080300
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Alex,<br>
<br>
No, I'm still confused.
Re: getContent [message #595032 is a reply to message #59783] Tue, 26 April 2005 17:03 Go to previous message
Klaas Dellschaft is currently offline Klaas DellschaftFriend
Messages: 58
Registered: July 2009
Member
> I manage to extract the name and the use of the <xs:attribute>
> But now, i want to extract this :
> <xs:simpleType>
> <xs:restriction base="xs:string">
> <xs:enumeration value="Connu"/>
> <xs:enumeration value="Inconnu"/>
> </xs:restriction>
> </xs:simpleType>
> In my programm, i use a method who take a XSDElementDeclaration in
> parameter.
> My problem is to extract my simple Type and convert it in a
> XSDSimpleTypeDefinition.

I think there is a misunderstanding what an XSDElementDeclaration really is.
Unlike in DOM the schema elements (like simpleType, complexType, ...) aren't
all elements (or element declarations). An XSDElementDeclaration just is
something like this:

<xs:element name="foo" type="bar"/>

or

<xs:element name="foo">
<xs:complexType>
...
</xs:complexType>
</xs:element>


So if you want to extract the xs:simpleType the XSDSimpleTypeDefinition is
what you want (like Ed said). And there is no possibility to cast to an
XSDElementDeclaration.


Cheers
Klaas
Re: getContent [message #595187 is a reply to message #59829] Thu, 28 April 2005 15:16 Go to previous message
alex is currently offline alexFriend
Messages: 16
Registered: July 2009
Junior Member
Thanks for your help!
I manage to do what i want!
Previous Topic:attribute reference unresolved - must be basic answer
Next Topic:get min or max occurs
Goto Forum:
  


Current Time: Mon Dec 22 05:36:46 GMT 2014

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

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