June 2008
Intermediate to advanced
986 pages
27h 8m
English
To create an element that’s actually useful, we’ll want
to let it contain something. We’ll start by simply creating an element
whose type is xs:string:
<?xml version="1.0" encoding="UTF-8"?> <!-- content1.xsd --> <xs:schema xmlns="http://www.oreilly.com/xslt" targetNamespace="http://www.oreilly.com/xslt" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="content1" type="xs:string"/> </xs:schema>
Notice that we didn’t use <xs:complexType> this time. We simply
said our element was a string. Here’s a valid document for this
schema:
<?xml version="1.0" encoding="utf-8"?> <!-- content1.xml --> <content1 xmlns="http://www.oreilly.com/xslt" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.oreilly.com/xslt content1.xsd"> Our element now contains some text! It’s getting more useful all the time. </content1>
Read now
Unlock full access