Class GetCapabilitiesParseHelper
- java.lang.Object
-
- org.openstreetmap.josm.data.imagery.GetCapabilitiesParseHelper
-
public final class GetCapabilitiesParseHelper extends java.lang.Object
Helper class for handling OGC GetCapabilities documents- Since:
- 10993
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classGetCapabilitiesParseHelper.TransferMode
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringOWS_NS_URLOWS namespace address(package private) static javax.xml.namespace.QNameQN_OWS_ALLOWED_VALUESQNames in OWS namespace(package private) static javax.xml.namespace.QNameQN_OWS_CONSTRAINT(package private) static javax.xml.namespace.QNameQN_OWS_DCP(package private) static javax.xml.namespace.QNameQN_OWS_GET(package private) static javax.xml.namespace.QNameQN_OWS_HTTP(package private) static javax.xml.namespace.QNameQN_OWS_IDENTIFIER(package private) static javax.xml.namespace.QNameQN_OWS_LOWER_CORNER(package private) static javax.xml.namespace.QNameQN_OWS_OPERATION(package private) static javax.xml.namespace.QNameQN_OWS_OPERATIONS_METADATA(package private) static javax.xml.namespace.QNameQN_OWS_SUPPORTED_CRS(package private) static javax.xml.namespace.QNameQN_OWS_TITLE(package private) static javax.xml.namespace.QNameQN_OWS_UPPER_CORNER(package private) static javax.xml.namespace.QNameQN_OWS_VALUE(package private) static javax.xml.namespace.QNameQN_OWS_WGS84_BOUNDING_BOXstatic java.lang.StringXLINK_NS_URLXML xlink namespace address
-
Constructor Summary
Constructors Modifier Constructor Description privateGetCapabilitiesParseHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringcrsToCode(java.lang.String crsIdentifier)Convert CRS identifier to plain codestatic java.lang.StringgetElementTextWithSubtags(javax.xml.stream.XMLStreamReader reader)Returns whole content of the element that reader is pointing at, including other XML elements within (with their tags).static javax.xml.stream.XMLStreamReadergetReader(java.io.InputStream in)Returns reader with properties set for parsing WM(T)S documentsstatic GetCapabilitiesParseHelper.TransferModegetTransferMode(javax.xml.stream.XMLStreamReader reader)Parses Operation[@name='GetTile']/DCP/HTTP/Get section.static voidmoveReaderToEndCurrentTag(javax.xml.stream.XMLStreamReader reader)Moves the reader to the closing tag of current tag.static booleanmoveReaderToTag(javax.xml.stream.XMLStreamReader reader, java.util.function.BiPredicate<javax.xml.namespace.QName,javax.xml.namespace.QName> equalsFunc, javax.xml.namespace.QName... tags)Moves reader to first occurrence of the structure equivalent of Xpath tags[0]/tags[1]../tags[n].static booleanmoveReaderToTag(javax.xml.stream.XMLStreamReader reader, javax.xml.namespace.QName... tags)Moves reader to first occurrence of the structure equivalent of Xpath tags[0]/tags[1]../tags[n].static java.lang.StringnormalizeCapabilitiesUrl(java.lang.String url)Normalize url
-
-
-
Field Detail
-
OWS_NS_URL
public static final java.lang.String OWS_NS_URL
OWS namespace address- See Also:
- Constant Field Values
-
XLINK_NS_URL
public static final java.lang.String XLINK_NS_URL
XML xlink namespace address- See Also:
- Constant Field Values
-
QN_OWS_ALLOWED_VALUES
static final javax.xml.namespace.QName QN_OWS_ALLOWED_VALUES
QNames in OWS namespace
-
QN_OWS_CONSTRAINT
static final javax.xml.namespace.QName QN_OWS_CONSTRAINT
-
QN_OWS_DCP
static final javax.xml.namespace.QName QN_OWS_DCP
-
QN_OWS_GET
static final javax.xml.namespace.QName QN_OWS_GET
-
QN_OWS_HTTP
static final javax.xml.namespace.QName QN_OWS_HTTP
-
QN_OWS_IDENTIFIER
static final javax.xml.namespace.QName QN_OWS_IDENTIFIER
-
QN_OWS_LOWER_CORNER
static final javax.xml.namespace.QName QN_OWS_LOWER_CORNER
-
QN_OWS_OPERATION
static final javax.xml.namespace.QName QN_OWS_OPERATION
-
QN_OWS_OPERATIONS_METADATA
static final javax.xml.namespace.QName QN_OWS_OPERATIONS_METADATA
-
QN_OWS_SUPPORTED_CRS
static final javax.xml.namespace.QName QN_OWS_SUPPORTED_CRS
-
QN_OWS_TITLE
static final javax.xml.namespace.QName QN_OWS_TITLE
-
QN_OWS_UPPER_CORNER
static final javax.xml.namespace.QName QN_OWS_UPPER_CORNER
-
QN_OWS_VALUE
static final javax.xml.namespace.QName QN_OWS_VALUE
-
QN_OWS_WGS84_BOUNDING_BOX
static final javax.xml.namespace.QName QN_OWS_WGS84_BOUNDING_BOX
-
-
Constructor Detail
-
GetCapabilitiesParseHelper
private GetCapabilitiesParseHelper()
-
-
Method Detail
-
getReader
public static javax.xml.stream.XMLStreamReader getReader(java.io.InputStream in) throws javax.xml.stream.XMLStreamException
Returns reader with properties set for parsing WM(T)S documents- Parameters:
in- InputStream with pointing to GetCapabilities XML stream- Returns:
- safe XMLStreamReader, that is not validating external entities, nor loads DTD's
- Throws:
javax.xml.stream.XMLStreamException- if any XML stream error occurs
-
moveReaderToEndCurrentTag
public static void moveReaderToEndCurrentTag(javax.xml.stream.XMLStreamReader reader) throws javax.xml.stream.XMLStreamException
Moves the reader to the closing tag of current tag.- Parameters:
reader- XMLStreamReader which should be moved- Throws:
javax.xml.stream.XMLStreamException- when parse exception occurs
-
getElementTextWithSubtags
public static java.lang.String getElementTextWithSubtags(javax.xml.stream.XMLStreamReader reader) throws javax.xml.stream.XMLStreamException
Returns whole content of the element that reader is pointing at, including other XML elements within (with their tags).- Parameters:
reader- XMLStreamReader that should point to start of element- Returns:
- content of current tag
- Throws:
javax.xml.stream.XMLStreamException- if any XML stream error occurs
-
moveReaderToTag
public static boolean moveReaderToTag(javax.xml.stream.XMLStreamReader reader, javax.xml.namespace.QName... tags) throws javax.xml.stream.XMLStreamException
Moves reader to first occurrence of the structure equivalent of Xpath tags[0]/tags[1]../tags[n]. If fails to find moves the reader to the closing tag of current tag- Parameters:
tags- array of tagsreader- XMLStreamReader which should be moved- Returns:
- true if tag was found, false otherwise
- Throws:
javax.xml.stream.XMLStreamException- SeeXMLStreamReader
-
moveReaderToTag
public static boolean moveReaderToTag(javax.xml.stream.XMLStreamReader reader, java.util.function.BiPredicate<javax.xml.namespace.QName,javax.xml.namespace.QName> equalsFunc, javax.xml.namespace.QName... tags) throws javax.xml.stream.XMLStreamException
Moves reader to first occurrence of the structure equivalent of Xpath tags[0]/tags[1]../tags[n]. If fails to find moves the reader to the closing tag of current tag- Parameters:
tags- array of tagsreader- XMLStreamReader which should be movedequalsFunc- function to check equality of the tags- Returns:
- true if tag was found, false otherwise
- Throws:
javax.xml.stream.XMLStreamException- SeeXMLStreamReader
-
getTransferMode
public static GetCapabilitiesParseHelper.TransferMode getTransferMode(javax.xml.stream.XMLStreamReader reader) throws javax.xml.stream.XMLStreamException
Parses Operation[@name='GetTile']/DCP/HTTP/Get section. Returns when reader is on Get closing tag.- Parameters:
reader- StAX reader instance- Returns:
- TransferMode coded in this section
- Throws:
javax.xml.stream.XMLStreamException- SeeXMLStreamReader
-
normalizeCapabilitiesUrl
public static java.lang.String normalizeCapabilitiesUrl(java.lang.String url) throws java.net.MalformedURLException
Normalize url- Parameters:
url- URL- Returns:
- normalized URL
- Throws:
java.net.MalformedURLException- in case of malformed URL- Since:
- 10993
-
crsToCode
public static java.lang.String crsToCode(java.lang.String crsIdentifier)
Convert CRS identifier to plain code- Parameters:
crsIdentifier- CRS identifier- Returns:
- CRS Identifier as it is used within JOSM (without prefix)
- See Also:
- Definition identifier URNs in OGC namespace, chapter 7.2: URNs for single objects
-
-