Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

xPath :: NamespaceContext

Empfohlene Antworten

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:

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.