Don_Pazo Geschrieben 30. August 2007 Geschrieben 30. August 2007 Hallo, ich habe eine beispiels XML-Datei: <?xml version="1.0" encoding="ISO-8859-1"?> <root xmlns="http://www.softlab.de/2006/IOML" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.softlab.de/2006/IOML ioml_iocmd.xsd" > <command> <title>Command-Test Nr.1</title> <datum>2007.08.28</datum> <a_1>1</a_1> <a_2>11</a_2> </command> </root> um diese Datei zu evaluate() muss ich das Interface NamespaceContext implementieren (wegen xmlns="http://www.softlab.de/2006/IOML" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.softlab.de/2006/IOML ioml_iocmd.xsd"): public class NamespaceContextImpl implements NamespaceContext { public String getNamespaceURI(String prefix){ logger.info("==|> getNamespaceURI("+prefix+")"); if (prefix.equals("xml")) return "http://www.w3.org/2001/XMLSchema-instance"; else if (prefix.equals("schemaLocation")) return "http://www.softlab.de/2006/IOML ioml_iocmd.xsd"; else return XMLConstants.DEFAULT_NS_PREFIX; } // This method isn't necessary for XPath processing. public String getPrefix(String uri) { throw new UnsupportedOperationException(); } // This method isn't necessary for XPath processing either. public Iterator getPrefixes(String uri) { throw new UnsupportedOperationException(); } } Das Problem ist wenn ich in der XML-Datei in dem root-Tag das (xmlns="http://www.softlab.de/2006/IOML" ) weglasse bekommen ein Ergebniss, wenn ich aber das (xmlns="http://www.softlab.de/2006/IOML" ) in dem root-Tag einfühge habe ich plötzlich kein Ergebniss mehr !?!? xPath: //command/a_1/text() Weist vielleicht jemad woran es liegen könnte??? :confused:
Empfohlene Beiträge
Erstelle ein Benutzerkonto oder melde Dich an, um zu kommentieren
Du musst ein Benutzerkonto haben, um einen Kommentar verfassen zu können
Benutzerkonto erstellen
Neues Benutzerkonto für unsere Community erstellen. Es ist einfach!
Neues Benutzerkonto erstellenAnmelden
Du hast bereits ein Benutzerkonto? Melde Dich hier an.
Jetzt anmelden