- #1
D
Don_Pazo
Bekanntes Mitglied
Themenersteller
- Dabei seit
- 16.09.2005
- Beiträge
- 112
- Reaktionspunkte
- 0
Hallo,
ich habe eine beispiels XML-Datei:
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):
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??? :'(
ich habe eine beispiels XML-Datei:
Code:
<?xml version=1.0 encoding=ISO-8859-1?>
<root xmlns=[url]http://www.softlab.de/2006/IOML[/url] xmlns:xsi=[url]http://www.w3.org/2001/XMLSchema-instance[/url] xsi:schemaLocation=[url]http://www.softlab.de/2006/IOML[/url] 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):
Code:
public class NamespaceContextImpl implements NamespaceContext {
public String getNamespaceURI(String prefix){
logger.info(==|> getNamespaceURI(+prefix+));
if (prefix.equals(xml))
return [url]http://www.w3.org/2001/XMLSchema-instance;[/url]
else if (prefix.equals(schemaLocation))
return [url]http://www.softlab.de/2006/IOML[/url] 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??? :'(