Package gov.nasa.worldwind.util
Class WWXML
- java.lang.Object
-
- gov.nasa.worldwind.util.WWXML
-
public class WWXML extends java.lang.ObjectA collection of static methods use for opening, reading and otherwise working with XML files.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringXLINK_URI
-
Constructor Summary
Constructors Constructor Description WWXML()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.w3c.dom.ElementappendBoolean(org.w3c.dom.Element context, java.lang.String path, boolean value)Append a heirarcy of new elements with a path to a context element, ending with a text element with a specified value.static org.w3c.dom.ElementappendDouble(org.w3c.dom.Element context, java.lang.String path, double value)Append a heirarcy of new elements with a path to a context element, ending with a text element with a specified value.static org.w3c.dom.ElementappendElement(org.w3c.dom.Element context, java.lang.String name)Append a new element with a specified name to a context element.static org.w3c.dom.ElementappendElementPath(org.w3c.dom.Element context, java.lang.String path)Append a heirarcy of new elements with a path to a context element.static org.w3c.dom.ElementappendInteger(org.w3c.dom.Element context, java.lang.String path, int value)Append a heirarcy of new elements with a path to a context element, ending with a text element with a specified value.static org.w3c.dom.ElementappendLatLon(org.w3c.dom.Element context, java.lang.String path, LatLon ll)Append a heirarcy of new elements with a path to a context element, ending with an element formatted as a LatLon.static org.w3c.dom.ElementappendLong(org.w3c.dom.Element context, java.lang.String path, long value)Append a heirarcy of new elements with a path to a context element, ending with a text element with a specified value.static org.w3c.dom.ElementappendScreenCredit(org.w3c.dom.Element context, java.lang.String path, ScreenCredit screenCredit)Append a heirarcy of new elements with a path to a context element, ending with an element formatted as a ScreenCredit.static org.w3c.dom.ElementappendSector(org.w3c.dom.Element context, java.lang.String path, Sector sector)Append a heirarcy of new elements with a path to a context element, ending with an element formatted as a Sector.static org.w3c.dom.ElementappendSectorResolutionLimit(org.w3c.dom.Element context, java.lang.String path, LevelSet.SectorResolution sectorResolution)Append a heirarcy of new elements with a path to a context element, ending with an element formatted as a LevelSet.SectorResolutionLimit.static org.w3c.dom.ElementappendText(org.w3c.dom.Element context, java.lang.String path, java.lang.String string)Append a heirarcy of new elements with a path to a context element, ending with a text element with a specified value.static org.w3c.dom.Element[]appendTextArray(org.w3c.dom.Element context, java.lang.String path, java.lang.String[] strings)For each non-null string in a specified array, appends a heirarcy of new elements with a path to a context element, ending with a text element with a specified value.static org.w3c.dom.ElementappendTimeInMillis(org.w3c.dom.Element context, java.lang.String path, long timeInMillis)Append a heirarcy of new elements with a path to a context element, ending with an element formatted as a time in milliseconds.static java.lang.StringbyteOrderAsText(java.lang.String byteOrder)Returns the string text for a specified byte order constant.static voidcheckAndAppendBooleanElement(AVList params, java.lang.String paramKey, org.w3c.dom.Element context, java.lang.String path)Checks a parameter list for a specified key and if present attempts to append new elements represeting the parameter to a specified context.static voidcheckAndAppendDoubleElement(AVList params, java.lang.String paramKey, org.w3c.dom.Element context, java.lang.String path)Checks a parameter list for a specified key and if present attempts to append new elements represeting the parameter to a specified context.static voidcheckAndAppendIntegerlement(AVList params, java.lang.String paramKey, org.w3c.dom.Element context, java.lang.String path)Checks a parameter list for a specified key and if present attempts to append new elements represeting the parameter to a specified context.static voidcheckAndAppendLatLonElement(AVList params, java.lang.String paramKey, org.w3c.dom.Element context, java.lang.String path)Checks a parameter list for a specified key and if present attempts to append new elements represeting the parameter to a specified context.static voidcheckAndAppendLongElement(AVList params, java.lang.String paramKey, org.w3c.dom.Element context, java.lang.String path)Checks a parameter list for a specified key and if present attempts to append new elements represeting the parameter to a specified context.static voidcheckAndAppendScreenCreditElement(AVList params, java.lang.String paramKey, org.w3c.dom.Element context, java.lang.String path)Checks a parameter list for a specified key and if present attempts to append new elements represeting the parameter to a specified context.static voidcheckAndAppendSectorElement(AVList params, java.lang.String paramKey, org.w3c.dom.Element context, java.lang.String path)Checks a parameter list for a specified key and if present attempts to append new elements represeting the parameter to a specified context.static voidcheckAndAppendSectorResolutionElement(AVList params, java.lang.String paramKey, org.w3c.dom.Element context, java.lang.String path)Checks a parameter list for a specified key and if present attempts to append new elements represeting the parameter to a specified context.static voidcheckAndAppendTextArrayElement(AVList params, java.lang.String paramKey, org.w3c.dom.Element context, java.lang.String path)Checks a parameter list for a specified key and if present attempts to append new elements represeting the parameter to a specified context.static voidcheckAndAppendTextElement(AVList params, java.lang.String paramKey, org.w3c.dom.Element context, java.lang.String path)Checks a parameter list for a specified key and if present attempts to append new elements represeting the parameter to a specified context.static voidcheckAndAppendTimeElement(AVList params, java.lang.String paramKey, org.w3c.dom.Element context, java.lang.String path)Checks a parameter list for a specified key and if present attempts to append new elements represeting the parameter to a specified context.static voidcheckAndSetBooleanParam(org.w3c.dom.Element context, AVList params, java.lang.String paramKey, java.lang.String paramName, javax.xml.xpath.XPath xpath)Checks a parameter list for a specified key and if not present attempts to find a value for the key from an element matched by an XPath expression.static voidcheckAndSetColorArrayParam(org.w3c.dom.Element context, AVList params, java.lang.String paramKey, java.lang.String paramName, javax.xml.xpath.XPath xpath)static voidcheckAndSetColorParam(org.w3c.dom.Element context, AVList params, java.lang.String paramKey, java.lang.String paramName, javax.xml.xpath.XPath xpath)Checks a parameter list for a specified key and if not present attempts to find a value for the key from an element matched by an XPath expression.static voidcheckAndSetDateTimeParam(org.w3c.dom.Element context, AVList params, java.lang.String paramKey, java.lang.String paramName, java.lang.String pattern, javax.xml.xpath.XPath xpath)Checks a parameter list for a specified key and if not present attempts to find a value for the key from an element matched by an XPath expression.static voidcheckAndSetDoubleParam(org.w3c.dom.Element context, AVList params, java.lang.String paramKey, java.lang.String paramName, javax.xml.xpath.XPath xpath)Checks a parameter list for a specified key and if not present attempts to find a value for the key from an element matched by an XPath expression.static voidcheckAndSetIntegerParam(org.w3c.dom.Element context, AVList params, java.lang.String paramKey, java.lang.String paramName, javax.xml.xpath.XPath xpath)Checks a parameter list for a specified key and if not present attempts to find a value for the key from an element matched by an XPath expression.static voidcheckAndSetLatLonParam(org.w3c.dom.Element context, AVList params, java.lang.String paramKey, java.lang.String paramName, javax.xml.xpath.XPath xpath)Checks a parameter list for a specified key and if not present attempts to find a value for the key from an element matched by an XPath expression.static voidcheckAndSetLongParam(org.w3c.dom.Element context, AVList params, java.lang.String paramKey, java.lang.String paramName, javax.xml.xpath.XPath xpath)Checks a parameter list for a specified key and if not present attempts to find a value for the key from an element matched by an XPath expression.static voidcheckAndSetScreenCreditParam(org.w3c.dom.Element context, AVList params, java.lang.String paramKey, java.lang.String paramName, javax.xml.xpath.XPath xpath)Checks a parameter list for a specified key and if not present attempts to find a value for the key from an element matched by an XPath expression.static voidcheckAndSetSectorParam(org.w3c.dom.Element context, AVList params, java.lang.String paramKey, java.lang.String paramName, javax.xml.xpath.XPath xpath)Checks a parameter list for a specified key and if not present attempts to find a value for the key from an element matched by an XPath expression.static voidcheckAndSetSectorResolutionParam(org.w3c.dom.Element context, AVList params, java.lang.String paramKey, java.lang.String paramName, javax.xml.xpath.XPath xpath)Checks a parameter list for a specified key and if not present attempts to find a value for the key from an element matched by an XPath expression.static voidcheckAndSetStringArrayParam(org.w3c.dom.Element context, AVList params, java.lang.String paramKey, java.lang.String paramName, javax.xml.xpath.XPath xpath)Checks a parameter list for a specified key and if not present attempts to find a value for the key from an element matched by an XPath expression.static voidcheckAndSetStringParam(org.w3c.dom.Element context, AVList params, java.lang.String paramKey, java.lang.String paramName, javax.xml.xpath.XPath xpath)Checks a parameter list for a specified key and if not present attempts to find a value for the key from an element matched by an XPath expression.static voidcheckAndSetTimeParam(org.w3c.dom.Element context, AVList params, java.lang.String paramKey, java.lang.String paramName, javax.xml.xpath.XPath xpath)Checks a parameter list for a specified key and if not present attempts to find a value for the key from an element matched by an XPath expression.static voidcheckAndSetTimeParamAsInteger(org.w3c.dom.Element context, AVList params, java.lang.String paramKey, java.lang.String paramName, javax.xml.xpath.XPath xpath)Checks a parameter list for a specified key and if not present attempts to find a value for the key from an element matched by an XPath expression.static voidcheckAndSetUniqueStringsParam(org.w3c.dom.Element context, AVList params, java.lang.String paramKey, java.lang.String paramName, javax.xml.xpath.XPath xpath)Checks a parameter list for a specified key and if not present attempts to find a value for the key from an element matched by an XPath expression.static java.lang.StringcheckOGCException(org.w3c.dom.Document doc)static voidcloseEventReader(javax.xml.stream.XMLEventReader eventReader, java.lang.String name)Close an XML event stream and catch anyXMLStreamExceptiongenerated in the process.static AVListcopyProperties(org.w3c.dom.Element element, AVList params)Copy anyPropertyelements in an XML document to an attribute-value list.static javax.xml.parsers.DocumentBuildercreateDocumentBuilder(boolean isNamespaceAware)Create a DOM builder.static javax.xml.transform.TransformercreateTransformer()Create a XML transformer.static java.lang.StringdataTypeAsText(java.lang.String dataType)Returns the string text for a specified data type constant.static java.lang.StringextractOGCServiceException(java.nio.ByteBuffer buffer)static java.lang.StringfixGetMapString(java.lang.String gms)static java.lang.BooleangetBoolean(org.w3c.dom.Element context, java.lang.String path, javax.xml.xpath.XPath xpath)Returns theBooleanvalue of an element identified by an XPath expression.static java.awt.ColorgetColor(org.w3c.dom.Element context, java.lang.String path, javax.xml.xpath.XPath xpath)Returns theColorvalue of an element identified by an XPath expression.static java.lang.LonggetDateTimeInMillis(org.w3c.dom.Element context, java.lang.String path, java.lang.String pattern, javax.xml.xpath.XPath xpath)Returns the date and time in milliseconds of an element identified by an XPath expression.static java.lang.DoublegetDouble(org.w3c.dom.Element context, java.lang.String path, javax.xml.xpath.XPath xpath)Returns theDoublevalue of an element identified by an XPath expression.static org.w3c.dom.ElementgetElement(org.w3c.dom.Element context, java.lang.String path, javax.xml.xpath.XPath xpath)Returns the element identified by an XPath expression.static org.w3c.dom.Element[]getElements(org.w3c.dom.Element context, java.lang.String path, javax.xml.xpath.XPath xpath)Returns all elements identified by an XPath expression.static java.lang.IntegergetInteger(org.w3c.dom.Element context, java.lang.String path, javax.xml.xpath.XPath xpath)Returns theIntegervalue of an element identified by an XPath expression.static LatLongetLatLon(org.w3c.dom.Element context, java.lang.String path, javax.xml.xpath.XPath xpath)Returns theLatLonvalue of an element identified by an XPath expression.static java.lang.LonggetLong(org.w3c.dom.Element context, java.lang.String path, javax.xml.xpath.XPath xpath)Returns theLongvalue of an element identified by an XPath expression.static ScreenCreditgetScreenCredit(org.w3c.dom.Element context, java.lang.String path, javax.xml.xpath.XPath xpath)Returns theScreenCreditvalue of an element identified by an XPath expression.static SectorgetSector(org.w3c.dom.Element context, java.lang.String path, javax.xml.xpath.XPath xpath)Returns theSectorvalue of an element identified by an XPath expression.static LevelSet.SectorResolutiongetSectorResolutionLimit(org.w3c.dom.Element context, java.lang.String path, javax.xml.xpath.XPath xpath)Returns theLevelSet.SectorResolutionvalue of an element identified by an XPath expression.static java.lang.StringgetText(org.w3c.dom.Element context, java.lang.String path)Returns the text of the element identified by an XPath expression.static java.lang.StringgetText(org.w3c.dom.Element context, java.lang.String path, javax.xml.xpath.XPath xpath)Returns the text of the element identified by an XPath expression.static java.lang.String[]getTextArray(org.w3c.dom.Element context, java.lang.String path, javax.xml.xpath.XPath xpath)Returns the text of all elements identified by an XPath expression.static java.lang.LonggetTimeInMillis(org.w3c.dom.Element context, java.lang.String path, javax.xml.xpath.XPath xpath)Returns the time in milliseconds of an element identified by an XPath expression.static org.w3c.dom.Element[]getUniqueElements(org.w3c.dom.Element context, java.lang.String path, java.lang.String uniqueTag, javax.xml.xpath.XPath xpath)Returns the unique elements identified by an XPath expression and a sub-expression.static java.lang.String[]getUniqueText(org.w3c.dom.Element context, java.lang.String path, javax.xml.xpath.XPath xpath)Returns the text of all unique elements identified by an XPath expression.static java.lang.StringgetUnqalifiedName(javax.xml.stream.events.StartElement event)Returns the element event's unqualified name.static java.lang.StringgetUnqualifiedName(org.w3c.dom.Element context)Returns the element node's unqualified name.static voidinvokePropertySetters(java.lang.Object parent, org.w3c.dom.Element domElement)Uses reflection to invoke property methods on an object, with the properties specified in an XML document.static javax.xml.xpath.XPathmakeXPath()Shortcut method to create anXPath.static javax.xml.stream.events.StartElementnextStartElementEvent(javax.xml.stream.XMLEventReader eventReader)Returns the next StartElement event from the specified XML event stream, or null if the stream has no remaining StartElement events.static org.w3c.dom.DocumentopenDocument(java.lang.Object docSource)Open and XML document from a general source.static org.w3c.dom.DocumentopenDocumentFile(java.lang.String filePath, java.lang.Class c)Opens an XML file given the file's location in the file system or on the classpath.static org.w3c.dom.DocumentopenDocumentStream(java.io.InputStream inputStream)Opens an XML document given an input stream.static org.w3c.dom.DocumentopenDocumentStream(java.io.InputStream inputStream, boolean isNamespaceAware)static org.w3c.dom.DocumentopenDocumentURL(java.net.URL url)Opens an XML document given a genericURLreference.static javax.xml.stream.XMLEventReaderopenEventReader(java.lang.Object docSource)Open a namespace-aware XML event stream from a general source.static javax.xml.stream.XMLEventReaderopenEventReader(java.lang.Object docSource, boolean isNamespaceAware)Open an XML event stream from a general source.static javax.xml.stream.XMLEventReaderopenEventReaderFile(java.lang.String filePath, java.lang.Class c, boolean isNamespaceAware)Opens an XML event stream given the file's location in the file system or on the classpath.static javax.xml.stream.XMLEventReaderopenEventReaderStream(java.io.InputStream inputStream)Opens an XML event stream given an input stream.static javax.xml.stream.XMLEventReaderopenEventReaderStream(java.io.InputStream inputStream, boolean isNamespaceAware)Opens an XML event stream given an input stream, and a namespace-aware processing mode.static javax.xml.stream.XMLEventReaderopenEventReaderURL(java.net.URL url, boolean isNamespaceAware)Open an XML event stream given a genericURLreference.static javax.xml.stream.XMLStreamWriteropenStreamWriter(java.lang.Object output)Opens an XML stream writer to a general output destination.static java.lang.StringparseByteOrder(java.lang.String s)Returns the byte order constant for a specified string.static java.lang.StringparseDataType(java.lang.String s)Returns the data type constant for a specified string.static java.lang.StringreadCharacters(javax.xml.stream.XMLEventReader eventReader)Returns a string containing the text from all character nodes under the current element appended into a single continuous string.static voidsaveDocumentToFile(org.w3c.dom.Document doc, java.lang.String filePath)Writes an XML document to a location in the file system.static voidsaveDocumentToStream(org.w3c.dom.Document doc, java.io.OutputStream outputStream)Writes an XML document to a specified outputstream stream.static voidsetBooleanAttribute(org.w3c.dom.Element context, java.lang.String name, boolean value)Sets the element's attribute with the specified name to the specified boolean value, converted to a String.static org.w3c.dom.ElementsetDocumentElement(org.w3c.dom.Document doc, java.lang.String name)Sets the specified document's root element to a new element node with the specified name.static voidsetDoubleAttribute(org.w3c.dom.Element context, java.lang.String name, double value)Sets the element's attribute with the specified name to the specified double value, converted to a String.static voidsetIntegerAttribute(org.w3c.dom.Element context, java.lang.String name, int value)Sets the element's attribute with the specified name to the specified integer value, converted to a String.static voidsetLongAttribute(org.w3c.dom.Element context, java.lang.String name, long value)Sets the element's attribute with the specified name to the specified long integer value, converted to a String.static voidsetTextAttribute(org.w3c.dom.Element context, java.lang.String name, java.lang.String value)Sets the element's attribute with the specified name to the specified String value.
-
-
-
Field Detail
-
XLINK_URI
public static final java.lang.String XLINK_URI
- See Also:
- Constant Field Values
-
-
Method Detail
-
createDocumentBuilder
public static javax.xml.parsers.DocumentBuilder createDocumentBuilder(boolean isNamespaceAware)
Create a DOM builder.- Parameters:
isNamespaceAware- true if the builder is to be namespace aware, otherwise false.- Returns:
- a
DocumentBuilder. - Throws:
WWRuntimeException- if an error occurs.
-
createTransformer
public static javax.xml.transform.Transformer createTransformer()
Create a XML transformer.- Returns:
- a
Transformer - Throws:
WWRuntimeException- if an error occurs.
-
openDocument
public static org.w3c.dom.Document openDocument(java.lang.Object docSource)
Open and XML document from a general source. The source type may be one of the following:- a
URL - an
InputStream - a
File - a
Stringcontaining a valid URL description or a file or resource name available on the classpath.
- Parameters:
docSource- the source of the XML document.- Returns:
- the source document as a
Document, or null if the source object is a string that does not identify a URL, a file or a resource available on the classpath.
- a
-
openDocumentFile
public static org.w3c.dom.Document openDocumentFile(java.lang.String filePath, java.lang.Class c)Opens an XML file given the file's location in the file system or on the classpath.- Parameters:
filePath- the path to the file. Must be an absolute path or a path relative to a location in the classpath.c- the class that is used to find a path relative to the classpath.- Returns:
- a DOM for the file, or null if the specified cannot be found.
- Throws:
java.lang.IllegalArgumentException- if the file path is null.WWRuntimeException- if an exception or error occurs while opening and parsing the file. The causing exception is included in this exception'sThrowable.initCause(Throwable).
-
openDocumentURL
public static org.w3c.dom.Document openDocumentURL(java.net.URL url)
Opens an XML document given a genericURLreference.- Parameters:
url- the URL to the document.- Returns:
- a DOM for the URL.
- Throws:
java.lang.IllegalArgumentException- if the url is null.WWRuntimeException- if an exception or error occurs while opening and parsing the url. The causing exception is included in this exception'sThrowable.initCause(Throwable).
-
openDocumentStream
public static org.w3c.dom.Document openDocumentStream(java.io.InputStream inputStream)
Opens an XML document given an input stream.- Parameters:
inputStream- the document as an input stream.- Returns:
- a DOM for the stream content.
- Throws:
java.lang.IllegalArgumentException- if the input stream is null.WWRuntimeException- if an exception or error occurs while parsing the stream. The causing exception is included in this exception'sThrowable.initCause(Throwable)
-
openDocumentStream
public static org.w3c.dom.Document openDocumentStream(java.io.InputStream inputStream, boolean isNamespaceAware)
-
saveDocumentToFile
public static void saveDocumentToFile(org.w3c.dom.Document doc, java.lang.String filePath)Writes an XML document to a location in the file system.- Parameters:
doc- the DOM document to save.filePath- the path to the file. Must be an absolute path in the file system.- Throws:
java.lang.IllegalArgumentException- if either the document or file path is null.WWRuntimeException- if an exception or error occurs while writing the document. The causing exception is included in this exception'sThrowable.initCause(Throwable)
-
saveDocumentToStream
public static void saveDocumentToStream(org.w3c.dom.Document doc, java.io.OutputStream outputStream)Writes an XML document to a specified outputstream stream.- Parameters:
doc- the DOM document to save.outputStream- the outputstream to save the document contents to.- Throws:
java.lang.IllegalArgumentException- if either the document or input stream is null.WWRuntimeException- if an exception or error occurs while writing the document. The causing exception is included in this exception'sThrowable.initCause(Throwable)
-
openEventReaderStream
public static javax.xml.stream.XMLEventReader openEventReaderStream(java.io.InputStream inputStream, boolean isNamespaceAware)Opens an XML event stream given an input stream, and a namespace-aware processing mode.- Parameters:
inputStream- an XML document as an input stream.isNamespaceAware- true to enable namespace-aware processing and false to disable it.- Returns:
- an XMLEventReader for the stream content.
- Throws:
java.lang.IllegalArgumentException- if the input stream is null.WWRuntimeException- if an exception or error occurs while parsing the stream. The causing exception is included in this exception'sThrowable.initCause(Throwable)
-
openEventReaderStream
public static javax.xml.stream.XMLEventReader openEventReaderStream(java.io.InputStream inputStream)
Opens an XML event stream given an input stream.- Parameters:
inputStream- an XML document as an input stream.- Returns:
- an XMLEventReader for the stream content.
- Throws:
java.lang.IllegalArgumentException- if the input stream is null.WWRuntimeException- if an exception or error occurs while parsing the stream. The causing exception is included in this exception'sThrowable.initCause(Throwable)
-
openEventReaderFile
public static javax.xml.stream.XMLEventReader openEventReaderFile(java.lang.String filePath, java.lang.Class c, boolean isNamespaceAware)Opens an XML event stream given the file's location in the file system or on the classpath.- Parameters:
filePath- the path to the file. Must be an absolute path or a path relative to a location in the classpath.c- the class that is used to find a path relative to the classpath.isNamespaceAware- true to enable namespace-aware processing and false to disable it.- Returns:
- an XMLEventReader for the file, or null if the specified cannot be found.
- Throws:
java.lang.IllegalArgumentException- if the file path is null.WWRuntimeException- if an exception or error occurs while opening and parsing the file. The causing exception is included in this exception'sThrowable.initCause(Throwable).
-
openEventReaderURL
public static javax.xml.stream.XMLEventReader openEventReaderURL(java.net.URL url, boolean isNamespaceAware)Open an XML event stream given a genericURLreference.- Parameters:
url- the URL to the document.isNamespaceAware- true to enable namespace-aware processing and false to disable it.- Returns:
- an XMLEventReader for the URL.
- Throws:
java.lang.IllegalArgumentException- if the url is null.WWRuntimeException- if an exception or error occurs while opening and parsing the url. The causing exception is included in this exception'sThrowable.initCause(Throwable).
-
openEventReader
public static javax.xml.stream.XMLEventReader openEventReader(java.lang.Object docSource)
Open a namespace-aware XML event stream from a general source. The source type may be one of the following:URLInputStreamFileStringcontaining a valid URL description or a file or resource name available on the classpath.
- Parameters:
docSource- the source of the XML document.- Returns:
- the source document as a
XMLEventReader, or null if the source object is a string that does not identify a URL, a file or a resource available on the classpath.
-
openEventReader
public static javax.xml.stream.XMLEventReader openEventReader(java.lang.Object docSource, boolean isNamespaceAware)Open an XML event stream from a general source. The source type may be one of the following:URLInputStreamFileStringcontaining a valid URL description or a file or resource name available on the classpath.
- Parameters:
docSource- the source of the XML document.isNamespaceAware- true to enable namespace-aware processing and false to disable it.- Returns:
- the source document as a
XMLEventReader, or null if the source object is a string that does not identify a URL, a file or a resource available on the classpath.
-
closeEventReader
public static void closeEventReader(javax.xml.stream.XMLEventReader eventReader, java.lang.String name)Close an XML event stream and catch anyXMLStreamExceptiongenerated in the process.- Parameters:
eventReader- the event reader to close. If null, this method does nothing.name- the name of the event reader to place in the log message if an exception is encountered.
-
openStreamWriter
public static javax.xml.stream.XMLStreamWriter openStreamWriter(java.lang.Object output) throws javax.xml.stream.XMLStreamExceptionOpens an XML stream writer to a general output destination. The source type may be one of the following:OutputStreamWriter
nullif theoutputis not one of the recognized types.- Parameters:
output- the output destination for the XML document stream.- Returns:
- the
XMLStreamWriterthat writes to the specifiedoutput, ornullif the output type is not recognized. - Throws:
java.lang.IllegalArgumentException- ifoutputisnull.javax.xml.stream.XMLStreamException- if an exception occurs while attempting to open theXMLStreamWriter.
-
nextStartElementEvent
public static javax.xml.stream.events.StartElement nextStartElementEvent(javax.xml.stream.XMLEventReader eventReader)
Returns the next StartElement event from the specified XML event stream, or null if the stream has no remaining StartElement events.- Parameters:
eventReader- the stream to poll for the next StartElement event.- Returns:
- the next StartElementEvent, or null if none exists.
- Throws:
java.lang.IllegalArgumentException- if the event reader is null.
-
readCharacters
public static java.lang.String readCharacters(javax.xml.stream.XMLEventReader eventReader)
Returns a string containing the text from all character nodes under the current element appended into a single continuous string. After this method returns the specified eventReader is positioned at the end element of the eventReader's current element. This returns the empty string if there are no character nodes under the current element, or if the element contains only whitespace.- Parameters:
eventReader- the stream to poll for XML events.- Returns:
- A string containing the text from character nodes under the current element.
- Throws:
java.lang.IllegalArgumentException- if the event reader is null.
-
makeXPath
public static javax.xml.xpath.XPath makeXPath()
Shortcut method to create anXPath.- Returns:
- a new XPath.
-
checkOGCException
public static java.lang.String checkOGCException(org.w3c.dom.Document doc)
-
extractOGCServiceException
public static java.lang.String extractOGCServiceException(java.nio.ByteBuffer buffer)
-
getUnqualifiedName
public static java.lang.String getUnqualifiedName(org.w3c.dom.Element context)
Returns the element node's unqualified name. If the element is qualified with a namespace, this returns the local part of the qualified name. Otherwise, this returns the element's unqualified tag name.- Parameters:
context- the element who's unqualified name is returned.- Returns:
- the unqualified tag name of the specified element.
- Throws:
java.lang.IllegalArgumentException- if the context is null.
-
getUnqalifiedName
public static java.lang.String getUnqalifiedName(javax.xml.stream.events.StartElement event)
Returns the element event's unqualified name. If the element is qualified with a namespace, this returns the local part of the qualified name. Otherwise, this returns the element's unqualified tag name.- Parameters:
event- the XML StartElement event who's unqualified name is returned.- Returns:
- the unqualified tag name of the specified StartElement event.
- Throws:
java.lang.IllegalArgumentException- if the event is null.
-
getText
public static java.lang.String getText(org.w3c.dom.Element context, java.lang.String path)Returns the text of the element identified by an XPath expression.- Parameters:
context- the context from which to start the XPath search.path- the XPath expression.- Returns:
- the text of an element matching the XPath expression, or null if no match is found.
- Throws:
java.lang.IllegalArgumentException- if the context or XPath expression are null.
-
getText
public static java.lang.String getText(org.w3c.dom.Element context, java.lang.String path, javax.xml.xpath.XPath xpath)Returns the text of the element identified by an XPath expression.- Parameters:
context- the context from which to start the XPath search.path- the XPath expression.xpath- anXPathobject to use for the search. This allows the caller to re-use XPath objects when performing multiple searches. May be null.- Returns:
- the text of an element matching the XPath expression, or null if no match is found.
- Throws:
java.lang.IllegalArgumentException- if the context or XPath expression are null.
-
getTextArray
public static java.lang.String[] getTextArray(org.w3c.dom.Element context, java.lang.String path, javax.xml.xpath.XPath xpath)Returns the text of all elements identified by an XPath expression.- Parameters:
context- the context from which to start the XPath search.path- the XPath expression.xpath- anXPathobject to use for the search. This allows the caller to re-use XPath objects when performing multiple searches. May be null.- Returns:
- an array containing the text of each element matching the XPath expression.
- Throws:
java.lang.IllegalArgumentException- if the context or XPath expression are null.
-
getUniqueText
public static java.lang.String[] getUniqueText(org.w3c.dom.Element context, java.lang.String path, javax.xml.xpath.XPath xpath)Returns the text of all unique elements identified by an XPath expression.- Parameters:
context- the context from which to start the XPath search.path- the XPath expression.xpath- anXPathobject to use for the search. This allows the caller to re-use XPath objects when performing multiple searches. May be null.- Returns:
- an array containing the text of each element matching the XPath expression and containing unique text. If multiple elements contain the same text only the first one found is returned. Returns null if no matching element is found.
- Throws:
java.lang.IllegalArgumentException- if the context or XPath expression are null.
-
getElement
public static org.w3c.dom.Element getElement(org.w3c.dom.Element context, java.lang.String path, javax.xml.xpath.XPath xpath)Returns the element identified by an XPath expression.- Parameters:
context- the context from which to start the XPath search.path- the XPath expression.xpath- anXPathobject to use for the search. This allows the caller to re-use XPath objects when performing multiple searches. May be null.- Returns:
- the element matching the XPath expression, or null if no element matches.
- Throws:
java.lang.IllegalArgumentException- if the context or XPath expression are null.
-
getElements
public static org.w3c.dom.Element[] getElements(org.w3c.dom.Element context, java.lang.String path, javax.xml.xpath.XPath xpath)Returns all elements identified by an XPath expression.- Parameters:
context- the context from which to start the XPath search.path- the XPath expression.xpath- anXPathobject to use for the search. This allows the caller to re-use XPath objects when performing multiple searches. May be null.- Returns:
- an array containing the elements matching the XPath expression.
- Throws:
java.lang.IllegalArgumentException- if the context or XPath expression are null.
-
getUniqueElements
public static org.w3c.dom.Element[] getUniqueElements(org.w3c.dom.Element context, java.lang.String path, java.lang.String uniqueTag, javax.xml.xpath.XPath xpath)Returns the unique elements identified by an XPath expression and a sub-expression.- Parameters:
context- the context from which to start the XPath search.path- the XPath expression.uniqueTag- an XPath expression to match with the elements matched with the above expression.xpath- anXPathobject to use for the search. This allows the caller to re-use XPath objects when performing multiple searches. May be null.- Returns:
- an array containing the unique elements matching the XPath expression and subexpression. If multiple elements have the same content only the first one found is returned. Returns null if no matching element is found.
- Throws:
java.lang.IllegalArgumentException- if either the context, XPath expression or XPath sub-expression are null.
-
getDouble
public static java.lang.Double getDouble(org.w3c.dom.Element context, java.lang.String path, javax.xml.xpath.XPath xpath)Returns theDoublevalue of an element identified by an XPath expression.- Parameters:
context- the context from which to start the XPath search.path- the XPath expression.xpath- anXPathobject to use for the search. This allows the caller to re-use XPath objects when performing multiple searches. May be null.- Returns:
- the value of an element matching the XPath expression, or null if no match is found or the match does not
contain a
Double. - Throws:
java.lang.IllegalArgumentException- if the context or XPath expression are null.
-
getInteger
public static java.lang.Integer getInteger(org.w3c.dom.Element context, java.lang.String path, javax.xml.xpath.XPath xpath)Returns theIntegervalue of an element identified by an XPath expression.- Parameters:
context- the context from which to start the XPath search.path- the XPath expression.xpath- anXPathobject to use for the search. This allows the caller to re-use XPath objects when performing multiple searches. May be null.- Returns:
- the value of an element matching the XPath expression, or null if no match is found or the match does not
contain a
Integer. - Throws:
java.lang.IllegalArgumentException- if the context or XPath expression are null.
-
getLong
public static java.lang.Long getLong(org.w3c.dom.Element context, java.lang.String path, javax.xml.xpath.XPath xpath)Returns theLongvalue of an element identified by an XPath expression.- Parameters:
context- the context from which to start the XPath search.path- the XPath expression.xpath- anXPathobject to use for the search. This allows the caller to re-use XPath objects when performing multiple searches. May be null.- Returns:
- the value of an element matching the XPath expression, or null if no match is found or the match does not
contain a
Integer. - Throws:
java.lang.IllegalArgumentException- if the context or XPath expression are null.
-
getBoolean
public static java.lang.Boolean getBoolean(org.w3c.dom.Element context, java.lang.String path, javax.xml.xpath.XPath xpath)Returns theBooleanvalue of an element identified by an XPath expression.- Parameters:
context- the context from which to start the XPath search.path- the XPath expression.xpath- anXPathobject to use for the search. This allows the caller to re-use XPath objects when performing multiple searches. May be null.- Returns:
- the value of an element matching the XPath expression, or null if no match is found or the match does not
contain a
Boolean. - Throws:
java.lang.IllegalArgumentException- if the context or XPath expression are null.
-
getLatLon
public static LatLon getLatLon(org.w3c.dom.Element context, java.lang.String path, javax.xml.xpath.XPath xpath)
Returns theLatLonvalue of an element identified by an XPath expression.- Parameters:
context- the context from which to start the XPath search.path- the XPath expression. If null, indicates that the context is the LatLon element itself. If non-null, the context is searched for a LatLon element using the expression.xpath- anXPathobject to use for the search. This allows the caller to re-use XPath objects when performing multiple searches. May be null.- Returns:
- the value of an element matching the XPath expression, or null if no match is found or the match does not
contain a
LatLon. - Throws:
java.lang.IllegalArgumentException- if the context is null.
-
getColor
public static java.awt.Color getColor(org.w3c.dom.Element context, java.lang.String path, javax.xml.xpath.XPath xpath)Returns theColorvalue of an element identified by an XPath expression.- Parameters:
context- the context from which to start the XPath search.path- the XPath expression. If null, indicates that the context is the Color element itself. If non-null, the context is searched for a Color element using the expression.xpath- anXPathobject to use for the search. This allows the caller to re-use XPath objects when performing multiple searches. May be null.- Returns:
- the value of an element matching the XPath expression, or null if no match is found or the match does not
contain a
Color. - Throws:
java.lang.IllegalArgumentException- if the context is null.
-
getSector
public static Sector getSector(org.w3c.dom.Element context, java.lang.String path, javax.xml.xpath.XPath xpath)
Returns theSectorvalue of an element identified by an XPath expression.- Parameters:
context- the context from which to start the XPath search.path- the XPath expression. If null, indicates that the context is the Sector element itself. If non-null, the context is searched for a Sector element using the expression.xpath- anXPathobject to use for the search. This allows the caller to re-use XPath objects when performing multiple searches. May be null.- Returns:
- the value of an element matching the XPath expression, or null if no match is found or the match does not
contain a
Sector. - Throws:
java.lang.IllegalArgumentException- if the context is null.
-
getSectorResolutionLimit
public static LevelSet.SectorResolution getSectorResolutionLimit(org.w3c.dom.Element context, java.lang.String path, javax.xml.xpath.XPath xpath)
Returns theLevelSet.SectorResolutionvalue of an element identified by an XPath expression.- Parameters:
context- the context from which to start the XPath search.path- the XPath expression. If null, indicates that the context is the SectorResolution element itself. If non-null, the context is searched for a SectorResolution element using the expression.xpath- anXPathobject to use for the search. This allows the caller to re-use XPath objects when performing multiple searches. May be null.- Returns:
- the value of an element matching the XPath expression, or null if no match is found or the match does not
contain a
LevelSet.SectorResolution. - Throws:
java.lang.IllegalArgumentException- if the context is null.
-
getTimeInMillis
public static java.lang.Long getTimeInMillis(org.w3c.dom.Element context, java.lang.String path, javax.xml.xpath.XPath xpath)Returns the time in milliseconds of an element identified by an XPath expression.- Parameters:
context- the context from which to start the XPath search.path- the XPath expression. If null, indicates that the context is the Time element itself. If non-null, the context is searched for a Time element using the expression.xpath- anXPathobject to use for the search. This allows the caller to re-use XPath objects when performing multiple searches. May be null.- Returns:
- the value of an element matching the XPath expression, or null if no match is found or the match does not
contain a
LatLon. - Throws:
java.lang.IllegalArgumentException- if the context is null.
-
getDateTimeInMillis
public static java.lang.Long getDateTimeInMillis(org.w3c.dom.Element context, java.lang.String path, java.lang.String pattern, javax.xml.xpath.XPath xpath)Returns the date and time in milliseconds of an element identified by an XPath expression.- Parameters:
context- the context from which to start the XPath search.path- the XPath expression. If null, indicates that the context is the element itself. If non-null, the context is searched for an element matching the expression.pattern- the format pattern of the date. SeeDateFormatfor the pattern symbols. The element content must either match the pattern or be directly convertible to a long.xpath- anXPathobject to use for the search. This allows the caller to re-use XPath objects when performing multiple searches. May be null.- Returns:
- the value of an element matching the XPath expression, or null if no match is found.
- Throws:
java.lang.IllegalArgumentException- if the context or pattern is null.
-
getScreenCredit
public static ScreenCredit getScreenCredit(org.w3c.dom.Element context, java.lang.String path, javax.xml.xpath.XPath xpath)
Returns theScreenCreditvalue of an element identified by an XPath expression.- Parameters:
context- the context from which to start the XPath search.path- the XPath expression. If null, indicates that the context is the ScreenCredit element itself. If non-null, the context is searched for a ScreenCredit element using the expression.xpath- anXPathobject to use for the search. This allows the caller to re-use XPath objects when performing multiple searches. May be null.- Returns:
- the value of an element matching the XPath expression, or null if no match is found or the match does not contain a ScreenCredit.
- Throws:
java.lang.IllegalArgumentException- if the context is null.
-
setDocumentElement
public static org.w3c.dom.Element setDocumentElement(org.w3c.dom.Document doc, java.lang.String name)Sets the specified document's root element to a new element node with the specified name. If the document already has a root element, this replaces the existing root node with the new element node.- Parameters:
doc- the document which receives the new root element.name- the name of the document's new root element node.- Returns:
- the document's new root element node.
- Throws:
java.lang.IllegalArgumentException- if the document is null, if the name is null, or if the name is empty.
-
appendElement
public static org.w3c.dom.Element appendElement(org.w3c.dom.Element context, java.lang.String name)Append a new element with a specified name to a context element. If the element name is null or empty, this returns the context element, and does not make any modifications to the context.- Parameters:
context- the context on which to append a new element.name- the new element name to append.- Returns:
- the new element appended to the context, or the context if the element name is null or empty.
- Throws:
java.lang.IllegalArgumentException- if the context is null.
-
appendElementPath
public static org.w3c.dom.Element appendElementPath(org.w3c.dom.Element context, java.lang.String path)Append a heirarcy of new elements with a path to a context element. The path is treated as a list of descendant elements which created and appended to the context. Each new element in the path is delimited by the "/" character. For example, the path "A/B/C" appends A to context, B to A, and C to B. If the path is null or empty, this returns the context element, and does not make any modifications to the context. If any element name in the path is empty, that element is skipped.- Parameters:
context- the context on which to append new elements.path- the element path to append.- Returns:
- the new element appended to the context, or the context if the element path is null or empty.
- Throws:
java.lang.IllegalArgumentException- if the context is null.
-
appendText
public static org.w3c.dom.Element appendText(org.w3c.dom.Element context, java.lang.String path, java.lang.String string)Append a heirarcy of new elements with a path to a context element, ending with a text element with a specified value. Elements are added to the context as inappendElementPath(org.w3c.dom.Element, String), except that a terminating text element is appended to the last element.- Parameters:
context- the context on which to append new elements.path- the element path to append.string- the text element value.- Returns:
- the new element appended to the context, or the context if the element path is null or empty.
- Throws:
java.lang.IllegalArgumentException- if the context is null.
-
appendTextArray
public static org.w3c.dom.Element[] appendTextArray(org.w3c.dom.Element context, java.lang.String path, java.lang.String[] strings)For each non-null string in a specified array, appends a heirarcy of new elements with a path to a context element, ending with a text element with a specified value. Elements are added to the context as inappendElementPath(org.w3c.dom.Element, String), except that a terminating text element is appended to the last element.- Parameters:
context- the context on which to append new elements.path- the element path to append.strings- the text element values.- Returns:
- array of new elements appended to the context.
- Throws:
java.lang.IllegalArgumentException- if the context is null.
-
appendDouble
public static org.w3c.dom.Element appendDouble(org.w3c.dom.Element context, java.lang.String path, double value)Append a heirarcy of new elements with a path to a context element, ending with a text element with a specified value. Elements are added to the context as inappendElementPath(org.w3c.dom.Element, String), except that a terminating text element is appended to the last element.- Parameters:
context- the context on which to append new elements.path- the element path to append.value- the text element value.- Returns:
- the new element appended to the context, or the context if the element path is null or empty.
- Throws:
java.lang.IllegalArgumentException- if the context is null.
-
appendInteger
public static org.w3c.dom.Element appendInteger(org.w3c.dom.Element context, java.lang.String path, int value)Append a heirarcy of new elements with a path to a context element, ending with a text element with a specified value. Elements are added to the context as inappendElementPath(org.w3c.dom.Element, String), except that a terminating text element is appended to the last element.- Parameters:
context- the context on which to append new elements.path- the element path to append.value- the text element value.- Returns:
- the new element appended to the context, or the context if the element path is null or empty.
- Throws:
java.lang.IllegalArgumentException- if the context is null.
-
appendLong
public static org.w3c.dom.Element appendLong(org.w3c.dom.Element context, java.lang.String path, long value)Append a heirarcy of new elements with a path to a context element, ending with a text element with a specified value. Elements are added to the context as inappendElementPath(org.w3c.dom.Element, String), except that a terminating text element is appended to the last element.- Parameters:
context- the context on which to append new elements.path- the element path to append.value- the text element value.- Returns:
- the new element appended to the context, or the context if the element path is null or empty.
- Throws:
java.lang.IllegalArgumentException- if the context is null.
-
appendBoolean
public static org.w3c.dom.Element appendBoolean(org.w3c.dom.Element context, java.lang.String path, boolean value)Append a heirarcy of new elements with a path to a context element, ending with a text element with a specified value. Elements are added to the context as inappendElementPath(org.w3c.dom.Element, String), except that a terminating text element is appended to the last element.- Parameters:
context- the context on which to append new elements.path- the element path to append.value- the text element value.- Returns:
- the new element appended to the context, or the context if the element path is null or empty.
- Throws:
java.lang.IllegalArgumentException- if the context is null.
-
appendLatLon
public static org.w3c.dom.Element appendLatLon(org.w3c.dom.Element context, java.lang.String path, LatLon ll)Append a heirarcy of new elements with a path to a context element, ending with an element formatted as a LatLon. Elements are added to the context as inappendElementPath(org.w3c.dom.Element, String), except that a terminating text element is appended to the last element.- Parameters:
context- the context on which to append new elements.path- the element path to append.ll- the LatLon value to create.- Returns:
- the new element appended to the context, or the context if the element path is null or empty.
- Throws:
java.lang.IllegalArgumentException- if the context is null.
-
appendSector
public static org.w3c.dom.Element appendSector(org.w3c.dom.Element context, java.lang.String path, Sector sector)Append a heirarcy of new elements with a path to a context element, ending with an element formatted as a Sector. Elements are added to the context as inappendElementPath(org.w3c.dom.Element, String), except that a terminating text element is appended to the last element.- Parameters:
context- the context on which to append new elements.path- the element path to append.sector- the Sector value to create.- Returns:
- the new element appended to the context, or the context if the element path is null or empty.
- Throws:
java.lang.IllegalArgumentException- if the context is null.
-
appendSectorResolutionLimit
public static org.w3c.dom.Element appendSectorResolutionLimit(org.w3c.dom.Element context, java.lang.String path, LevelSet.SectorResolution sectorResolution)Append a heirarcy of new elements with a path to a context element, ending with an element formatted as a LevelSet.SectorResolutionLimit. Elements are added to the context as inappendElementPath(org.w3c.dom.Element, String), except that a terminating text element is appended to the last element.- Parameters:
context- the context on which to append new elements.path- the element path to append.sectorResolution- the LevelSet.SectorResolutionLimit value to create.- Returns:
- the new element appended to the context, or the context if the element path is null or empty.
- Throws:
java.lang.IllegalArgumentException- if the context is null.
-
appendTimeInMillis
public static org.w3c.dom.Element appendTimeInMillis(org.w3c.dom.Element context, java.lang.String path, long timeInMillis)Append a heirarcy of new elements with a path to a context element, ending with an element formatted as a time in milliseconds. Elements are added to the context as inappendElementPath(org.w3c.dom.Element, String), except that a terminating text element is appended to the last element.- Parameters:
context- the context on which to append new elements.path- the element path to append.timeInMillis- the time value in milliseconds to create.- Returns:
- the new element appended to the context, or the context if the element path is null or empty.
- Throws:
java.lang.IllegalArgumentException- if the context is null.
-
appendScreenCredit
public static org.w3c.dom.Element appendScreenCredit(org.w3c.dom.Element context, java.lang.String path, ScreenCredit screenCredit)Append a heirarcy of new elements with a path to a context element, ending with an element formatted as a ScreenCredit. Elements are added to the context as inappendElementPath(org.w3c.dom.Element, String), except that a terminating text element is appended to the last element.- Parameters:
context- the context on which to append new elements.path- the element path to append.screenCredit- the ScreenCredit value to create.- Returns:
- the new element appended to the context, or the context if the element path is null or empty.
- Throws:
java.lang.IllegalArgumentException- if the context is null.
-
setTextAttribute
public static void setTextAttribute(org.w3c.dom.Element context, java.lang.String name, java.lang.String value)Sets the element's attribute with the specified name to the specified String value. If the element already has an attribute with this name, its value is repaced with the specified value.- Parameters:
context- the element on which to set the attribute.name- the attribute's name.value- the attribute's value.- Throws:
java.lang.IllegalArgumentException- if the context is null, if the name is null, or if the name is empty.
-
setDoubleAttribute
public static void setDoubleAttribute(org.w3c.dom.Element context, java.lang.String name, double value)Sets the element's attribute with the specified name to the specified double value, converted to a String. If the element already has an attribute with this name, its value is repaced with the specified value.- Parameters:
context- the Element on which to set the attribute.name- the attribute's name.value- the attribute's value.- Throws:
java.lang.IllegalArgumentException- if the context is null, if the name is null, or if the name is empty.
-
setIntegerAttribute
public static void setIntegerAttribute(org.w3c.dom.Element context, java.lang.String name, int value)Sets the element's attribute with the specified name to the specified integer value, converted to a String. If the element already has an attribute with this name, its value is repaced with the specified value.- Parameters:
context- the element on which to set the attribute.name- the attribute's name.value- the attribute's value.- Throws:
java.lang.IllegalArgumentException- if the context is null, if the name is null, or if the name is empty.
-
setLongAttribute
public static void setLongAttribute(org.w3c.dom.Element context, java.lang.String name, long value)Sets the element's attribute with the specified name to the specified long integer value, converted to a String. If the element already has an attribute with this name, its value is repaced with the specified value.- Parameters:
context- the element on which to set the attribute.name- the attribute's name.value- the attribute's value.- Throws:
java.lang.IllegalArgumentException- if the context is null, if the name is null, or if the name is empty.
-
setBooleanAttribute
public static void setBooleanAttribute(org.w3c.dom.Element context, java.lang.String name, boolean value)Sets the element's attribute with the specified name to the specified boolean value, converted to a String. If the element already has an attribute with this name, its value is repaced with the specified value.- Parameters:
context- the element on which to set the attribute.name- the attribute's name.value- the attribute's value.- Throws:
java.lang.IllegalArgumentException- if the context is null, if the name is null, or if the name is empty.
-
checkAndSetStringParam
public static void checkAndSetStringParam(org.w3c.dom.Element context, AVList params, java.lang.String paramKey, java.lang.String paramName, javax.xml.xpath.XPath xpath)Checks a parameter list for a specified key and if not present attempts to find a value for the key from an element matched by an XPath expression. If found, the key and value are added to the parameter list.- Parameters:
context- the context from which to start the XPath search.params- the parameter list.paramKey- the key used to identify the paramater in the parameter list.paramName- the Xpath expression identifying the parameter value within the specified context.xpath- anXPathobject to use for the search. This allows the caller to re-use XPath objects when performing multiple searches. May be null.- Throws:
java.lang.IllegalArgumentException- if either the context, parameter list, parameter key or parameter name are null.
-
checkAndSetStringArrayParam
public static void checkAndSetStringArrayParam(org.w3c.dom.Element context, AVList params, java.lang.String paramKey, java.lang.String paramName, javax.xml.xpath.XPath xpath)Checks a parameter list for a specified key and if not present attempts to find a value for the key from an element matched by an XPath expression. If found, the key and value are added to the parameter list.- Parameters:
context- the context from which to start the XPath search.params- the parameter list.paramKey- the key used to identify the paramater in the parameter list.paramName- the Xpath expression identifying the parameter value within the specified context.xpath- anXPathobject to use for the search. This allows the caller to re-use XPath objects when performing multiple searches. May be null.- Throws:
java.lang.IllegalArgumentException- if either the context, parameter list, parameter key or parameter name are null.
-
checkAndSetUniqueStringsParam
public static void checkAndSetUniqueStringsParam(org.w3c.dom.Element context, AVList params, java.lang.String paramKey, java.lang.String paramName, javax.xml.xpath.XPath xpath)Checks a parameter list for a specified key and if not present attempts to find a value for the key from an element matched by an XPath expression. If found, the key and value are added to the parameter list.- Parameters:
context- the context from which to start the XPath search.params- the parameter list.paramKey- the key used to identify the paramater in the parameter list.paramName- the Xpath expression identifying the parameter value within the specified context.xpath- anXPathobject to use for the search. This allows the caller to re-use XPath objects when performing multiple searches. May be null.- Throws:
java.lang.IllegalArgumentException- if either the context, parameter list, parameter key or parameter name are null.
-
checkAndSetDoubleParam
public static void checkAndSetDoubleParam(org.w3c.dom.Element context, AVList params, java.lang.String paramKey, java.lang.String paramName, javax.xml.xpath.XPath xpath)Checks a parameter list for a specified key and if not present attempts to find a value for the key from an element matched by an XPath expression. If found, the key and value are added to the parameter list.- Parameters:
context- the context from which to start the XPath search.params- the parameter list.paramKey- the key used to identify the paramater in the parameter list.paramName- the Xpath expression identifying the parameter value within the specified context.xpath- anXPathobject to use for the search. This allows the caller to re-use XPath objects when performing multiple searches. May be null.- Throws:
java.lang.IllegalArgumentException- if either the context, parameter list, parameter key or parameter name are null.
-
checkAndSetIntegerParam
public static void checkAndSetIntegerParam(org.w3c.dom.Element context, AVList params, java.lang.String paramKey, java.lang.String paramName, javax.xml.xpath.XPath xpath)Checks a parameter list for a specified key and if not present attempts to find a value for the key from an element matched by an XPath expression. If found, the key and value are added to the parameter list.- Parameters:
context- the context from which to start the XPath search.params- the parameter list.paramKey- the key used to identify the paramater in the parameter list.paramName- the Xpath expression identifying the parameter value within the specified context.xpath- anXPathobject to use for the search. This allows the caller to re-use XPath objects when performing multiple searches. May be null.- Throws:
java.lang.IllegalArgumentException- if either the context, parameter list, parameter key or parameter name are null.
-
checkAndSetLongParam
public static void checkAndSetLongParam(org.w3c.dom.Element context, AVList params, java.lang.String paramKey, java.lang.String paramName, javax.xml.xpath.XPath xpath)Checks a parameter list for a specified key and if not present attempts to find a value for the key from an element matched by an XPath expression. If found, the key and value are added to the parameter list.- Parameters:
context- the context from which to start the XPath search.params- the parameter list.paramKey- the key used to identify the paramater in the parameter list.paramName- the Xpath expression identifying the parameter value within the specified context.xpath- anXPathobject to use for the search. This allows the caller to re-use XPath objects when performing multiple searches. May be null.- Throws:
java.lang.IllegalArgumentException- if either the context, parameter list, parameter key or parameter name are null.
-
checkAndSetBooleanParam
public static void checkAndSetBooleanParam(org.w3c.dom.Element context, AVList params, java.lang.String paramKey, java.lang.String paramName, javax.xml.xpath.XPath xpath)Checks a parameter list for a specified key and if not present attempts to find a value for the key from an element matched by an XPath expression. If found, the key and value are added to the parameter list.- Parameters:
context- the context from which to start the XPath search.params- the parameter list.paramKey- the key used to identify the paramater in the parameter list.paramName- the Xpath expression identifying the parameter value within the specified context.xpath- anXPathobject to use for the search. This allows the caller to re-use XPath objects when performing multiple searches. May be null.- Throws:
java.lang.IllegalArgumentException- if either the context, parameter list, parameter key or parameter name are null.
-
checkAndSetLatLonParam
public static void checkAndSetLatLonParam(org.w3c.dom.Element context, AVList params, java.lang.String paramKey, java.lang.String paramName, javax.xml.xpath.XPath xpath)Checks a parameter list for a specified key and if not present attempts to find a value for the key from an element matched by an XPath expression. If found, the key and value are added to the parameter list.- Parameters:
context- the context from which to start the XPath search.params- the parameter list.paramKey- the key used to identify the paramater in the parameter list.paramName- the Xpath expression identifying the parameter value within the specified context.xpath- anXPathobject to use for the search. This allows the caller to re-use XPath objects when performing multiple searches. May be null.- Throws:
java.lang.IllegalArgumentException- if either the context, parameter list, parameter key or parameter name are null.
-
checkAndSetColorParam
public static void checkAndSetColorParam(org.w3c.dom.Element context, AVList params, java.lang.String paramKey, java.lang.String paramName, javax.xml.xpath.XPath xpath)Checks a parameter list for a specified key and if not present attempts to find a value for the key from an element matched by an XPath expression. If found, the key and value are added to the parameter list.- Parameters:
context- the context from which to start the XPath search.params- the parameter list.paramKey- the key used to identify the paramater in the parameter list.paramName- the Xpath expression identifying the parameter value within the specified context.xpath- anXPathobject to use for the search. This allows the caller to re-use XPath objects when performing multiple searches. May be null.- Throws:
java.lang.IllegalArgumentException- if either the context, parameter list, parameter key or parameter name are null.
-
checkAndSetColorArrayParam
public static void checkAndSetColorArrayParam(org.w3c.dom.Element context, AVList params, java.lang.String paramKey, java.lang.String paramName, javax.xml.xpath.XPath xpath)
-
checkAndSetSectorParam
public static void checkAndSetSectorParam(org.w3c.dom.Element context, AVList params, java.lang.String paramKey, java.lang.String paramName, javax.xml.xpath.XPath xpath)Checks a parameter list for a specified key and if not present attempts to find a value for the key from an element matched by an XPath expression. If found, the key and value are added to the parameter list.- Parameters:
context- the context from which to start the XPath search.params- the parameter list.paramKey- the key used to identify the paramater in the parameter list.paramName- the Xpath expression identifying the parameter value within the specified context.xpath- anXPathobject to use for the search. This allows the caller to re-use XPath objects when performing multiple searches. May be null.- Throws:
java.lang.IllegalArgumentException- if either the context, parameter list, parameter key or parameter name are null.
-
checkAndSetSectorResolutionParam
public static void checkAndSetSectorResolutionParam(org.w3c.dom.Element context, AVList params, java.lang.String paramKey, java.lang.String paramName, javax.xml.xpath.XPath xpath)Checks a parameter list for a specified key and if not present attempts to find a value for the key from an element matched by an XPath expression. If found, the key and value are added to the parameter list.- Parameters:
context- the context from which to start the XPath search.params- the parameter list.paramKey- the key used to identify the paramater in the parameter list.paramName- the Xpath expression identifying the parameter value within the specified context.xpath- anXPathobject to use for the search. This allows the caller to re-use XPath objects when performing multiple searches. May be null.- Throws:
java.lang.IllegalArgumentException- if either the context, parameter list, parameter key or parameter name are null.
-
checkAndSetTimeParam
public static void checkAndSetTimeParam(org.w3c.dom.Element context, AVList params, java.lang.String paramKey, java.lang.String paramName, javax.xml.xpath.XPath xpath)Checks a parameter list for a specified key and if not present attempts to find a value for the key from an element matched by an XPath expression. If found, the key and value are added to the parameter list.- Parameters:
context- the context from which to start the XPath search.params- the parameter list.paramKey- the key used to identify the paramater in the parameter list.paramName- the Xpath expression identifying the parameter value within the specified context.xpath- anXPathobject to use for the search. This allows the caller to re-use XPath objects when performing multiple searches. May be null.- Throws:
java.lang.IllegalArgumentException- if either the context, parameter list, parameter key or parameter name are null.
-
checkAndSetTimeParamAsInteger
public static void checkAndSetTimeParamAsInteger(org.w3c.dom.Element context, AVList params, java.lang.String paramKey, java.lang.String paramName, javax.xml.xpath.XPath xpath)Checks a parameter list for a specified key and if not present attempts to find a value for the key from an element matched by an XPath expression. If found, the key and value are added to the parameter list.- Parameters:
context- the context from which to start the XPath search.params- the parameter list.paramKey- the key used to identify the paramater in the parameter list.paramName- the Xpath expression identifying the parameter value within the specified context.xpath- anXPathobject to use for the search. This allows the caller to re-use XPath objects when performing multiple searches. May be null.- Throws:
java.lang.IllegalArgumentException- if either the context, parameter list, parameter key or parameter name are null.
-
checkAndSetDateTimeParam
public static void checkAndSetDateTimeParam(org.w3c.dom.Element context, AVList params, java.lang.String paramKey, java.lang.String paramName, java.lang.String pattern, javax.xml.xpath.XPath xpath)Checks a parameter list for a specified key and if not present attempts to find a value for the key from an element matched by an XPath expression. If found, the key and value are added to the parameter list.- Parameters:
context- the context from which to start the XPath search.params- the parameter list.paramKey- the key used to identify the paramater in the parameter list.paramName- the Xpath expression identifying the parameter value within the specified context.pattern- the format pattern of the date. SeeDateFormatfor the pattern symbols. The element content must either match the pattern or be directly convertible to a long.xpath- anXPathobject to use for the search. This allows the caller to re-use XPath objects when performing multiple searches. May be null.- Throws:
java.lang.IllegalArgumentException- if either the context, parameter list, parameter key, pattern or parameter name are null.
-
checkAndSetScreenCreditParam
public static void checkAndSetScreenCreditParam(org.w3c.dom.Element context, AVList params, java.lang.String paramKey, java.lang.String paramName, javax.xml.xpath.XPath xpath)Checks a parameter list for a specified key and if not present attempts to find a value for the key from an element matched by an XPath expression. If found, the key and value are added to the parameter list.- Parameters:
context- the context from which to start the XPath search.params- the parameter list.paramKey- the key used to identify the paramater in the parameter list.paramName- the Xpath expression identifying the parameter value within the specified context.xpath- anXPathobject to use for the search. This allows the caller to re-use XPath objects when performing multiple searches. May be null.- Throws:
java.lang.IllegalArgumentException- if either the context, parameter list, parameter key or parameter name are null.
-
checkAndAppendTextElement
public static void checkAndAppendTextElement(AVList params, java.lang.String paramKey, org.w3c.dom.Element context, java.lang.String path)
Checks a parameter list for a specified key and if present attempts to append new elements represeting the parameter to a specified context.- Parameters:
context- the context on which to append new elements.params- the parameter list.paramKey- the key used to identify the paramater in the parameter list.path- the element path to append.- Throws:
java.lang.IllegalArgumentException- if either the parameter list parameter key, or context are null.
-
checkAndAppendTextArrayElement
public static void checkAndAppendTextArrayElement(AVList params, java.lang.String paramKey, org.w3c.dom.Element context, java.lang.String path)
Checks a parameter list for a specified key and if present attempts to append new elements represeting the parameter to a specified context.- Parameters:
context- the context on which to append new elements.params- the parameter list.paramKey- the key used to identify the paramater in the parameter list.path- the element path to append.- Throws:
java.lang.IllegalArgumentException- if either the parameter list parameter key, or context are null.
-
checkAndAppendDoubleElement
public static void checkAndAppendDoubleElement(AVList params, java.lang.String paramKey, org.w3c.dom.Element context, java.lang.String path)
Checks a parameter list for a specified key and if present attempts to append new elements represeting the parameter to a specified context.- Parameters:
context- the context on which to append new elements.params- the parameter list.paramKey- the key used to identify the paramater in the parameter list.path- the element path to append.- Throws:
java.lang.IllegalArgumentException- if either the parameter list parameter key, or context are null.
-
checkAndAppendIntegerlement
public static void checkAndAppendIntegerlement(AVList params, java.lang.String paramKey, org.w3c.dom.Element context, java.lang.String path)
Checks a parameter list for a specified key and if present attempts to append new elements represeting the parameter to a specified context.- Parameters:
context- the context on which to append new elements.params- the parameter list.paramKey- the key used to identify the paramater in the parameter list.path- the element path to append.- Throws:
java.lang.IllegalArgumentException- if either the parameter list parameter key, or context are null.
-
checkAndAppendLongElement
public static void checkAndAppendLongElement(AVList params, java.lang.String paramKey, org.w3c.dom.Element context, java.lang.String path)
Checks a parameter list for a specified key and if present attempts to append new elements represeting the parameter to a specified context.- Parameters:
context- the context on which to append new elements.params- the parameter list.paramKey- the key used to identify the paramater in the parameter list.path- the element path to append.- Throws:
java.lang.IllegalArgumentException- if either the parameter list parameter key, or context are null.
-
checkAndAppendBooleanElement
public static void checkAndAppendBooleanElement(AVList params, java.lang.String paramKey, org.w3c.dom.Element context, java.lang.String path)
Checks a parameter list for a specified key and if present attempts to append new elements represeting the parameter to a specified context.- Parameters:
context- the context on which to append new elements.params- the parameter list.paramKey- the key used to identify the paramater in the parameter list.path- the element path to append.- Throws:
java.lang.IllegalArgumentException- if either the parameter list parameter key, or context are null.
-
checkAndAppendLatLonElement
public static void checkAndAppendLatLonElement(AVList params, java.lang.String paramKey, org.w3c.dom.Element context, java.lang.String path)
Checks a parameter list for a specified key and if present attempts to append new elements represeting the parameter to a specified context.- Parameters:
context- the context on which to append new elements.params- the parameter list.paramKey- the key used to identify the paramater in the parameter list.path- the element path to append.- Throws:
java.lang.IllegalArgumentException- if either the parameter list parameter key, or context are null.
-
checkAndAppendSectorElement
public static void checkAndAppendSectorElement(AVList params, java.lang.String paramKey, org.w3c.dom.Element context, java.lang.String path)
Checks a parameter list for a specified key and if present attempts to append new elements represeting the parameter to a specified context.- Parameters:
context- the context on which to append new elements.params- the parameter list.paramKey- the key used to identify the paramater in the parameter list.path- the element path to append.- Throws:
java.lang.IllegalArgumentException- if either the parameter list parameter key, or context are null.
-
checkAndAppendSectorResolutionElement
public static void checkAndAppendSectorResolutionElement(AVList params, java.lang.String paramKey, org.w3c.dom.Element context, java.lang.String path)
Checks a parameter list for a specified key and if present attempts to append new elements represeting the parameter to a specified context.- Parameters:
context- the context on which to append new elements.params- the parameter list.paramKey- the key used to identify the paramater in the parameter list.path- the element path to append.- Throws:
java.lang.IllegalArgumentException- if either the parameter list parameter key, or context are null.
-
checkAndAppendTimeElement
public static void checkAndAppendTimeElement(AVList params, java.lang.String paramKey, org.w3c.dom.Element context, java.lang.String path)
Checks a parameter list for a specified key and if present attempts to append new elements represeting the parameter to a specified context.- Parameters:
context- the context on which to append new elements.params- the parameter list.paramKey- the key used to identify the paramater in the parameter list.path- the element path to append.- Throws:
java.lang.IllegalArgumentException- if either the parameter list parameter key, or context are null.
-
checkAndAppendScreenCreditElement
public static void checkAndAppendScreenCreditElement(AVList params, java.lang.String paramKey, org.w3c.dom.Element context, java.lang.String path)
Checks a parameter list for a specified key and if present attempts to append new elements represeting the parameter to a specified context.- Parameters:
context- the context on which to append new elements.params- the parameter list.paramKey- the key used to identify the paramater in the parameter list.path- the element path to append.- Throws:
java.lang.IllegalArgumentException- if either the parameter list parameter key, or context are null.
-
fixGetMapString
public static java.lang.String fixGetMapString(java.lang.String gms)
-
parseByteOrder
public static java.lang.String parseByteOrder(java.lang.String s)
Returns the byte order constant for a specified string. This performs a mapping between text and an AVKey constant:Mapping Text Constant LittleEndian AVKey.LITTLE_ENDIANBigEndian AVKey.BIG_ENDIAN- Parameters:
s- the string to parse as a byte order.- Returns:
- a byte order constant, or null if the string text is not recognized.
- Throws:
java.lang.IllegalArgumentException- if the string is null.
-
byteOrderAsText
public static java.lang.String byteOrderAsText(java.lang.String byteOrder)
Returns the string text for a specified byte order constant. This performs a mapping between text and an AVKey constant:Mapping Text Constant LittleEndian AVKey.LITTLE_ENDIANBigEndian AVKey.BIG_ENDIAN- Parameters:
byteOrder- the byte order constant to encode as a string.- Returns:
- a string representing the byte order constant, or null if the byte order constant is not recognized.
- Throws:
java.lang.IllegalArgumentException- if the byte order is null.
-
parseDataType
public static java.lang.String parseDataType(java.lang.String s)
Returns the data type constant for a specified string. This performs a mapping between text and an AVKey constant:Mapping Text Constant Float32 AVKey.FLOAT32Int32 AVKey.INT32Int16 AVKey.INT16Int8 AVKey.INT8- Parameters:
s- the string to parse as a data type.- Returns:
- a data type constant, or null if the string text is not recognized.
- Throws:
java.lang.IllegalArgumentException- if the string is null.
-
dataTypeAsText
public static java.lang.String dataTypeAsText(java.lang.String dataType)
Returns the string text for a specified data type constant. This performs a mapping between text and an AVKey constant:Mapping Text Constant Float32 AVKey.FLOAT32Int32 AVKey.INT32Int16 AVKey.INT16Int8 AVKey.INT8- Parameters:
dataType- the data type constant to encode as a string.- Returns:
- a string representing the data type constant, or null if the data type constant is not recognized.
- Throws:
java.lang.IllegalArgumentException- if the data type is null.
-
copyProperties
public static AVList copyProperties(org.w3c.dom.Element element, AVList params)
Copy anyPropertyelements in an XML document to an attribute-value list.- Parameters:
element- the XML element potentially containingPropertyelements.params- an attribute-value list to copy the properties to.- Returns:
- if an attribute-value list is specified, the reference to that list now containing any properties copied from the XML element. If an attribute-value list is not specified and properties exist in the XML element, a new attribute-value list containing those properties. Otherwise null is returned.
- Throws:
java.lang.IllegalArgumentException- if the specified element is null.
-
invokePropertySetters
public static void invokePropertySetters(java.lang.Object parent, org.w3c.dom.Element domElement)Uses reflection to invoke property methods on an object, with the properties specified in an XML document. For each element named "Property" in the document, the corresponding set method is called on the specified object, if such a method exists.- Parameters:
parent- the object on which to set the properties.domElement- the XML document containing the properties.- Throws:
java.lang.IllegalArgumentException- if the specified object or XML document element is null.- See Also:
WWUtil.invokePropertyMethod(Object, String, String)
-
-