Package org.apache.cxf.jaxrs.ext.xml
Class XMLSource
java.lang.Object
org.apache.cxf.jaxrs.ext.xml.XMLSource
Utility class for manipulating XML response using XPath and XSLT
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of the xml:base attribute, if any.Find an attribute or text node representing an absolute or relative link and convert it to URIFind an attribute or text node representing an absolute or relative link and convert it to URIURI[]
Find attributes or text nodes representing absolute or relative links and convert them to URIs<T> T
Find the matching XML node and convert it into an instance of the provided class.<T> T
Find the matching XML node and convert it into an instance of the provided class.<T> T[]
Find the list of matching XML nodes and convert them into an array of instances of the provided class.<T> T[]
Find the list of matching XML nodes and convert them into an array of instances of the provided class.Find the attribute or simple/text nodeFind the attribute or simple/text node<T> T
Find the attribute or simple/text node and convert the string value to the instance of the provided class, example, Integer.class.String[]
Find the attributes or simple/text nodesString[]
Find the attributes or simple/text nodesvoid
Allows for multiple queries against the same stream by buffering to DOM
-
Constructor Details
-
XMLSource
-
-
Method Details
-
setBuffering
public void setBuffering()Allows for multiple queries against the same stream by buffering to DOM -
getNode
Find the matching XML node and convert it into an instance of the provided class. The default JAXB MessageBodyReader is currently used in case of non-primitive types.- Parameters:
expression
- XPath expressioncls
- class of the node- Returns:
- the instance representing the matching node
-
getNode
Find the matching XML node and convert it into an instance of the provided class. The default JAXB MessageBodyReader is currently used in case of non-primitive types.- Parameters:
expression
- XPath expressionnamespaces
- the namespaces map, prefixes which are used in the XPath expression are the keys, namespace URIs are the values; note, the prefixes do not have to match the actual ones used in the XML instance.cls
- class of the node- Returns:
- the instance representing the matching node
-
getNodes
Find the list of matching XML nodes and convert them into an array of instances of the provided class. The default JAXB MessageBodyReader is currently used in case of non-primitive types.- Parameters:
expression
- XPath expressioncls
- class of the node- Returns:
- the array of instances representing the matching nodes
-
getNodes
Find the list of matching XML nodes and convert them into an array of instances of the provided class. The default JAXB MessageBodyReader is currently used in case of non-primitive types.- Parameters:
expression
- XPath expressionnamespaces
- the namespaces map, prefixes which are used in the XPath expression are the keys, namespace URIs are the values; note, the prefixes do not have to match the actual ones used in the XML instance.cls
- class of the node- Returns:
- the array of instances representing the matching nodes
-
getLink
Find an attribute or text node representing an absolute or relative link and convert it to URI- Parameters:
expression
- the XPath expression- Returns:
- the link
-
getLink
Find an attribute or text node representing an absolute or relative link and convert it to URI- Parameters:
expression
- the XPath expressionnamespaces
- the namespaces map, prefixes which are used in the XPath expression are the keys, namespace URIs are the values; note, the prefixes do not have to match the actual ones used in the XML instance.- Returns:
- the link
-
getLinks
Find attributes or text nodes representing absolute or relative links and convert them to URIs- Parameters:
expression
- the XPath expressionnamespaces
- the namespaces map, prefixes which are used in the XPath expression are the keys, namespace URIs are the values; note, the prefixes do not have to match the actual ones used in the XML instance.- Returns:
- the links
-
getBaseURI
Returns the value of the xml:base attribute, if any. This can be used to calculate an absolute URI provided the links in the actual XML instance are relative.- Returns:
- the xml:base value
-
getValue
Find the attribute or simple/text node- Parameters:
expression
- the XPath expression- Returns:
- the value of the matching node
-
getValue
Find the attribute or simple/text node- Parameters:
expression
- the XPath expressionnamespaces
- the namespaces map, prefixes which are used in the XPath expression are the keys, namespace URIs are the values; note, the prefixes do not have to match the actual ones used in the XML instance.- Returns:
- the value of the matching node
-
getValues
Find the attributes or simple/text nodes- Parameters:
expression
- the XPath expression- Returns:
- the values of the matching nodes
-
getValues
Find the attributes or simple/text nodes- Parameters:
expression
- the XPath expressionnamespaces
- the namespaces map, prefixes which are used in the XPath expression are the keys, namespace URIs are the values; note, the prefixes do not have to match the actual ones used in the XML instance.- Returns:
- the values of the matching nodes
-
getValue
Find the attribute or simple/text node and convert the string value to the instance of the provided class, example, Integer.class.- Parameters:
expression
- the XPath expressionnamespaces
- the namespaces map, prefixes which are used in the XPath expression are the keys, namespace URIs are the values; note, the prefixes do not have to match the actual ones used in the XML instance.cls
- the class of the response- Returns:
- the value
-