xmlet / XsdParser

A Parser that parses a XSD file into a Java Structure.
MIT License
80 stars 34 forks source link

Embedded simple types fails #35

Closed vortex314 closed 2 years ago

vortex314 commented 2 years ago
  <xs:simpleType name="Max35Text">
    <xs:restriction base="xs:string">
      <xs:minLength value="1"/>
      <xs:maxLength value="35"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="Max35Text_CH_camt052">
    <xs:restriction base="Max35Text">
      <xs:minLength value="1"/>
      <xs:maxLength value="35"/>
      <xs:pattern value="[A-Za-z0-9+?/:()\.,&apos;\-]*"/>
    </xs:restriction>
  </xs:simpleType>

what I try :

def simpleToType(xsdSimpleType: XsdSimpleType): String = {
    val base = xsdSimpleType.getRestriction.getBase
    if ( base.startsWith("xs:")) base
    else {
      println(xsdSimpleType.getName+" from base "+xsdSimpleType.getRestriction.getBase)
      println(xsdSimpleType.getRestriction.getSimpleType)
      xsdSimpleType.getRestriction.getSimpleType.getRestriction.getBase
    }

Output :

Max35Text_CH_pacs028 from base Max35Text
null
lcduarte commented 2 years ago

Answered in Issue 34.