Class GetCapabilitiesParseHelper


  • public final class GetCapabilitiesParseHelper
    extends java.lang.Object
    Helper class for handling OGC GetCapabilities documents
    Since:
    10993
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String crsToCode​(java.lang.String crsIdentifier)
      Convert CRS identifier to plain code
      static java.lang.String getElementTextWithSubtags​(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.XMLStreamReader getReader​(java.io.InputStream in)
      Returns reader with properties set for parsing WM(T)S documents
      static GetCapabilitiesParseHelper.TransferMode getTransferMode​(javax.xml.stream.XMLStreamReader reader)
      Parses Operation[@name='GetTile']/DCP/HTTP/Get section.
      static void moveReaderToEndCurrentTag​(javax.xml.stream.XMLStreamReader reader)
      Moves the reader to the closing tag of current tag.
      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)
      Moves reader to first occurrence of the structure equivalent of Xpath tags[0]/tags[1]../tags[n].
      static boolean moveReaderToTag​(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.String normalizeCapabilitiesUrl​(java.lang.String url)
      Normalize url
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 tags
        reader - XMLStreamReader which should be moved
        Returns:
        true if tag was found, false otherwise
        Throws:
        javax.xml.stream.XMLStreamException - See XMLStreamReader
      • 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 tags
        reader - XMLStreamReader which should be moved
        equalsFunc - function to check equality of the tags
        Returns:
        true if tag was found, false otherwise
        Throws:
        javax.xml.stream.XMLStreamException - See XMLStreamReader
      • 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 - See XMLStreamReader
      • 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