Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » XSD » an exact schema for children of a sequence
an exact schema for children of a sequence [message #1777628] Fri, 01 December 2017 03:54
Alex Black is currently offline Alex BlackFriend
Messages: 1
Registered: December 2017
Junior Member
I have an XML file that looks like this:

<custom_fields type="array">
   
    <custom_field>
      <name>Format</name>
      <value>Goodun</value>
      <type>text</type>
      <permission>read_only</permission>
    </custom_field>
    <custom_field>
      <name>Remark</name>
      <value />
      <type>text</type>
      <permission>read_only</permission>
    </custom_field>
    <custom_field>
      <name>Sequence Number</name>
      <value>244</value>
      <type>text</type>
      <permission>read_only</permission>
    </custom_field>
  </custom_fields>



When I create an XSD, I get
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="address here">
  <xs:element name="custom_fields">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="unbounded" name="custom_field">
          <xs:complexType>
            <xs:sequence>
              <xs:element minOccurs="0" name="name" type="xs:string" />
              <xs:element minOccurs="0" name="value" type="xs:string" />
              <xs:element minOccurs="0" name="type" type="xs:string" />
              <xs:element minOccurs="0" name="permission" type="xs:string" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="type" type="xs:string" use="optional" />
    </xs:complexType>
  </xs:element>
</xs:schema>



The problem is the schema needs to be explicit for each child node. For example, It's OK if the "remark" custom_field has no value, but not ok for the other two nodes Format and Sequence Number.

Can anyone advise how to have a schema be specific down to rach element name in a sequence?
Previous Topic:XSD2EcoreBuilder: prevent suffixes
Next Topic:Custom Attributes of ComplexType
Goto Forum:
  


Current Time: Fri Apr 26 12:14:00 GMT 2024

Powered by FUDForum. Page generated in 0.02632 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top