all groups > dotnet xml > february 2006 >
You're in the

dotnet xml

group:

Is it possible to define a schema that a xml tag can contains xml or text?



Is it possible to define a schema that a xml tag can contains xml or text? davidw
2/27/2006 4:31:35 PM
dotnet xml: so xml could look like

<field>test</field>

or

<field><test>this is a test</test></field>

thanks!

Re: Is it possible to define a schema that a xml tag can contains xml or text? Martin Honnen
2/28/2006 12:00:00 AM


[quoted text, click to view]


Example for mixed contents that allows both your above examples:

<xs:element name="field" maxOccurs="unbounded">
<xs:complexType mixed="true">
<xs:sequence>
<xs:element name="test" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>

See the schema primer
<http://www.w3.org/TR/xmlschema-0/#mixedContent>
for more explanation and more examples.


--

Martin Honnen --- MVP XML
AddThis Social Bookmark Button