Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Namespace in XML schema

Status
Not open for further replies.

smithatt

Programmer
May 6, 2002
4
0
0
IN
Hi All,
I have just started working with XML. I wanted one of u to help me with an example for namespace defined in schema(xsd) and used in XML.

I am using sax parser for validating the XML doc.

I feel I am not able to make out the value to be specified in "targetNamespace."
please post the example.
thx in advance
smitha
 
In addition to specifying the 'targetNamespace' attribute in the xs:schema, our parser always insists on our also specifying 'xmlns' equal to the same value. That way it assumes all elements below are in the given namespace unless otherwise prefixed. Of course, all schema elements now require a prefix, such as 'xs'.

<xs:schema targetNamespace=&quot; xmlns=&quot; xmlns:xs=&quot; elementFormDefault=&quot;qualified&quot;>
<xs:element name=&quot;OnlyOne&quot; type=&quot;xs:string&quot;/>
</xs:schema>

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top