Help designing an XSD
Posted: Sun Feb 11, 2007 2:00 am
I am looking for help in creating an XSD definition for a paragraph of text with font changes in the middle. The original example is from W3Schools, but I want to highlight a word in mid-sentence.
Here is the XML:
And here is the original XSD::
My problem is trying to figure out how to define the <underline> element within the <body> element, because the <body> element already has text inside it. I'm sure it's simple, but I haven't been able to find any examples of where someone has already done this.
Thanks in advance for any help.
Alan
Here is the XML:
Code: Select all
<?xml version="1.0"?>
<note
xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com note.xsd">
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me <underline>this</underline> weekend!</body>
</note>
Code: Select all
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3schools.com"
xmlns="http://www.w3schools.com"
elementFormDefault="qualified"><xs:element name="note">
<xs:complexType>
<xs:sequence>
<xs:element name="to" type="xs:string"/>
<xs:element name="from" type="xs:string"/>
<xs:element name="heading" type="xs:string"/>
<xs:element name="body" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element></xs:schema>
Thanks in advance for any help.
Alan