[xsd-users] How do you enter mixed text when creating an element?

Mark Mendell mendell at ca.ibm.com
Thu Oct 6 16:43:16 EDT 2011


If I have this xsd fragment:
<xs:complexType name="literalType" mixed="true">
  <xs:complexContent>
    <xs:extension base="expnBase">
      <xs:choice minOccurs="0">
        <xs:element name="list" type="listType"/>
....
      </xs:choice>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

I want to allow either:
<literal>5</literal>
or:
<literal>
   <list>...</list>
</literal>

I know how to handle creating the list entry, and (from a different
problem) how to read the text '5' using the DOMNode, but I can't figure out
how to create a 'literal' with just the text 5.  I would never have a
<list> and text.

Any ideas on how to create the node?  I want to do:
auto_ptr<literalType> l(new literalType);
l->setText("5");

use l

Is there a way to force a DOMText node to be created, so that I can replace
the text?

Mark Mendell

InfoSphere Streams
IBM Toronto Laboratory, 8200 Warden Ave, Markham, Ontario, Canada, L6G 1C7
Tel:  905-413-3485    Tie:  313-3485    Internet:  mendell at ca.ibm.com


More information about the xsd-users mailing list