public class RDFXMLParser extends RDFParserBase
org.xml.sax.driver property. This parser is not
thread-safe, therefore it's public methods are synchronized.
To parse a document using this parser:
// Use the SAX2-compliant Xerces parser:
System.setProperty("org.xml.sax.driver", "org.apache.xerces.parsers.SAXParser");
RDFParser parser = new RDFXMLParser();
parser.setRDFHandler(myRDFHandler);
parser.setParseErrorListener(myParseErrorListener);
parser.setVerifyData(true);
parser.stopAtFirstError(false);
// Parse the data from inputStream, resolving any
// relative URIs against http://foo/bar:
parser.parse(inputStream, "http://foo/bar");
ValueFactory,
RDFHandler,
ParseErrorListener,
ParseLocationListenerRDFParser.DatatypeHandlingrdfHandler| Constructor and Description |
|---|
RDFXMLParser()
Creates a new RDFXMLParser that will use a
ValueFactoryImpl to
create RDF model objects. |
RDFXMLParser(ValueFactory valueFactory)
Creates a new RDFXMLParser that will use the supplied
ValueFactory to create RDF model objects.
|
| Modifier and Type | Method and Description |
|---|---|
protected BNode |
createBNode(String nodeID) |
boolean |
getParseStandAloneDocuments()
Returns whether the parser is currently in a mode to parse stand-alone RDF
documents.
|
RDFFormat |
getRDFFormat() |
void |
parse(InputStream in,
String baseURI)
Parses the data from the supplied InputStream, using the supplied baseURI
to resolve any relative URI references.
|
void |
parse(Reader reader,
String baseURI)
Parses the data from the supplied Reader, using the supplied baseURI to
resolve any relative URI references.
|
protected void |
reportError(String msg)
Overrides
RDFParserBase.reportError(String), adding line- and
column number information to the error. |
protected void |
reportFatalError(Exception e)
Overrides
RDFParserBase.reportFatalError(Exception), adding line-
and column number information to the error. |
protected void |
reportFatalError(String msg)
Overrides
RDFParserBase.reportFatalError(String), adding line- and
column number information to the error. |
protected void |
reportWarning(String msg)
Overrides
RDFParserBase.reportWarning(String), adding line- and
column number information to the error. |
protected void |
setBaseURI(ParsedURI baseURI) |
void |
setParseStandAloneDocuments(boolean standAloneDocs)
Sets the parser in a mode to parse stand-alone RDF documents.
|
clear, clearBNodeIDMap, createBNode, createLiteral, createStatement, createStatement, createURI, datatypeHandling, getNamespace, getParseErrorListener, getParseLocationListener, getParserConfig, getRDFHandler, isValidLanguageTag, preserveBNodeIDs, reportError, reportFatalError, reportFatalError, reportLocation, reportWarning, resolveURI, setBaseURI, setDatatypeHandling, setNamespace, setParseErrorListener, setParseLocationListener, setParserConfig, setPreserveBNodeIDs, setRDFHandler, setStopAtFirstError, setValueFactory, setVerifyData, stopAtFirstError, verifyDatapublic RDFXMLParser()
ValueFactoryImpl to
create RDF model objects.public RDFXMLParser(ValueFactory valueFactory)
valueFactory - A ValueFactory.public final RDFFormat getRDFFormat()
public void setParseStandAloneDocuments(boolean standAloneDocs)
public boolean getParseStandAloneDocuments()
setParseStandAloneDocuments(boolean)public void parse(InputStream in, String baseURI) throws IOException, RDFParseException, RDFHandlerException
in - The InputStream from which to read the data, must not be
null.baseURI - The URI associated with the data in the InputStream, must not be
null.IOException - If an I/O error occurred while data was read from the InputStream.RDFParseException - If the parser has found an unrecoverable parse error.RDFHandlerException - If the configured statement handler encountered an unrecoverable
error.IllegalArgumentException - If the supplied input stream or base URI is null.public void parse(Reader reader, String baseURI) throws IOException, RDFParseException, RDFHandlerException
reader - The Reader from which to read the data, must not be null.baseURI - The URI associated with the data in the InputStream, must not be
null.IOException - If an I/O error occurred while data was read from the InputStream.RDFParseException - If the parser has found an unrecoverable parse error.RDFHandlerException - If the configured statement handler has encountered an
unrecoverable error.IllegalArgumentException - If the supplied reader or base URI is null.protected void setBaseURI(ParsedURI baseURI)
setBaseURI in class RDFParserBaseprotected BNode createBNode(String nodeID) throws RDFParseException
createBNode in class RDFParserBaseRDFParseExceptionprotected void reportWarning(String msg)
RDFParserBase.reportWarning(String), adding line- and
column number information to the error.reportWarning in class RDFParserBaseprotected void reportError(String msg) throws RDFParseException
RDFParserBase.reportError(String), adding line- and
column number information to the error.reportError in class RDFParserBaseRDFParseExceptionprotected void reportFatalError(String msg) throws RDFParseException
RDFParserBase.reportFatalError(String), adding line- and
column number information to the error.reportFatalError in class RDFParserBaseRDFParseExceptionprotected void reportFatalError(Exception e) throws RDFParseException
RDFParserBase.reportFatalError(Exception), adding line-
and column number information to the error.reportFatalError in class RDFParserBaseRDFParseExceptionCopyright © 2001-2013 Aduna. All Rights Reserved.