Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Forcing content according to attribute

From: "Papalagi Pakeha" <papalagi.pakeha@-----.--->
To: xmlschema-dev@--.---
Date: 1/24/2008 2:29:00 AM
hello,

in our xml documents we use <Attachment> tag to specify, well,
attachments to these documents. something like:

<Doc>
<Title>xyz</Title>
....
<Attachment type="logo" format="url">http://some.url/logo.jpg</Attachment>
<Attachment type="token" format="inline">U29tZVRoaW5nCg==</Attachment>
<Attachment type="data" format="filename">local.file.bin</Attachment>
</Doc>

Is there any way in XSD to enforce:
- base64 content for format="inline",
- URL content when format="url", and
- non-URL when format="filename"
?

For now I have:

  <xs:element name="Attachment">
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base="xs:string">
          <xs:attribute name="format" use="required">
            <xs:simpleType>
              <xs:restriction base="xs:string">
                <xs:enumeration value="inline"/>
                <xs:enumeration value="filename"/>
                <xs:enumeration value="url"/>
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="type" use="required">
            <xs:simpleType>
              <xs:restriction base="xs:string">
                <xs:enumeration value="logo"/>
                <xs:enumeration value="token"/>
                <xs:enumeration value="data"/>
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>

that works well but accepts any "xs:string" for content and not
enforcing URL/non-URL/base64.

can anyone throw some hints on how to achieve the link between format
and content please?

thanks!

papa


From saisuman@t... Wed Jan 23 04:55:16 2008
Received: from wiggum.w3.org ([128.30.52.23])
	by frink


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent