org.eclipse.rdf4j.query.resultio.sparqlxml

## Class AbstractSPARQLXMLParser

- java.lang.Object
- - org.eclipse.rdf4j.query.resultio.AbstractQueryResultParser
  - - org.eclipse.rdf4j.query.resultio.sparqlxml.AbstractSPARQLXMLParser

- All Implemented Interfaces:
    QueryResultParser, ErrorHandler
  Direct Known Subclasses:
    SPARQLBooleanXMLParser, SPARQLResultsXMLParser, SPARQLXMLParserBase

      public abstract class AbstractSPARQLXMLParser
      extends AbstractQueryResultParser
      implements ErrorHandler

  Abstract base class for SPARQL Results XML Parsers.
  Author:
    Peter Ansell

- - ### Field Summary

    - ### Fields inherited from class org.eclipse.rdf4j.query.resultio.AbstractQueryResultParser

      `handler, valueFactory`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractSPARQLXMLParser()`
    `protected` | `AbstractSPARQLXMLParser(ValueFactory valueFactory)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `error(SAXParseException exception)`
    `void` | `fatalError(SAXParseException exception)`
    `Collection<RioSetting<Boolean>>` | `getCompulsoryXmlFeatureSettings()` Returns a collection of settings that will always be set as XML parser features using `XMLReader.setFeature(String, boolean)`.
    `Collection<RioSetting<?>>` | `getCompulsoryXmlPropertySettings()` Returns a collection of settings that will always be set as XML parser properties using `XMLReader.setProperty(String, Object)`
    `Collection<RioSetting<Boolean>>` | `getOptionalXmlFeatureSettings()` Returns a collection of settings that will be used, if set in `AbstractQueryResultParser.getParserConfig()`, as XML parser features using `XMLReader.setFeature(String, boolean)`.
    `Collection<RioSetting<?>>` | `getOptionalXmlPropertySettings()` Returns a collection of settings that will be used, if set in `AbstractQueryResultParser.getParserConfig()`, as XML parser properties using `XMLReader.setProperty(String, Object)`
    `Collection<RioSetting<?>>` | `getSupportedSettings()`
    `void` | `parseQueryResult(InputStream in)` Parse the query results out of the given `InputStream` into the handler setup using `QueryResultParser.setQueryResultHandler(QueryResultHandler)`.
    `protected boolean` | `parseQueryResultInternal(InputStream in, boolean attemptParseBoolean, boolean attemptParseTuple)`
    `protected void` | `reportWarning(String msg)`
    `void` | `warning(SAXParseException exception)`

    - ### Methods inherited from class org.eclipse.rdf4j.query.resultio.AbstractQueryResultParser

      `getParseErrorListener, getParseLocationListener, getParserConfig, set, setParseErrorListener, setParseLocationListener, setParserConfig, setQueryResultHandler, setValueFactory`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.eclipse.rdf4j.query.resultio.QueryResultParser

      `getQueryResultFormat`

- - ### Constructor Detail

    - #### AbstractSPARQLXMLParser

          protected AbstractSPARQLXMLParser()

    - #### AbstractSPARQLXMLParser

          protected AbstractSPARQLXMLParser(ValueFactory valueFactory)

  - ### Method Detail

    - #### parseQueryResult

          public void parseQueryResult(InputStream in)
                                throws IOException,
                                       QueryResultParseException,
                                       QueryResultHandlerException

      Description copied from interface: `QueryResultParser`
      Parse the query results out of the given `InputStream` into the handler setup using `QueryResultParser.setQueryResultHandler(QueryResultHandler)`.
      Specified by:
        `parseQueryResult` in interface `QueryResultParser`
      Parameters:
        `in` - The `InputStream` to parse the results from.
      Throws:
        `IOException` - If there is an exception from the InputStream.
        `QueryResultParseException` - If the query results are not parsable by this parser.
        `QueryResultHandlerException` - If the `QueryResultHandler` set in `QueryResultParser.setQueryResultHandler(QueryResultHandler)` throws an exception.

    - #### parseQueryResultInternal

          protected boolean parseQueryResultInternal(InputStream in,
                                                     boolean attemptParseBoolean,
                                                     boolean attemptParseTuple)
                                              throws IOException,
                                                     QueryResultParseException,
                                                     QueryResultHandlerException

      Throws:
        `IOException`
        `QueryResultParseException`
        `QueryResultHandlerException`

    - #### reportWarning

          protected void reportWarning(String msg)

    - #### getCompulsoryXmlPropertySettings

          public Collection<RioSetting<?>> getCompulsoryXmlPropertySettings()

      Returns a collection of settings that will always be set as XML parser properties using `XMLReader.setProperty(String, Object)`

      Subclasses can override this to specify more supported settings.

      Returns:
        A collection of `RioSetting`s that indicate which properties will always be setup using `XMLReader.setProperty(String, Object)`.

    - #### getCompulsoryXmlFeatureSettings

          public Collection<RioSetting<Boolean>> getCompulsoryXmlFeatureSettings()

      Returns a collection of settings that will always be set as XML parser features using `XMLReader.setFeature(String, boolean)`.

      Subclasses can override this to specify more supported settings.

      Returns:
        A collection of `RioSetting`s that indicate which boolean settings will always be setup using `XMLReader.setFeature(String, boolean)`.

    - #### getOptionalXmlPropertySettings

          public Collection<RioSetting<?>> getOptionalXmlPropertySettings()

      Returns a collection of settings that will be used, if set in `AbstractQueryResultParser.getParserConfig()`, as XML parser properties using `XMLReader.setProperty(String, Object)`

      Subclasses can override this to specify more supported settings.

      Returns:
        A collection of `RioSetting`s that indicate which properties can be setup using `XMLReader.setProperty(String, Object)`.

    - #### getOptionalXmlFeatureSettings

          public Collection<RioSetting<Boolean>> getOptionalXmlFeatureSettings()

      Returns a collection of settings that will be used, if set in `AbstractQueryResultParser.getParserConfig()`, as XML parser features using `XMLReader.setFeature(String, boolean)`.

      Subclasses can override this to specify more supported settings.

      Returns:
        A collection of `RioSetting`s that indicate which boolean settings can be setup using `XMLReader.setFeature(String, boolean)`.

    - #### getSupportedSettings

          public Collection<RioSetting<?>> getSupportedSettings()

      Specified by:
        `getSupportedSettings` in interface `QueryResultParser`
      Overrides:
        `getSupportedSettings` in class `AbstractQueryResultParser`
      Returns:
        A collection of `RioSetting`s that are supported by this QueryResultParser.

    - #### warning

          public void warning(SAXParseException exception)
                       throws SAXException

      Specified by:
        `warning` in interface `ErrorHandler`
      Throws:
        `SAXException`

    - #### error

          public void error(SAXParseException exception)
                     throws SAXException

      Specified by:
        `error` in interface `ErrorHandler`
      Throws:
        `SAXException`

    - #### fatalError

          public void fatalError(SAXParseException exception)
                          throws SAXException

      Specified by:
        `fatalError` in interface `ErrorHandler`
      Throws:
        `SAXException`

Copyright © 2015-2020 Eclipse Foundation. All Rights Reserved.