Hi,
I am getting compile time error as
"Can't convert java.lang.String to boolean"
for the line
 
factory.setAttribute("http://apache.org/xml/properties/schema/external-schemaLocation", "http://yourfirstnamespace.com " + "d:/directoryWhereYourSchemaIsStored/nameOfTheFirstSchema.xsd");
I am using SAXParser.
 
 
But I tried with Entity Resolver, It's working fine. 
Thank you Very Much
KumudaRajarshi
 
-------Original Message-------
 
Date: Monday, April 22, 2002 05:05:43 PM
Subject: RE: How to store Schema separately and xml separately and still v alidate the xml against the schema
 
Hi,
 
Try the following :
 
factory.setAttribute("http://apache.org/xml/properties/schema/external-schemaLocation", "http://yourfirstnamespace.com " + "d:/directoryWhereYourSchemaIsStored/nameOfTheFirstSchema.xsd");
 
factory.setAttribute("http://apache.org/xml/properties/schema/external-schemaLocation", "http://yoursecondnamespace.com " + "d:/directoryWhereYourSchemaIsStored/nameOfTheSecondSchema.xsd");
 
factory.setAttribute("http://apache.org/xml/properties/schema/external-schemaLocation", "http://yourthirdnamespace.com " + "d:/directoryWhereYourSchemaIsStored/nameOfTheThirdSchema.xsd");
 
You can as well import the second and third schema in the first one like :
 

<xs:import namespace=http://yoursecondnamespace.com schemaLocation="d:/directoryWhereYourSchemaIsStored/nameOfTheSecondSchema.xsd"/>

<xs:import namespace="http://yourthirdnamespace.com " schemaLocation="d:/directoryWhereYourSchemaIsStored/nameOfTheThirdSchema.xsd"/>

For more pointers (on name spaces for instances), you could check out www.xfront.com where there is a very good Schema tutorial.

Best regards,

R�gis


[Piccand R�gis] 
 -----Original Message-----
From: Kumuda Rajarshi [mailto:[EMAIL PROTECTED]
Sent: mardi, 22. mai 2001 12:52
To: [EMAIL PROTECTED]
Subject: RE: How to store Schema separately and xml separately and still v alidate the xml against the schema

Hello,
My question was, If my XML refers more than one schema's then how to represent those in
factory.setAttribute.
In the example u have givenonly one schema ie., "d:/directoryWhereYourSchemaIsStored/nameOfTheSchema.xsd".
But if have like that 3, then how to set the Attribute?
 
factory.setAttribute("http://apache.org/xml/properties/schema/external-schemaLocation", "http://yournamespace.com " + "d:/directoryWhereYourSchemaIsStored/nameOfTheSchema.xsd");
 
 Thank you 
-------Original Message-------
 
Date: Monday, April 22, 2002 03:51:15 PM
Subject: RE: How to store Schema separately and xml separately and still v alidate the xml against the schema
 
Well, if you know in advance which schema you want to use and you know where it is stored, here are two examples that should work on a Windows platform.
 
<root xmlns="http://www.yournamespace.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.yournamespace.com "d:/directoryWhereYourSchemaIsStored/nameOfTheSchema.xsd"">
 
or
 
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setAttribute("http://apache.org/xml/properties/schema/external-schemaLocation", "http://yournamespace.com " + "d:/directoryWhereYourSchemaIsStored/nameOfTheSchema.xsd");
 
For other platform, use a URL form like "file:/ ...."
 
R�gis

[Piccand R�gis]  -----Original Message-----
From: Kumuda Rajarshi [mailto:[EMAIL PROTECTED]
Sent: lundi, 22. avril 2002 11:58
To: [EMAIL PROTECTED]
Subject: RE: How to store Schema separately and xml separately and still v alidate the xml against the schema

 
Hello,
Thank you for your suggestion.
But If I have more than one Schema' s  Then How to write in the thePathToSchema
 
can you please provide an Example?
 
factory.setAttribute("http://apache.org/xml/properties/schema/external-schemaLocation", "http://yournamespace.com " + thePathToSchema);
 
Thank You
 -------Original Message-------
 
Date: Monday, April 22, 2002 03:18:57 PM
Subject: RE: How to store Schema separately and xml separately and still v alidate the xml against the schema
 
Hello,
 
You have to options : either enter the full path to the schema in your xml file, or set it programmatically.
 
To have the full path in the xml instance document :
 
<root xmlns="http://www.yournamespace.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.yournamespace.com file://thePathToSchema">
 
To set it programmatically :
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setAttribute("http://apache.org/xml/properties/schema/external-schemaLocation", "http://yournamespace.com " + thePathToSchema);
 
Hope this Helps,
 
R�gis
-----Original Message-----
From: Kumuda Rajarshi [mailto:[EMAIL PROTECTED]
Sent: mardi, 22. mai 2001 09:14
To: [EMAIL PROTECTED]
Subject: How to store Schema separately and xml separately and still validate the xml against the schema

Hello,
I have a directory where I am storing all my Schema's and I have another directory where I am storing my XML file. I have to store like this only.
If I do so, and If I validate, the XML, I am getting error which means that the Schema is not found.
How to validate those XML's whose schema is in separate Directory
Please do answer soon as possible.
Thanking you
KumudaRajarshi
 
 
 
 
 
 
____________________________________________________
  IncrediMail - Email has finally evolved - Click Here

Reply via email to