public class XMLTools
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.util.Comparator<javax.xml.namespace.QName> |
QNameComparatorINSTANCE
The Q name comparator instance.
|
| Constructor and Description |
|---|
XMLTools() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addChildElementImpl(net.sf.saxon.tree.linked.ElementImpl tableModel,
net.sf.saxon.tree.linked.ElementImpl tableSet)
Adds the child element impl.
|
static net.sf.saxon.tree.linked.ElementImpl |
createElementNode(net.sf.saxon.om.NamePool np,
java.lang.String prefix,
java.lang.String namespace,
java.lang.String localname)
Creates the element node.
|
static net.sf.saxon.om.MutableNodeInfo |
createTextNode(net.sf.saxon.Configuration conf,
java.lang.String value)
Creates the text node.
|
static boolean |
effectiveBooleanValue(net.sf.saxon.value.AtomicValue atVal)
Effective boolean value.
|
static java.lang.String |
getNamespaceURIforPrefix(java.lang.String pfx,
net.sf.saxon.s9api.XdmNode node)
Gets the namespace ur ifor prefix.
|
static javax.xml.namespace.QName |
javaxQName(net.sf.saxon.s9api.QName qname)
Creates a new javax QName from a saxon QName.
|
static javax.xml.namespace.QName |
javaxQName(net.sf.saxon.value.QNameValue qname)
Creates a new javax QName from a saxon QName.
|
static javax.xml.namespace.QName |
javaxQName(java.lang.String value,
net.sf.saxon.s9api.XdmNode node)
Constructs a QName using the lexical representation in the value argument and
namespaces defined at node.
|
static javax.xml.namespace.QName |
javaxQName(net.sf.saxon.om.StructuredQName qname)
Javax q name.
|
static javax.xml.namespace.QName |
javaxQName(net.sf.saxon.s9api.XdmNode node)
Constructs a QName from an attribute XdmNode or an element that is well known
to have a QName content.
|
static java.lang.String |
jClark(javax.xml.namespace.QName q)
This should be the same as QName.toString() but we may want to implement
this consistently for other QNames too so we have own own implementation
|
static void |
jdomCreateAttributeNode(org.jdom.Element el,
java.lang.String attributeName,
javax.xml.namespace.QName value)
Jdom create attribute node.
|
static java.lang.Object |
jdomNode(net.sf.saxon.s9api.XdmNode node)
Jdom node.
|
static java.util.Collection<?> |
jdomNodeSet(net.sf.saxon.s9api.XdmSequenceIterator iter)
Jdom node set.
|
static java.util.Collection<?> |
jdomNodeSet(net.sf.saxon.s9api.XdmValue descriptionNodes)
Jdom node set.
|
static javax.xml.namespace.QName |
qnameFromJClark(java.lang.String clarkQName)
builds back a QName instance from the jClark representation.
|
static java.lang.String |
qnameToString(javax.xml.namespace.QName q)
Serializes the QName as a string using the prefix:localName
if prefix is not defined then this method uses {namespace}:localName
.
|
static java.lang.String |
qnameToString2(javax.xml.namespace.QName q)
Serializes the QName as a string using the prefix:localName
if prefix is not defined then this method uses localName only
if prefix is null, the returned value is QName(?).
|
static net.sf.saxon.value.QNameValue |
qnameValue(javax.xml.namespace.QName q)
Qname value.
|
static java.lang.String |
removeNamespaceDeclarations(java.lang.String string)
This method removes namespace declarations from the incoming string.
|
static java.lang.String |
replaceExpressionsWithVariableValues(java.lang.String xpathExpression,
TraceVariablesBind variableBinds)
This method will replace variables in the xpathExpression with the evaluated values from the TraceVariablesBind
The variable comparison is not perfect because at this time the input xpath expression is just a string
so there is no way to determine the right namespace link to variables in the variables has a prefix.
|
static net.sf.saxon.om.FingerprintedQName |
saxonFpQName(javax.xml.namespace.QName qName)
Saxon fp q name.
|
static net.sf.saxon.s9api.QName |
saxonQName(javax.xml.namespace.QName qname)
Creates a new saxon QName from a javax QName.
|
static net.sf.saxon.s9api.QName |
saxonQName(net.sf.saxon.value.QNameValue attribute)
Saxon q name.
|
static void |
setElementImplQNameValue(net.sf.saxon.tree.linked.ElementImpl element,
javax.xml.namespace.QName value)
Sets the element impl q name value.
|
static void |
setJDomElementValue(org.jdom.Element jdomNode,
java.lang.Object value)
Sets to jdomNode the value after the required conversions depending on
the object type.
|
static net.sf.saxon.om.StructuredQName |
structuredQName(javax.xml.namespace.QName qName)
Structured q name.
|
static java.util.Collection<?> |
textToJDomNodes(java.lang.String string)
Returns a collection of text and Element nodes transforming the content of the string parameter accordingly.
|
public static java.util.Comparator<javax.xml.namespace.QName> QNameComparatorINSTANCE
public static net.sf.saxon.s9api.QName saxonQName(javax.xml.namespace.QName qname)
qname - in the javax librarypublic static javax.xml.namespace.QName javaxQName(net.sf.saxon.s9api.QName qname)
qname - in the Saxon librarypublic static javax.xml.namespace.QName javaxQName(net.sf.saxon.value.QNameValue qname)
qname - in the Saxon value librarypublic static javax.xml.namespace.QName javaxQName(net.sf.saxon.s9api.XdmNode node)
node - the nodepublic static javax.xml.namespace.QName javaxQName(java.lang.String value,
net.sf.saxon.s9api.XdmNode node)
value - the valuenode - the nodepublic static boolean effectiveBooleanValue(net.sf.saxon.value.AtomicValue atVal)
atVal - the at valpublic static net.sf.saxon.value.QNameValue qnameValue(javax.xml.namespace.QName q)
q - the qpublic static java.util.Collection<?> jdomNodeSet(net.sf.saxon.s9api.XdmValue descriptionNodes)
descriptionNodes - the description nodespublic static java.util.Collection<?> jdomNodeSet(net.sf.saxon.s9api.XdmSequenceIterator iter)
iter - the iterpublic static java.lang.Object jdomNode(net.sf.saxon.s9api.XdmNode node)
node - the nodepublic static void jdomCreateAttributeNode(org.jdom.Element el,
java.lang.String attributeName,
javax.xml.namespace.QName value)
el - the elattributeName - the attribute namevalue - the valuepublic static java.lang.String getNamespaceURIforPrefix(java.lang.String pfx,
net.sf.saxon.s9api.XdmNode node)
pfx - the pfxnode - the nodepublic static javax.xml.namespace.QName javaxQName(net.sf.saxon.om.StructuredQName qname)
qname - the qnamepublic static net.sf.saxon.om.StructuredQName structuredQName(javax.xml.namespace.QName qName)
qName - the q namepublic static net.sf.saxon.om.FingerprintedQName saxonFpQName(javax.xml.namespace.QName qName)
qName - the q namepublic static java.lang.String qnameToString(javax.xml.namespace.QName q)
if prefix is not defined then this method uses {namespace}:localName
.
q - the qpublic static java.lang.String jClark(javax.xml.namespace.QName q)
q - the qpublic static javax.xml.namespace.QName qnameFromJClark(java.lang.String clarkQName)
clarkQName - the clark q namepublic static java.lang.String qnameToString2(javax.xml.namespace.QName q)
if prefix is not defined then this method uses localName only
if prefix is null, the returned value is QName(?).
q - the qpublic static void setJDomElementValue(org.jdom.Element jdomNode,
java.lang.Object value)
if value is null, jdom node content is unset.
if value is a String, BigDecimal, BigInteger, Double, Float, Boolean, QName or net.sf.saxon.s9api.QName the
value is converted to a string using the toString or toPlainString methods.
if valule is a QName, namespaces may be added to the node.
if value is not any of the previously value types, the toString method is used on the value object.
jdomNode - as org.jdom.Elementvalue - as Objectpublic static java.util.Collection<?> textToJDomNodes(java.lang.String string)
throws org.jdom.JDOMException
string - the stringorg.jdom.JDOMException - the JDOM exceptionpublic static java.lang.String removeNamespaceDeclarations(java.lang.String string)
string - this is a valid XML string including xmlns:XXXXX="whatever" declarations.public static java.lang.String replaceExpressionsWithVariableValues(java.lang.String xpathExpression,
TraceVariablesBind variableBinds)
xpathExpression - the xpath expressionvariableBinds - the variable bindspublic static net.sf.saxon.s9api.QName saxonQName(net.sf.saxon.value.QNameValue attribute)
attribute - the attributepublic static net.sf.saxon.om.MutableNodeInfo createTextNode(net.sf.saxon.Configuration conf,
java.lang.String value)
conf - the confvalue - the valuepublic static void setElementImplQNameValue(net.sf.saxon.tree.linked.ElementImpl element,
javax.xml.namespace.QName value)
element - the elementvalue - the valuepublic static net.sf.saxon.tree.linked.ElementImpl createElementNode(net.sf.saxon.om.NamePool np,
java.lang.String prefix,
java.lang.String namespace,
java.lang.String localname)
np - the npprefix - the prefixnamespace - the namespacelocalname - the localnamepublic static void addChildElementImpl(net.sf.saxon.tree.linked.ElementImpl tableModel,
net.sf.saxon.tree.linked.ElementImpl tableSet)
tableModel - the table modeltableSet - the table set