de.innovationgate.wga.server.api
public class Xml extends Object
Modifier and Type | Method and Description |
---|---|
org.dom4j.Document |
create()
Creates a new empty DOM document
|
org.dom4j.Document |
load(org.apache.commons.httpclient.HttpClient client,
String url)
Loads an XML document from a URL and parses it as DOM document
|
org.dom4j.Document |
load(String url)
Loads an XML document from a URL and parses it as DOM document
|
org.dom4j.Document |
parse(String xml)
Parses XML text and returns a DOM document object for it
|
org.dom4j.Document |
parse(String xml,
String systemId)
Parses XML text and returns a DOM document object for it
|
Object |
xpath(Object object,
String xpath)
Executes an XPath expression on some XML text or JavaBean
This function always returns single values.
|
Object |
xpath(Object object,
String xpath,
Map<String,String> ns)
Executes an XPath expression on some XML text or JavaBean
This function always returns single values.
|
Object |
xpathList(Object object,
String xpath)
Executes an XPath expression on some XML text or JavaBean
This function always returns lists.
|
Object |
xpathList(Object object,
String xpath,
Map<String,String> ns)
Executes an XPath expression on some XML text or JavaBean
This function always returns lists.
|
public org.dom4j.Document create() throws de.innovationgate.webgate.api.WGException
de.innovationgate.webgate.api.WGException
public org.dom4j.Document parse(String xml, String systemId) throws de.innovationgate.webgate.api.WGException, org.dom4j.DocumentException
xml
- The xmlsystemId
- An URL which should be used to resolve relative references in the XML text, like a DOCTYPE reference.org.dom4j.DocumentException
de.innovationgate.webgate.api.WGException
public org.dom4j.Document parse(String xml) throws de.innovationgate.webgate.api.WGException, org.dom4j.DocumentException
xml
- The xmlorg.dom4j.DocumentException
de.innovationgate.webgate.api.WGException
public Object xpath(Object object, String xpath) throws de.innovationgate.webgate.api.WGException, org.dom4j.DocumentException
xpathList(Object, String)
.
The given object to parse as XML is either a dom4j branch object (mostly document or element), a String containing XML text or a JavaBean. In the last case this function uses JXPath functionality to find a bean property value.
This uses the Apache library JXPath under the hood. See their documentation for details how XPath is used to browser JavaBeans.object
- Object to inspectxpath
- XPath expressionorg.dom4j.DocumentException
de.innovationgate.webgate.api.WGException
public Object xpath(Object object, String xpath, Map<String,String> ns) throws de.innovationgate.webgate.api.WGException, org.dom4j.DocumentException
xpathList(Object, String)
.
The given object to parse as XML is either a dom4j branch object (mostly document or element), a String containing XML text or a JavaBean. In the last case this function uses JXPath functionality to find a bean property value.
This uses the Apache library JXPath under the hood. See their documentation for details how XPath is used to browser JavaBeans.object
- Object to inspectxpath
- XPath expressionns
- Map of namespace prefix declarations used in the XPath. Keys are prefixes, values are namespace URIs.org.dom4j.DocumentException
de.innovationgate.webgate.api.WGException
public Object xpathList(Object object, String xpath) throws de.innovationgate.webgate.api.WGException, org.dom4j.DocumentException
object
- Object to inspectxpath
- XPath expressionorg.dom4j.DocumentException
de.innovationgate.webgate.api.WGException
public Object xpathList(Object object, String xpath, Map<String,String> ns) throws de.innovationgate.webgate.api.WGException, org.dom4j.DocumentException
object
- Object to inspectxpath
- XPath expressionns
- Map of namespace prefix declarations used in the XPath. Keys are prefixes, values are namespace URIs.org.dom4j.DocumentException
de.innovationgate.webgate.api.WGException
public org.dom4j.Document load(String url) throws de.innovationgate.webgate.api.WGException, UnsupportedEncodingException, IOException, org.apache.commons.httpclient.HttpException, SAXException, org.dom4j.DocumentException
url
- URL to the XML documentUnsupportedEncodingException
de.innovationgate.webgate.api.WGAPIException
IOException
org.apache.commons.httpclient.HttpException
SAXException
org.dom4j.DocumentException
de.innovationgate.webgate.api.WGException
public org.dom4j.Document load(org.apache.commons.httpclient.HttpClient client, String url) throws UnsupportedEncodingException, de.innovationgate.webgate.api.WGException, IOException, org.apache.commons.httpclient.HttpException, SAXException, org.dom4j.DocumentException
client
- HTTP client object to load the resource on the URL, used to specify various settings regarding this operation. If no client object is passed a default one is used.url
- URL to the XML documentUnsupportedEncodingException
de.innovationgate.webgate.api.WGAPIException
IOException
org.apache.commons.httpclient.HttpException
SAXException
org.dom4j.DocumentException
de.innovationgate.webgate.api.WGException