xsd

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • timothy-tim@lycos.com

    #1

    xsd

    I am fairly new to XSD so I assume this is probably a FAQ.

    I have a Complex Type say "Foo" which is present as child element of
    many xs:element.

    In just one of these elements Bar, I want Foo to have additional
    attributes/Facets

    for example in the schema below
    <xs:complexTy pe name="Bar">
    <xs:sequence>
    <xs:element name="Foo" type="Foo" maxOccurs="unbo unded"
    minOccurs="0">
    </xs:element>
    </xs:sequence>
    </xs:complexType>

    I want Foo to have an additional attirubtute called IsTrue="xs:Bool ean"


    How do I achive this? Do I have to declare a new type for this?

    -Tim

  • George Bina

    #2
    Re: xsd

    Hi,

    Yes, you need to declare a new type that will extend Foo and will add
    the attribute that you want. You can do that either with a local type
    declaration like

    <xs:element name="Foo" maxOccurs="unbo unded" minOccurs="0">
    <xs:complexType >
    <xs:extension base="Foo">
    <xs:attribute name="isTrue" type="xs:boolea n"/>
    </xs:extension>
    </xs:complexType>
    </xs:element>

    or by defining a new named type and refer to that instead of Foo.

    Best Regards,
    George
    ---------------------------------------------------------------------
    George Cristian Bina
    <oXygen/XML Editor, Schema Editor and XSLT Editor/Debugger


    timothy-tim@lycos.com wrote:
    I am fairly new to XSD so I assume this is probably a FAQ.
    >
    I have a Complex Type say "Foo" which is present as child element of
    many xs:element.
    >
    In just one of these elements Bar, I want Foo to have additional
    attributes/Facets
    >
    for example in the schema below
    <xs:complexTy pe name="Bar">
    <xs:sequence>
    <xs:element name="Foo" type="Foo" maxOccurs="unbo unded"
    minOccurs="0">
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    >
    I want Foo to have an additional attirubtute called IsTrue="xs:Bool ean"
    >
    >
    How do I achive this? Do I have to declare a new type for this?
    >
    -Tim

    Comment

    Working...