Book a Demo

Author Topic: Generating XSD with custom attribute  (Read 13903 times)

CUrquhart

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Generating XSD with custom attribute
« on: July 17, 2013, 07:42:30 pm »
We are having to use EA to model our XSDs. But our XSDs have additional annotations for DFDL (a XSL based language). The problem is how we can add these annotations in EA so when we generate the XSD they are generated correctly.

An example of DFDL schema:

Code: [Select]
<xs:schema xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" xmlns:xs="http://www.w3.org/2001/XMLSchema" ...>
 
<xs:complexType name="person_type">
  <xs:sequence dfdl:encoding="ASCII" dfdl:sequenceKind="ordered"
               dfdl:separator="," dfdl:separatorType="infix" dfdl:separatorPolicy="required">
    <xs:element name="name" type="xs:string"
                dfdl:lengthKind="delimited" dfdl:encoding="ASCII"/>                  
    <xs:element name="age" type="xs:short"
                dfdl:representation="text" dfdl:lengthKind="delimited" dfdl:encoding="ASCII"
                dfdl:textNumberRep="standard" dfdl:textNumberPattern="##0" dfdl:textNumberBase="10"/>                  
    <xs:element name="county" type="xs:string"
                dfdl:lengthKind="delimited" dfdl:encoding="ASCII"/>                  
    <xs:element name="country" type="xs:string"
                dfdl:lengthKind="delimited" dfdl:encoding="ASCII"/>                  
  </xs:sequence>
</xs:complexType>
 
</xs:schema>

So it's just dfdl attributes but I can't see how to do this within EA. I have a feeling it can be done with a UML Profile but I'm not sure what is required.

Can anyone advise?      

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Generating XSD with custom attribute
« Reply #1 on: July 17, 2013, 08:25:03 pm »
Mapping XSD to UML requires a number of constraints. There are a few articles in the net where these constraints are described. There is no standard for it though. And thus EA implements its own standard. If it does not fit you have to do what I did: write your own XSD im-/exporter.

q.

CUrquhart

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Generating XSD with custom attribute
« Reply #2 on: July 17, 2013, 10:33:17 pm »
When you say you wrote your own XSD im/exporter, do you mean a separate application or some sort of plugin for EA?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Generating XSD with custom attribute
« Reply #3 on: July 17, 2013, 11:27:07 pm »
There's no big difference between both. It worked as add-in as well as stand-alone app.

q.

CUrquhart

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Generating XSD with custom attribute
« Reply #4 on: July 18, 2013, 06:48:27 pm »
Whilst we're on the subject, do you know how I can get EA to generate a restriction for a string field's length? i.e:

Code: [Select]
<xs:element name="personName" nillable="true">
                              <xs:simpleType>
                                    <xs:restriction base="xs:string">
                                          <xs:maxLength value="10"/>
                                    </xs:restriction>
                              </xs:simpleType>
</xs:element>

I've tried different things but see a way to graphically model an element with a max length. It may be extremely obvious but it's hiding from me.

Thanks
« Last Edit: July 18, 2013, 06:48:54 pm by CUrquhart »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Generating XSD with custom attribute
« Reply #5 on: July 18, 2013, 07:06:44 pm »
Try to import the XSD. Then export it. If anything is gone, EA does not support it. Else you have chances to find the info in tagged values.

q.