public final class XmlHelper extends Object
Modifier and Type | Class and Description |
---|---|
static class |
XmlHelper.LaxValidationCase
Interface for providing exceptional cases in XML validation (e.g.
|
Modifier and Type | Field and Description |
---|---|
private static org.slf4j.Logger |
LOGGER |
Modifier | Constructor and Description |
---|---|
private |
XmlHelper() |
Modifier and Type | Method and Description |
---|---|
static void |
append(org.apache.xmlbeans.XmlObject parent,
org.apache.xmlbeans.XmlObject childDoc)
Utility method to append the contents of the child docment to the end of
the parent XmlObject.
|
private static boolean |
checkAttributeForGmlId(Attr attr,
String nodeNamespace)
Check if attribute or node namespace is a GML id.
|
static void |
fixNamespaceForXsiType(org.apache.xmlbeans.XmlObject content,
Map<?,?> namespaces) |
static void |
fixNamespaceForXsiType(org.apache.xmlbeans.XmlObject object,
QName value) |
private static Collection<String> |
getGmlNSs()
Get set with GML 3.1.1 and GML 3.2.1 namespaces.
|
static String |
getLocalName(org.apache.xmlbeans.XmlObject element) |
static String |
getNamespace(org.apache.xmlbeans.XmlObject doc) |
static Map<?,?> |
getNamespaces(org.apache.xmlbeans.XmlObject xmlObject) |
static Node |
getNodeFromNodeList(NodeList nodeList)
Get element Node from NodeList.
|
static String |
getPrefixForNamespace(org.apache.xmlbeans.XmlObject element,
String namespace) |
private static String |
getSchemaTypeNamespace(org.apache.xmlbeans.XmlObject doc) |
static String |
getXPathPrefix(String prefix,
String namespace) |
private static boolean |
isNotNullAndEqualsNSs(String namespaceToCheck,
Collection<String> namespaces)
Check if namespace is not null and equals GML 3.1.1 or GML 3.2.1
namespace.
|
static org.apache.xmlbeans.XmlObject |
loadXmlDocumentFromFile(File file)
Loads a XML document from File.
|
static void |
makeGmlIdsUnique(Node node)
Recurse through a node and its children and make all gml:ids unique
|
static void |
makeGmlIdsUnique(Node node,
Map<String,Integer> foundIds)
Recurse through a node and its children and make all gml:ids unique
|
static org.apache.xmlbeans.XmlObject |
parseXmlSosRequest(javax.servlet.http.HttpServletRequest request)
Parse XML document from HTTP-Post request.
|
static org.apache.xmlbeans.XmlObject |
parseXmlString(String xmlString) |
static boolean |
removeElement(org.apache.xmlbeans.XmlObject element)
Remove the element from XML document
|
static void |
removeNamespaces(org.apache.xmlbeans.XmlObject x)
Remove namespace declarations from an xml fragment (useful for moving all
declarations to a document root
|
static org.apache.xmlbeans.XmlObject |
substituteElement(org.apache.xmlbeans.XmlObject elementToSubstitute,
org.apache.xmlbeans.SchemaType schemaType,
QName name) |
static org.apache.xmlbeans.XmlObject |
substituteElement(org.apache.xmlbeans.XmlObject elementToSubstitute,
org.apache.xmlbeans.XmlObject substitutionElement) |
static void |
updateGmlIDs(Node node,
String gmlID,
String oldGmlID) |
static boolean |
validateDocument(org.apache.xmlbeans.XmlObject doc)
checks whether the XMLDocument is valid
|
public static org.apache.xmlbeans.XmlObject parseXmlSosRequest(javax.servlet.http.HttpServletRequest request) throws OwsExceptionReport
request
- HTTP-Post requestOwsExceptionReport
- If an error occurspublic static org.apache.xmlbeans.XmlObject parseXmlString(String xmlString) throws OwsExceptionReport
OwsExceptionReport
public static Node getNodeFromNodeList(NodeList nodeList)
nodeList
- NodeList.public static boolean validateDocument(org.apache.xmlbeans.XmlObject doc) throws OwsExceptionReport
doc
- the document which should be checkedOwsExceptionReport
- * if the Document is not validpublic static org.apache.xmlbeans.XmlObject loadXmlDocumentFromFile(File file) throws OwsExceptionReport
file
- FileOwsExceptionReport
- If an error occurspublic static void makeGmlIdsUnique(Node node)
node
- The root nodepublic static void makeGmlIdsUnique(Node node, Map<String,Integer> foundIds)
node
- The node to examineprivate static boolean checkAttributeForGmlId(Attr attr, String nodeNamespace)
attr
- Attribure to checknodeNamespace
- Node namespacetrue
, if attribute or node is a GML idprivate static boolean isNotNullAndEqualsNSs(String namespaceToCheck, Collection<String> namespaces)
namespaceToCheck
- Namespace to checknamespaces
- GML namespacestrue
, if namespaceToCheck is a GML namespaceprivate static Collection<String> getGmlNSs()
public static String getNamespace(org.apache.xmlbeans.XmlObject doc)
private static String getSchemaTypeNamespace(org.apache.xmlbeans.XmlObject doc)
public static org.apache.xmlbeans.XmlObject substituteElement(org.apache.xmlbeans.XmlObject elementToSubstitute, org.apache.xmlbeans.XmlObject substitutionElement)
public static String getPrefixForNamespace(org.apache.xmlbeans.XmlObject element, String namespace)
public static org.apache.xmlbeans.XmlObject substituteElement(org.apache.xmlbeans.XmlObject elementToSubstitute, org.apache.xmlbeans.SchemaType schemaType, QName name)
public static String getLocalName(org.apache.xmlbeans.XmlObject element)
public static void append(org.apache.xmlbeans.XmlObject parent, org.apache.xmlbeans.XmlObject childDoc)
parent
- Parent to append contents tochildDoc
- Xml document containing contents to be appendedpublic static void removeNamespaces(org.apache.xmlbeans.XmlObject x)
x
- The fragment to localizepublic static boolean removeElement(org.apache.xmlbeans.XmlObject element)
element
- Element to removetrue
, if element is removedpublic static void fixNamespaceForXsiType(org.apache.xmlbeans.XmlObject object, QName value)
public static void fixNamespaceForXsiType(org.apache.xmlbeans.XmlObject content, Map<?,?> namespaces)
public static Map<?,?> getNamespaces(org.apache.xmlbeans.XmlObject xmlObject)
Copyright © 2012-2015 52north.org. All Rights Reserved.