Interface XMLEventParserContext

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String UNRECOGNIZED_ELEMENT_PARSER
      Identifies the name of the parser handling unrecognized elements.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addBooleanIntegerParsers​(java.lang.String namespace, java.lang.String[] booleanIntegerFields)
      Add boolean integer parsers for a list of element types and qualified for a specified namespace.
      void addBooleanParsers​(java.lang.String namespace, java.lang.String[] booleanFields)
      Add boolean parsers for a list of element types and qualified for a specified namespace.
      void addDoubleParsers​(java.lang.String namespace, java.lang.String[] doubleFields)
      Add double parsers for a list of element types and qualified for a specified namespace.
      void addId​(java.lang.String id, java.lang.Object o)
      Adds a mapping of an id attribute to its associated KML object.
      void addIntegerParsers​(java.lang.String namespace, java.lang.String[] integerFields)
      Add integer parsers for a list of element types and qualified for a specified namespace.
      void addStringParsers​(java.lang.String namespace, java.lang.String[] stringFields)
      Add string list parsers for a list of element types and qualified for a specified namespace.
      XMLEventParser allocate​(javax.xml.stream.events.XMLEvent event)
      Create a parser for a specified event's element name, if a parser for that name is registered with the context.
      XMLEventParser allocate​(javax.xml.stream.events.XMLEvent event, XMLEventParser defaultParser)
      Create a parser for a specified event's element name, if a parser for that name is registered with the context.
      BooleanIntegerXMLEventParser getBooleanIntegerParser()
      Returns the default parser for a simple boolean integer (0 or 1).
      BooleanXMLEventParser getBooleanParser()
      Returns the default parser for a simple boolean.
      java.lang.String getCharacters​(javax.xml.stream.events.XMLEvent event)
      Returns the text associated with the event.
      java.lang.String getDefaultNamespaceURI()
      Returns the context's default namespace URI.
      DoubleXMLEventParser getDoubleParser()
      Returns a parser for a simple double.
      javax.xml.stream.XMLEventReader getEventReader()
      Returns the event reader associated with the context.
      java.util.Map<java.lang.String,​java.lang.Object> getIdTable()
      Returns the table associating objects with their id attribute as specified in the object's KML file.
      IntegerXMLEventParser getIntegerParser()
      Returns the default parser for a simple integer.
      XMLEventParser getParser​(javax.xml.namespace.QName eventName)
      Returns a new parser for a specified element name.
      XMLEventParser getParser​(javax.xml.stream.events.XMLEvent event)
      Returns a new parser for a specified event.
      StringXMLEventParser getStringParser()
      Returns the default parser for a simple string.
      XMLEventParser getUnrecognizedElementParser()
      Returns a parser to handle unrecognized elements.
      boolean hasNext()
      Indicates whether the event stream associated with this context contains another event.
      boolean isDefaultNamespace​(java.lang.String namespaceURI)
      Indicates whether the specified namespace URI is the default namespace URI used by this parser context.
      boolean isEndElement​(javax.xml.stream.events.XMLEvent event, javax.xml.stream.events.XMLEvent startElement)
      Determines whether an event is the corresponding end element for a specified start event.
      boolean isSameAttributeName​(javax.xml.namespace.QName qa, javax.xml.namespace.QName qb)
      Determines whether two fully qualified attribute names are the same.
      boolean isSameName​(javax.xml.namespace.QName qa, javax.xml.namespace.QName qb)
      Determines whether two element names are the same.
      boolean isStartElement​(javax.xml.stream.events.XMLEvent event, java.lang.String elementName)
      Determines whether an event is a start event for a specific event type indicated by its local name.
      boolean isStartElement​(javax.xml.stream.events.XMLEvent event, javax.xml.namespace.QName elementName)
      Determines whether an event is a start event for a specific event type.
      javax.xml.stream.events.XMLEvent nextEvent()
      Returns the next event in the event stream associated with this context.
      void registerParser​(javax.xml.namespace.QName elementName, XMLEventParser parser)
      Registers a parser for a specified element name.
      void setDefaultNamespaceURI​(java.lang.String defaultNamespaceURI)
      Specifies the context's default namespace URI.
      void setNotificationListener​(XMLParserNotificationListener listener)
      Specify the object to receive notifications, which are sent when exceptions occur during parsing and when unrecognized element types are encountered.
    • Field Detail

      • UNRECOGNIZED_ELEMENT_PARSER

        static final java.lang.String UNRECOGNIZED_ELEMENT_PARSER
        Identifies the name of the parser handling unrecognized elements. Can be used to explicitly specify the context's parser-table entry for unrecognized elements.
        See Also:
        Constant Field Values
    • Method Detail

      • getEventReader

        javax.xml.stream.XMLEventReader getEventReader()
        Returns the event reader associated with the context.
        Returns:
        the associated event reader, or null if no reader is associated.
      • getParser

        XMLEventParser getParser​(javax.xml.stream.events.XMLEvent event)
        Returns a new parser for a specified event.
        Parameters:
        event - indicates the element name for which a parser is created.
        Returns:
        the new parser, or null if no parser has been registered for the specified event's element name.
      • getParser

        XMLEventParser getParser​(javax.xml.namespace.QName eventName)
        Returns a new parser for a specified element name.
        Parameters:
        eventName - indicates the element name for which a parser is created.
        Returns:
        the new parser, or null if no parser has been registered for the specified element name.
      • isStartElement

        boolean isStartElement​(javax.xml.stream.events.XMLEvent event,
                               javax.xml.namespace.QName elementName)
        Determines whether an event is a start event for a specific event type.
        Parameters:
        event - an event identifying the event type of interest.
        elementName - the event name.
        Returns:
        true if the event is a start event for the named event type.
      • isStartElement

        boolean isStartElement​(javax.xml.stream.events.XMLEvent event,
                               java.lang.String elementName)
        Determines whether an event is a start event for a specific event type indicated by its local name.
        Parameters:
        event - an event identifying the event type of interest.
        elementName - the local part of the event name to match.
        Returns:
        true if the event is a start event for the named event type.
      • isEndElement

        boolean isEndElement​(javax.xml.stream.events.XMLEvent event,
                             javax.xml.stream.events.XMLEvent startElement)
        Determines whether an event is the corresponding end element for a specified start event.

        Note: Only the event's element name and type are compared. The method returns true if the start and end events are the corresponding event types for an element of the same name.

        Parameters:
        event - the event of interest.
        startElement - the start event associated with the potential end event.
        Returns:
        true if the event is the corresponding end event to the specified start event, otherwise false.
      • getCharacters

        java.lang.String getCharacters​(javax.xml.stream.events.XMLEvent event)
        Returns the text associated with the event.
        Parameters:
        event - the event of interest.
        Returns:
        the event's characters, or null if the event is not a character event.
      • getStringParser

        StringXMLEventParser getStringParser()
        Returns the default parser for a simple string.
        Returns:
        a string parser.
      • getDoubleParser

        DoubleXMLEventParser getDoubleParser()
        Returns a parser for a simple double.
        Returns:
        a double parser.
      • getBooleanParser

        BooleanXMLEventParser getBooleanParser()
        Returns the default parser for a simple boolean.
        Returns:
        a boolean parser.
      • getBooleanIntegerParser

        BooleanIntegerXMLEventParser getBooleanIntegerParser()
        Returns the default parser for a simple boolean integer (0 or 1).
        Returns:
        a boolean integer parser.
      • getIntegerParser

        IntegerXMLEventParser getIntegerParser()
        Returns the default parser for a simple integer.
        Returns:
        an integer parser.
      • registerParser

        void registerParser​(javax.xml.namespace.QName elementName,
                            XMLEventParser parser)
        Registers a parser for a specified element name. A parser of the same type and namespace is returned when getParser(javax.xml.stream.events.XMLEvent) is called for the same element name.
        Parameters:
        elementName - the element name for which to return a parser.
        parser - the parser to register.
      • hasNext

        boolean hasNext()
        Indicates whether the event stream associated with this context contains another event.
        Returns:
        true if the stream contains another event, otherwise false.
        See Also:
        XMLEventReader.hasNext()
      • nextEvent

        javax.xml.stream.events.XMLEvent nextEvent()
                                            throws javax.xml.stream.XMLStreamException
        Returns the next event in the event stream associated with this context.
        Returns:
        the next event,
        Throws:
        javax.xml.stream.XMLStreamException - if there is an error with the underlying XML.
        See Also:
        XMLEventReader.nextEvent()
      • getDefaultNamespaceURI

        java.lang.String getDefaultNamespaceURI()
        Returns the context's default namespace URI.
        Returns:
        the context's default namespace URI.
        See Also:
        setDefaultNamespaceURI(String)
      • isSameName

        boolean isSameName​(javax.xml.namespace.QName qa,
                           javax.xml.namespace.QName qb)
        Determines whether two element names are the same.
        Parameters:
        qa - first element name
        qb - second element name
        Returns:
        true if both names have the same namespace (or no namespace) and local name, or if either name has no namespace but the namespace of the other is the context's default namespace.
      • allocate

        XMLEventParser allocate​(javax.xml.stream.events.XMLEvent event,
                                XMLEventParser defaultParser)
        Create a parser for a specified event's element name, if a parser for that name is registered with the context.
        Parameters:
        event - the event whose element name identifies the parser to create.
        defaultParser - a parser to return if no parser is registered for the specified name. May be null.
        Returns:
        a new parser, or the specified default parser if no parser has been registered for the element name.
      • allocate

        XMLEventParser allocate​(javax.xml.stream.events.XMLEvent event)
        Create a parser for a specified event's element name, if a parser for that name is registered with the context.
        Parameters:
        event - the event whose element name identifies the parser to create.
        Returns:
        a new parser, or the specified default parser if no parser has been registered for the element name.
      • isSameAttributeName

        boolean isSameAttributeName​(javax.xml.namespace.QName qa,
                                    javax.xml.namespace.QName qb)
        Determines whether two fully qualified attribute names are the same.
        Parameters:
        qa - the first attribute name.
        qb - the second attribute name.
        Returns:
        true if the names are the same, otherwise false.
      • getIdTable

        java.util.Map<java.lang.String,​java.lang.Object> getIdTable()
        Returns the table associating objects with their id attribute as specified in the object's KML file.
        Returns:
        the mapping table.
      • addId

        void addId​(java.lang.String id,
                   java.lang.Object o)
        Adds a mapping of an id attribute to its associated KML object.
        Parameters:
        id - the object id. If null, this method returns without creating a mapping.
        o - the object to associate with the id.
      • setNotificationListener

        void setNotificationListener​(XMLParserNotificationListener listener)
        Specify the object to receive notifications, which are sent when exceptions occur during parsing and when unrecognized element types are encountered. See XMLParserNotification for more information.

        The parser context may have only one notification listener. That listener may be changed at any time.

        Parameters:
        listener - the object to receive notification events.
      • isDefaultNamespace

        boolean isDefaultNamespace​(java.lang.String namespaceURI)
        Indicates whether the specified namespace URI is the default namespace URI used by this parser context.
        Parameters:
        namespaceURI - the namespace URI to check.
        Returns:
        true if the specified namespace is the default namespace, otherwise false.
      • getUnrecognizedElementParser

        XMLEventParser getUnrecognizedElementParser()
        Returns a parser to handle unrecognized elements. The default unrecognized event parser is UnrecognizedXMLEventParser.
        Returns:
        a parser to handle unrecognized elements.
      • addStringParsers

        void addStringParsers​(java.lang.String namespace,
                              java.lang.String[] stringFields)
        Add string list parsers for a list of element types and qualified for a specified namespace.
        Parameters:
        namespace - the namespace URI.
        stringFields - the string list parser names.
      • addDoubleParsers

        void addDoubleParsers​(java.lang.String namespace,
                              java.lang.String[] doubleFields)
        Add double parsers for a list of element types and qualified for a specified namespace.
        Parameters:
        namespace - the namespace URI.
        doubleFields - the string parsers.
      • addIntegerParsers

        void addIntegerParsers​(java.lang.String namespace,
                               java.lang.String[] integerFields)
        Add integer parsers for a list of element types and qualified for a specified namespace.
        Parameters:
        namespace - the namespace URI.
        integerFields - the string parsers.
      • addBooleanParsers

        void addBooleanParsers​(java.lang.String namespace,
                               java.lang.String[] booleanFields)
        Add boolean parsers for a list of element types and qualified for a specified namespace.
        Parameters:
        namespace - the namespace URI.
        booleanFields - the string parsers.
      • addBooleanIntegerParsers

        void addBooleanIntegerParsers​(java.lang.String namespace,
                                      java.lang.String[] booleanIntegerFields)
        Add boolean integer parsers for a list of element types and qualified for a specified namespace.
        Parameters:
        namespace - the namespace URI.
        booleanIntegerFields - the string parser.