Hi, I have a question: I am using xerces 2.9.0.
I have a XML-Document witch was not created by me and I am not able to load it from a file. I am getting the XML-Document Object. Now I want to validate this document against a schema. This schema might not be in the document. So I want to add the schema programmatically. How can I achieve this? Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new File("test.xml")); Schema schema = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema(new StreamSource("simpleSchema.xsd")); schema.newValidator().validate(new DOMSource(doc)); test.xml looks like this <?xml version="1.0" encoding="UTF-8"?> <persons age="0"> <name>name</name> <surname>surname</surname> </persons> But I'd like xerces to act as if it looked like the following one: <?xml version="1.0" encoding="UTF-8"?> <persons age="0" xmlns="http://sample.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://sample.com simpleSchema.xsd "> <name>name</name> <surname>surname</surname> </persons> I tried to add the xmlns, xmlns:xsi and xsi:schemaLocation attributes to the root element by code, without success... Any idea? Thanks a lot! Best wishes Bernd Kolb --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]