Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old February 21st, 2006, 07:05 AM
fedro
Guest
 
Posts: n/a
Default XSD: and Labels

Dear Group,

on an existing project, i found this:

<docDefinition id="1">
<tagDefinition id="2" label="Bild" tagName="..

....

Now that look very like XSD and i like to do so, but i haven't found an
attribute in definitions fpr the "label" attribute here.

Any suggestions?

Thanks in advance,
Dominik

  #2  
Old February 21st, 2006, 08:55 AM
George Bina
Guest
 
Posts: n/a
Default Re: XSD: and Labels

Hi Dominik,

That does not look like XSD.
You may wish to add mode details and eventual samples of what you are
looking for as I do not understand much from your post.

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

  #3  
Old February 21st, 2006, 12:15 PM
fedro
Guest
 
Posts: n/a
Default Re: XSD: and Labels

i wanted to transform this XML-Structure to XSD.

OLD:
<docDefinition id="1">
<tagDefinition id="2" label="Bild" tagName="bild">
<attribute id="3" label="Ausrichtung" name="ausrichtung"
type="choice">
<value id="4" label="Links fließend">links</value>
<value id="5" label="Rechts fließend">rechts</value>
<value id="6" label="mittig">mitte</value>
</attribute>
</tagDefinition>
</docDefinition>


I started like this:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="bild" id="2" >
<xsd:complexType/>
</xsd:element>
</xsd:schema>

So i can "translate" the old tag ("tagDefinition") into xsd:element
with attribute "name". BUT this tag also got an attribute called
label="Bild".

Now i'm looking for the best way to tell the element, that it has got a
label. I tried with <xsd:annotation/>, but that look very dirty
and so i'm asking the group for best practices...

  #4  
Old February 21st, 2006, 07:45 PM
George Bina
Guest
 
Posts: n/a
Default Re: XSD: and Labels

Hi Dominik,

There are tools that provided with a set of XML documents (one or more)
will be able to generate a schema for you. Then you can just adjust
that schema as you like. One such tool is TRANG that is also integrated
through a GUI in oXygen:
http://www.thaiopensource.com/relaxng/trang.html

For instance on your sample file it gives the following XML Schema:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="docDefinition">
<xs:complexType>
<xs:sequence>
<xs:element ref="tagDefinition"/>
</xs:sequence>
<xs:attribute name="id" use="required" type="xs:integer"/>
</xs:complexType>
</xs:element>
<xs:element name="tagDefinition">
<xs:complexType>
<xs:sequence>
<xs:element ref="attribute"/>
</xs:sequence>
<xs:attribute name="id" use="required" type="xs:integer"/>
<xs:attribute name="label" use="required" type="xs:NCName"/>
<xs:attribute name="tagName" use="required" type="xs:NCName"/>
</xs:complexType>
</xs:element>
<xs:element name="attribute">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="value"/>
</xs:sequence>
<xs:attribute name="id" use="required" type="xs:integer"/>
<xs:attribute name="label" use="required" type="xs:NCName"/>
<xs:attribute name="name" use="required" type="xs:NCName"/>
<xs:attribute name="type" use="required" type="xs:NCName"/>
</xs:complexType>
</xs:element>
<xs:element name="value">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:NCName">
<xs:attribute name="id" use="required" type="xs:integer"/>
<xs:attribute name="label" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:schema>

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

  #5  
Old February 22nd, 2006, 06:25 AM
fedro
Guest
 
Posts: n/a
Default Re: XSD: and Labels

Thanks George, that's a nice tool. I used it for the XML-Document and
so i can skip that <docDefinition/> Part.

The problem with "labeling" (thats needed for the user-interface) i
solved as follows:

<xsd:element name="docDefinition">

<!--manual insert start-->
<xsd:annotation>
<xsd:appinfo>
<label name="DataStructure"/>
</xsd:appinfo>
</xsd:annotation>
<!--manual insert stop-->

<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" ref="tagDefinition"/>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:integer" use="required"/>
</xsd:complexType>
</xsd:element>




Cheers, Dominik

 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles