hi everybody
i know that this problem is discussed in the FAQ, but i still don't get it to work.
I'm trying validating an XML file with an XSD schema.
The XML file looks like this:
?xml version="1.0" encoding="ISO-8859-1"?>
<Req:Request xmlns:Req="http://www.zhwin.ch/schnemac/Req"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.zhwin.ch/schnemac/Req
ReqSchema.xsd">
<Req:URI>eiblet://myEngine/LAYER_EIB_GROUP_OBJECT/bus/Lampe_switch</Req:URI>
<Req:Command>switch_on</Req:Command>
</Req:Request>
...And the Schema loooks like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.zhwin.ch/schnemac/Req" xmlns:Req="http://www.zhwin.ch/schnemac/Req">
<element name="URI" type="anyURI" />
<element name="Command" type="string" />
<element name="Request" type="Req:RequestType" /> <complexType name ="RequestType">
<sequence>
<element ref="Req:URI" minOccurs ="0" maxOccurs="1"/>
<element ref="Req:Command" minOccurs ="0" maxOccurs="1"/>
</sequence>
</complexType></schema>
When having the validation on, I get a General Schema Error with uri "http://www.zhwin.ch/schnemac/Req, not found.
I'm using the JDOM API and the xerces parser.
The Java code looks like this:
public class InputDocumentHandler{private Document doc;
private SAXBuilder builder;
private Namespace ns;
public InputDocumentHandler() {
builder = new SAXBuilder("org.apache.xerces.parsers.SAXParser", ture);
builder.setXMLFilter(new SocketFilter()); }
public void createDocument(Reader reader) throws JDOMException{
try{
doc = builder.build(reader);
System.out.println(doc.toString());
ns = doc.getRootElement().getNamespace();
}
catch(JDOMException j){
throw new JDOMException("Fehler beim Erzeugen des Documents: "+ j.getMessage());
}
}
Strange is, when I use the Validating form "Forte for Java" -Tool, it works.
In wich directory does the parser serch for the Schema? Do I have to specify the whole path like F:\path\to\ReqSchema.xsd?
Thanks for any help
Marcus Schneller
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
