Package org.ow2.authzforce.core.pdp.api
Class XmlUtils.SAXBasedXmlnsFilteringParser
- java.lang.Object
-
- org.ow2.authzforce.core.pdp.api.XmlUtils.SAXBasedXmlnsFilteringParser
-
- All Implemented Interfaces:
XmlUtils.XmlnsFilteringParser
- Enclosing class:
- XmlUtils
public static final class XmlUtils.SAXBasedXmlnsFilteringParser extends Object implements XmlUtils.XmlnsFilteringParser
SAX-based namespace-filtering XML-to-JAXB parser.
-
-
Constructor Summary
Constructors Constructor Description SAXBasedXmlnsFilteringParser(javax.xml.bind.Unmarshaller unmarshaller)
Creates instance from JAXB unmarshaller used for parsing XML documentsSAXBasedXmlnsFilteringParser(javax.xml.bind.Unmarshaller unmarshaller, Map<String,String> xmlnsPrefixToUriMap)
Creates instance from JAXB unmarshaller used for parsing XML documents using default namespace prefix-to-URI mappings
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.common.collect.ImmutableMap<String,String>
getNamespacePrefixUriMap()
Provides namespace prefix-URI mappings found during last call toXmlUtils.XmlnsFilteringParser.parse(InputSource)
, if namespace prefix-URI collecting is supported.Object
parse(URL url)
Unmarshal XML data from the specified URL and return the resulting content tree.Object
parse(InputSource input)
Unmarshal XML data from the specified SAX InputSource and return the resulting content tree.
-
-
-
Constructor Detail
-
SAXBasedXmlnsFilteringParser
public SAXBasedXmlnsFilteringParser(javax.xml.bind.Unmarshaller unmarshaller, Map<String,String> xmlnsPrefixToUriMap)
Creates instance from JAXB unmarshaller used for parsing XML documents using default namespace prefix-to-URI mappings- Parameters:
unmarshaller
- JAXB unmarshallerxmlnsPrefixToUriMap
- optional (possibly empty) XML namespace prefix-to-URI map, used for example when one needs to reuse namespace prefix/URIs previously retrieved through another XML parser interface, but needs to wrap it under the sameXmlUtils.XmlnsFilteringParser
interface for later purposes.
-
SAXBasedXmlnsFilteringParser
public SAXBasedXmlnsFilteringParser(javax.xml.bind.Unmarshaller unmarshaller)
Creates instance from JAXB unmarshaller used for parsing XML documents- Parameters:
unmarshaller
- JAXB unmarshaller
-
-
Method Detail
-
parse
public Object parse(InputSource input) throws javax.xml.bind.JAXBException
Description copied from interface:XmlUtils.XmlnsFilteringParser
Unmarshal XML data from the specified SAX InputSource and return the resulting content tree.- Specified by:
parse
in interfaceXmlUtils.XmlnsFilteringParser
- Parameters:
input
- the input source to unmarshal XML data from- Returns:
- the newly created root object of the java content tree
- Throws:
javax.xml.bind.JAXBException
- If any unexpected errors occur while unmarshalling
-
parse
public Object parse(URL url) throws javax.xml.bind.JAXBException
Description copied from interface:XmlUtils.XmlnsFilteringParser
Unmarshal XML data from the specified URL and return the resulting content tree.- Specified by:
parse
in interfaceXmlUtils.XmlnsFilteringParser
- Parameters:
url
- the URL to unmarshal XML data from- Returns:
- the newly created root object of the java content tree
- Throws:
javax.xml.bind.JAXBException
- If any unexpected errors occur while unmarshalling
-
getNamespacePrefixUriMap
public com.google.common.collect.ImmutableMap<String,String> getNamespacePrefixUriMap()
Description copied from interface:XmlUtils.XmlnsFilteringParser
Provides namespace prefix-URI mappings found during last call toXmlUtils.XmlnsFilteringParser.parse(InputSource)
, if namespace prefix-URI collecting is supported. Such mappings may then be used for namespace-aware XPath evaluation (e.g. XACML xpathExpression values)- Specified by:
getNamespacePrefixUriMap
in interfaceXmlUtils.XmlnsFilteringParser
- Returns:
- namespace prefix-URI mappings; empty if
XmlUtils.XmlnsFilteringParser.parse(InputSource)
not called yet, or namespace prefix-URI collecting is not supported
-
-