Hi,

Qualified names such as element and attribute names are identified by
both their localname (the name after the prefix) and their namespace name.
By adding 'xsi' as a prefix to an element or attribute you are binding it
to the schema instance namespace
(http://www.w3.org/2001/XMLSchema-instance) [1] which I'm sure isn't what
you've intended. Without a prefix these names have no namespace and since
your schema document has no target namespace (assuming your instance
document conforms to the grammar in your schema) your XML instance will be
valid.

Hope that helps.

[1] http://www.w3.org/TR/xmlschema-1/#Instance_Document_Constructions

On Thu, 26 Feb 2004, purushotham wrote:

> All,
>
> I am validating a xml document against schema using DOM parser. When I prefix 
> the elements in instance document with namespace prefix I am getting
> 'cvc-elt.1 Cannot find the element xsi:ipos' error
>
> when I remove the prefix xsi: from the XML instance I don't get this error. 
> can anyone let me know why I see this behavior.
>
> Below is the XML instance and the java program I used to validate the xml
>
> <?xml version="1.0" ?>
> <xsi:ipos xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
> xsi:noNamespaceSchemaLocation="substitute.xsd">
>  <xsi:ipo company_name="Petronet">
>    <xsi:open_date>1 March 2003</xsi:open_date>
>    <xsi:close_date>7 March 2003</xsi:close_date>
>    <xsi:rate>15</xsi:rate>
>  </xsi:ipo>
>  <xsi:ipo company_name="GAIL">
>    <xsi:open_date>1 March 2003</xsi:open_date>
>    <xsi:close_date>7 March 2003</xsi:close_date>
>    <xsi:rate>187</xsi:rate>
>  </xsi:ipo>
> </xsi:ipos>
>
>
> Java code
> =======
>
>   DOMParser dom = new DOMParser();
>   dom.setFeature("http://xml.org/sax/features/validation",true);
>   dom.setFeature("http://apache.org/xml/features/validation/schema",true);
>   
> dom.setFeature("http://apache.org/xml/features/validation/schema-full-checking",true);
>         
> dom.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",args[1]);
>   dom.parse(args[0]);
>
>
> Regards
> Purushotham
>
>
>
>
> ---------------------------------
> Do you Yahoo!?
> Get better spam protection with Yahoo! Mail

---------------------------
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [EMAIL PROTECTED]
E-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to