0

i am using vb.net to convert text files to schemas and not sure where to start.

my source file is a text file with multiple lines like this:

<!ELEMENT address      - -  ((street, pobox?, city, state, 
                       zip) | abc | sr+)                 >

the desired output is a text file like this:

<xs:element name="address">
<xs:complexType>
  <xs:choice>
    <xs:sequence>
      <xs:element ref="street"/>
      <xs:element ref="pobox" minOccurs="0" maxOccurs="1"/>
      <xs:element ref="city"/>
      <xs:element ref="state"/>
      <xs:element ref="zip"/>
    </xs:sequence>
    <xs:element ref="abc"/>
    <xs:element ref="sr" minOccurs="1" maxOccurs="unbounded"/>
  </xs:choice>      
</xs:complexType>

Any help would be appreciated

  • 1. Your input is not a text file, it looks like a DTD. 2. Your output is not a text file, it looks like an XSD. 3. Ain't there a free converter that already does stuff like that? 4. Such a question is much too broad here. – Thomas Weller Jan 16 '17 at 21:45
  • you are correct @ThomasWeller. My source file is a sgml dtd and my output will be xsd. I can not find a free converter so i decided to create my own using vb.net and regularexpressions to no avail. any tips? – user3618078 Jan 16 '17 at 22:50
  • http://stackoverflow.com/q/1510126/480982 – Thomas Weller Jan 16 '17 at 23:03
  • thanks. turns out that visual studio has a converter, but only works with xml dtds. – user3618078 Jan 17 '17 at 00:03
  • So now I'm curious what makes a SGML DTD special from other DTD's. How about you post the DTD so maybe we can help you get an XSD out of it. – MrGadget Jan 17 '17 at 06:04
  • @MrGadget there are many differences ref: http://xml.silmaril.ie/dtdconv.html – user3618078 Jan 17 '17 at 22:42

0 Answers0