tags:

views:

137

answers:

2

I need to extend an element in an XSD schema. In the original schema, the element is defined as:

   <xsd:element name="RemarkText">
      <xsd:complexType>
         <xsd:simpleContent>
            <xsd:extension base="C-Infinite">
               <xsd:attribute name="IdRef" type="IDREF" use="required"/>
            </xsd:extension>
         </xsd:simpleContent>
      </xsd:complexType>
   </xsd:element>

All the examples I have seem regarding extensions seem to deal with extending types. If this was originally defined as:

      <xsd:complexType name="RemarkText_Type">
         <xsd:simpleContent>
            <xsd:extension base="C-Infinite">
               <xsd:attribute name="IdRef" type="IDREF" use="required"/>
            </xsd:extension>
         </xsd:simpleContent>
      </xsd:complexType>
      <xsd:element name="RemarkText" type="RemarkText_Type"/>

Then, I think I would know what to do.

But is it possible to extend an element, rather than a type?

A: 

The "any" element exists to help with such issues. A nice example on how to do this can be found here.

Dillie-O
Wouldn't I need to add that to the original schema? I can't change the original schema (if I could, I probably wouldn't need to extend it).
pkaeding
Essentially what you're doing is creating a new schema that will extend the original, since you can't change it.
Dillie-O
+2  A: 
Colin
Well, that wasn't the answer I was hoping for, but thank you for writing such a complete answer (and with such pretty pictures)!
pkaeding