Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

XML Schema

Name: Anonymous 2008-10-30 21:27

Is there a way to specify in a schema that I want the content of an element and/or an attribute to contain at least once occurrence of a value?

For example. I require that at least 1 table have an id of "ThisIsATable". The document is an XHTML file. The schema element for table needs to have an id attribute for this restriction that applies to any 1 table element and not all of them.

Name: Anonymous 2008-10-30 21:36

Yes

Name: Anonymous 2008-10-30 21:36

No

Name: Anonymous 2008-10-30 21:38

Maybe

Name: Anonymous 2008-10-30 21:40

I don't know.  Could you repeat the question?

Name: Anonymous 2008-10-30 22:09

You're not the boss of me.

Name: Anonymous 2008-10-30 22:15

I love that show.
Cdrs in the middle.

Name: Anonymous 2008-10-30 22:33

>>1
I'm pretty sure it's impossible. The only way I could think of doing it would be something like this:
<xsd:all>
  <!-- table with the `id' attribute set to ThisIsATable -->
  <xsd:element name="table" minOccurs="1" maxOccurs="unbounded">
    <xsd:complexType>
      <xsd:simpleContent>
        <xsd:attribute name="id">
          <xsd:restriction base="xsd:string">
            <xsd:enumeration value="ThisIsATable"/>
          </xsd:restriction>
        </xsd:attribute>
      </xsd:simpleContent>
    </xsd:complexType>
  </xsd:element>

  <!-- Regular table -->
  <xsd:element name="table" minOccurs="0" maxOccurs="unbounded">
    <!-- whatever -->
  </xsd:element>
</xsd:all>


But that's not legal XML Schema, because
(a) it has a naming conflict
(b) you're not allowed to have maxOccurs="unbounded" within an xsd:all.

You could give up and write a real parser to validate this type of document, or you could try Schematron and see if it sucks less. XML Schema is a committee-designed pile of pig dicks.

Name: Anonymous 2011-01-31 19:56

<-- check em dubz

Name: Anonymous 2013-01-18 22:25

/prog/ will be spammed continuously until further notice. we apologize for any inconvenience this may cause.

Don't change these.
Name: Email:
Entire Thread Thread List