M
marcus
Hi All,
I'm new to xml world and i was looking for a way
to embed the xml schema info in the xml document
itself. i tried the following:
--- xml schema + document combined ---
<?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>
<?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">
<to>Registrar</to>
<from>Student</from>
<heading>Reminder</heading>
<body>Transcripts requested ASAP</body>
</note>
-----
is this a valid thing to do ? xerces parser will not
parse the above xml. if i put the schema in another file
and refer the xsi:schemaLocation to the xsd file, the
parsing goes fine.
any help is greatly appreciated..
//marc
I'm new to xml world and i was looking for a way
to embed the xml schema info in the xml document
itself. i tried the following:
--- xml schema + document combined ---
<?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>
<?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">
<to>Registrar</to>
<from>Student</from>
<heading>Reminder</heading>
<body>Transcripts requested ASAP</body>
</note>
-----
is this a valid thing to do ? xerces parser will not
parse the above xml. if i put the schema in another file
and refer the xsi:schemaLocation to the xsd file, the
parsing goes fine.
any help is greatly appreciated..
//marc