Package org.miaixz.bus.core.xml
Class UniversalNamespaceCache
java.lang.Object
org.miaixz.bus.core.xml.UniversalNamespaceCache
- All Implemented Interfaces:
NamespaceContext
全局命名空间上下文
见:https://www.ibm.com/developerworks/cn/xml/x-nmspccontext/
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
ConstructorsConstructorDescriptionUniversalNamespaceCache(Node node, boolean toplevelOnly) This constructor parses the document and stores all namespaces it can find. -
Method Summary
Modifier and TypeMethodDescriptiongetNamespaceURI(String prefix) This method is called by XPath.This method is not needed in this context, but can be implemented in a similar way.getPrefixes(String namespaceURI)
-
Constructor Details
-
UniversalNamespaceCache
This constructor parses the document and stores all namespaces it can find. If toplevelOnly is true, only namespaces in the root are used.- Parameters:
node- source NodetoplevelOnly- restriction of the search to enhance performance
-
-
Method Details
-
getNamespaceURI
This method is called by XPath. It returns the default namespace, if the prefix is null or "".- Specified by:
getNamespaceURIin interfaceNamespaceContext- Parameters:
prefix- to search for- Returns:
- uri
-
getPrefix
This method is not needed in this context, but can be implemented in a similar way.- Specified by:
getPrefixin interfaceNamespaceContext
-
getPrefixes
- Specified by:
getPrefixesin interfaceNamespaceContext
-