Hello,

 

I'm a French developer working on an eclipse plug-in. I'm trying to create
an editor which help user to create a XML file. 

To help user to create XML file my editor use the Content Assist from
eclipse. Completion proposal are given by a XSD file (or other).

 

I'm using xerces to parse this XSD file. I have a problem when I try to get
attribute from a XSElementDeclaration.

 

I'm using this code:

 

Private void attributes(XSElementDeclaration element){

                XSTypeDefinition type = element.getTypeDefinition();

XSObjectList attrs = ((XSComplexTypeDefinition)type).getAttributeUses();

For(int i = 0; I < attrs.getLength(); i++){

                XSAttributeUse attrUse = (XSAttributeUse)attrs.item(i);

XSAttributeDeclaration attr = attrUse.getAttrDeclaration() ;

 

System.out.println(attr.getName) ;

}

}

 

This code works but not exactly like I want. He prints:

Lang

Herf

Label

Tittle

.

 

I want print this : 

 

Ns3:Lang

Ns3:herf

Ns3:label

Ns3 :tittle

.

 

My XML Schema is like this :

 

<xs:attributeGroup name="att.xlink.attribute.label">

    <xs:attribute ref="ns3:label"/>

  </xs:attributeGroup>

  <xs:attributeGroup name="att.xlink.attribute.href">

    <xs:attribute ref="ns3:href"/>

  </xs:attributeGroup>

  <xs:attributeGroup name="att.xlink.attribute.type">

    <xs:attribute ref="ns3:type"/>

  </xs:attributeGroup>

  <xs:attributeGroup name="att.xlink.attribute.title">

    <xs:attribute ref="ns3:title"/>

  </xs:attributeGroup>

 

And in file ns3.xsd :

 

<?xml version="1.0" encoding="UTF-8"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
elementFormDefault="qualified"
targetNamespace="http://www.w3.org/1999/xlink";
xmlns:ns1="http://www.w3.org/ns/smil";
xmlns:mlif="http://www.iso.org/ns/MLIF";
xmlns:ns2="http://www.tei-c.org/ns/1.0";
xmlns:ns3="http://www.w3.org/1999/xlink";>

  <xs:import namespace="http://www.iso.org/ns/MLIF";
schemaLocation="MLIF.xsd"/>

  <xs:import namespace="http://www.tei-c.org/ns/1.0";
schemaLocation="ns2.xsd"/>

  <xs:import namespace="http://www.w3.org/XML/1998/namespace";
schemaLocation="xml.xsd"/>

  <xs:import namespace="http://www.w3.org/ns/smil";
schemaLocation="ns1.xsd"/>

  <xs:attribute name="label"/>

  <xs:attribute name="href"/>

  <xs:attribute name="type"/>

  <xs:attribute name="title"/>

  <xs:attribute name="from"/>

  <xs:attribute name="to"/>

</xs:schema>

 

My code print attribute's name but I want attribute's ref. How must I do to
get it? I tried but I didn't find.

Sorry for my poor English :/

 

Regards,

Vincent.

 

 

 

 

Reply via email to