facebook

XSD attribute inheritance

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #299266 Reply

    wsweet
    Member

    In the schema below what is the syntax wihin an extending type or element of an extended type, to initialize attributes defined in the base type. My attempt does not validate. Extended type can be any combination of complex/simple type content. Thanks!

    <?xml version=”1.0″ encoding=”UTF-8″?>
    <xsd:schema
    targetNamespace=”test.org”
    xmlns:xsd=”http://www.w3.org/2001/XMLSchema&#8221;
    xmlns:tst=”test.org”
    elementFormDefault=”unqualified” >

    <xsd:complexType name=”BaseType”>
    <xsd:simpleContent>
    <xsd:extension base=”xsd:string”>
    <xsd:attribute name=”BaseTypeAttribute” type=”xsd:string” use=”required” fixed=”TestValue”/>
    </xsd:extension>
    </xsd:simpleContent>
    </xsd:complexType>

    <xsd:complexType name=”ExtendedType” >

    <xsd:complexContent>

    <xsd:extension base=”tst:BaseType”>
    <xsd:attribute name=”ExtendedTypeAttribute”
    type=”xsd:string” use=”optional” />
    </xsd:extension>
    </xsd:complexContent>
    </xsd:complexType>

    <xsd:element name=”ExtendedElement” BaseTypeAttribute=”PerhapsSomeDataHere” type=”tst:ExtendedType” />

    </xsd:schema>

    #299346 Reply

    Loyal Water
    Member

    Moving to Off Topic >> Software Development.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: XSD attribute inheritance

You must be logged in to post in the forum log in