Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old February 28th, 2006, 12:45 AM
davidw
Guest
 
Posts: n/a
Default Is it possible to define a schema that a xml tag can contains xml or text?

so xml could look like

<field>test</field>

or

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

thanks!


  #2  
Old February 28th, 2006, 12:25 PM
Martin Honnen
Guest
 
Posts: n/a
Default Re: Is it possible to define a schema that a xml tag can containsxml or text?



davidw wrote:
[color=blue]
> so xml could look like
>
> <field>test</field>
>
> or
>
> <field><test>this is a test</test></field>[/color]


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
http://JavaScript.FAQTs.com/
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles