| getContent [message #59642] | 
Tue, 26 April 2005 06:32   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
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 #594964 is a reply to message #59642] | 
Tue, 26 April 2005 06:43   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
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 08:03   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
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 11:27   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
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 11:56   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
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 12:10   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
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 13:03   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
> 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
 |  
 |  
  | 
 | 
Powered by 
FUDForum. Page generated in 0.27504 seconds