Hi Michael,
  Thanks for your reply and letting me know the correct property name.

But I am still not able to achieve what I want to do.

As per your suggestion I modified the Java program as below:

[1]
parser.parse(new File(filename), this);
String schmLocation = (String)
parser.getProperty("http://java.sun.com/xml/jaxp/properties/schemaSource";);
System.out.println(schmLocation);

But I get the output:
null

(the exception now doesn't come)

It seems, Xerces doesn't set this property by taking input from the
XML document's hint (i.e., xsi:noNamespaceSchemaLocation).

But when I change the program to (and remove the hint,
xsi:noNamespaceSchemaLocation from the XML document):

[1]
parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource";,
"schemaFileName.xsd");
parser.parse(new File(filename), this);
String schmLocation = (String)
parser.getProperty("http://java.sun.com/xml/jaxp/properties/schemaSource";);
System.out.println(schmLocation);

I get the output:
schemaFileName.xsd

and the document also get's validated properly.

But I need to achieve what is written in code fragment, [1]. i.e., I
want to supply the Schema file hint (i.e.,
xsi:noNamespaceSchemaLocation) in the XML document, and retrieved the
Schema URI from the Java parsing program.

Could you kindly suggest, how this can be achieved with Xerces.

On Mon, Jun 16, 2008 at 9:14 PM, Michael Glavassevich
<[EMAIL PROTECTED]> wrote:
> Hi Mukul,
>
> The property name you're querying is incorrect. It should be
> "http://java.sun.com/xml/jaxp/properties/schemaSource"; not
> "http://java.sun.com/xml/properties/jaxp/schemaSource";.
>
> Thanks.
>
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: [EMAIL PROTECTED]
> E-mail: [EMAIL PROTECTED]


-- 
Regards,
Mukul Gandhi

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

Reply via email to