Hallo,
ich versuche vergeblich ein das Schema zu ermitteln, das in dem Wurzelelement meiner XML Datei festegelt wurde.
Ich habe so viele Sachen durchgeschaut, aber durch diesen Namespace bei noNamespaceSchemaLocation klappts nicht!
Hier mein Java Code:
Kann mir jemand mal sagen was ich falsch gemacht habe?
ich versuche vergeblich ein das Schema zu ermitteln, das in dem Wurzelelement meiner XML Datei festegelt wurde.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ContentText.xsd">
<values>
...
Ich habe so viele Sachen durchgeschaut, aber durch diesen Namespace bei noNamespaceSchemaLocation klappts nicht!
Hier mein Java Code:
Java:
try {
Document document = new SAXBuilder().build(xmlFile);
Element root = document.getRootElement();
System.out.print(root);
Namespace ns = Namespace.getNamespace("http://www.w3.org/2001/XMLSchema-instance");
//Namespace ns = root.getNamespace();
Attribute attr = root.getAttribute("noNamespaceSchemaLocation", ns);
if(attr != null) {
schema = root.getAttributeValue("noNamespaceSchemaLocation", ns);
return true;
}
} catch (JDOMException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
Kann mir jemand mal sagen was ich falsch gemacht habe?
