|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xml.sax.helpers.DefaultHandler com.hp.hpl.jena.rdf.arp.impl.XMLHandler com.hp.hpl.jena.rdf.arp.impl.SAX2RDFImpl com.hp.hpl.jena.rdf.arp.SAX2RDF
public class SAX2RDF
Allows connecting an arbitrary source of SAX events with ARP.
For use with a DOM tree,
either use DOM2Model
or
see
The Java Developer's Almanac for a discussion of how to transform a DOM
into a source of SAX events.
The use pattern is to create and initialize one of these,
then set it as the content, lexical and error handler
for some source of SAX events (e.g. from a parser).
The parser must be configured to use namespaces, and namespace
prefixes. This initializing can be done for XMLReaders
using installHandlers(org.xml.sax.XMLReader, com.hp.hpl.jena.rdf.arp.impl.XMLHandler)
.
To build a Jena model it is better to use SAX2Model
.
The documentation here, covers usage both using the subclass
SAX2Model
, and not.
This class does not support multithreaded SAX sources, nor IO interruption.
There is further documentation: here and here.
Field Summary |
---|
Fields inherited from class com.hp.hpl.jena.rdf.arp.impl.XMLHandler |
---|
nullScopeHandler, nullStatementHandler |
Fields inherited from interface com.hp.hpl.jena.rdf.arp.impl.Names |
---|
A_ABOUT, A_BADATTRS, A_BAGID, A_DATATYPE, A_DEPRECATED, A_ID, A_NODEID, A_PARSETYPE, A_RESOURCE, A_TYPE, A_XML_OTHER, A_XMLBASE, A_XMLLANG, A_XMLNS, CoreAndOldTerms, DAML_FIRST, DAML_LIST, DAML_NIL, DAML_REST, damlns, E_DESCRIPTION, E_LI, E_RDF, RDF_FIRST, RDF_NIL, RDF_OBJECT, RDF_PREDICATE, RDF_REST, RDF_STATEMENT, RDF_SUBJECT, RDF_TYPE, rdfns, xmlns, xmlnsns |
Method Summary | |
---|---|
static SAX2RDF |
create(java.lang.String base)
Factory method to create a new SAX2RDF. |
static SAX2RDF |
create(java.lang.String base,
java.lang.String lang)
Factory method to create a new SAX2RDF. |
ARPHandlers |
getHandlers()
The handlers used for processing ARP events. |
ARPOptions |
getOptions()
The options used during parsing. |
static void |
installHandlers(org.xml.sax.XMLReader rdr,
com.hp.hpl.jena.rdf.arp.impl.XMLHandler sax2rdf)
Initializes an XMLReader to use the SAX2RDF object as its handler for all events, and to use namespaces and namespace prefixes. |
void |
setHandlersWith(ARPHandlers handlers)
Copys handlers used for processing ARP events. |
void |
setOptionsWith(ARPOptions opts)
Copies the options from the argument to be used by this instance. |
void |
startPrefixMapping(java.lang.String prefix,
java.lang.String uri)
Begin the scope of a prefix-URI Namespace mapping. |
Methods inherited from class com.hp.hpl.jena.rdf.arp.impl.SAX2RDFImpl |
---|
characters, comment, endCDATA, endDocument, endDTD, endElement, endEntity, endPrefixMapping, error, fatalError, ignorableWhitespace, processingInstruction, skippedEntity, startCDATA, startDocument, startDTD, startElement, startEntity, warning |
Methods inherited from class com.hp.hpl.jena.rdf.arp.impl.XMLHandler |
---|
allowRelativeURIs, endLocalScope, endRDF, getLocator, getSimpleName, initParse, isError, location, sameDocRef, setBadStatementHandler, setDocumentLocator, startRDF, triple, warning |
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
---|
notationDecl, resolveEntity, unparsedEntityDecl |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.xml.sax.ContentHandler |
---|
setDocumentLocator |
Method Detail |
---|
public static SAX2RDF create(java.lang.String base) throws org.xml.sax.SAXParseException
getHandlers()
or setHandlersWith(com.hp.hpl.jena.rdf.arp.ARPHandlers)
to provide
a StatementHandler
, and usually an ErrorHandler
base
- The retrieval URL, or the base URI to be
used while parsing.
ParseException
org.xml.sax.SAXParseException
public static SAX2RDF create(java.lang.String base, java.lang.String lang) throws org.xml.sax.SAXParseException
startPrefixMapping(java.lang.String, java.lang.String)
.
base
- The retrieval URL, or the base URI to be
used while parsing. Use
getHandlers()
or setHandlersWith(com.hp.hpl.jena.rdf.arp.ARPHandlers)
to provide
a StatementHandler
, and usually an ErrorHandler
lang
- The current value of xml:lang when parsing starts, usually "".
ParseException
- If base or lang is bad.
org.xml.sax.SAXParseException
public void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws org.xml.sax.SAXParseException
This is passed to any NamespaceHandler
associated
with this parser.
It can be called before the initial
startElement
event, or other events associated
with the elements being processed.
When building a Jena Model, with SAX2Model
it is not required to match this
with corresponding endPrefixMapping
events.
Other NamespaceHandler
s may be fussier.
When building a Jena Model, the prefix bindings are
remembered with the Model, and may be used in some
output routines. It is permitted to not call this method
for prefixes declared in the outer context, in which case,
any output routine will need to use a gensym for such
namespaces.
startPrefixMapping
in interface org.xml.sax.ContentHandler
startPrefixMapping
in class com.hp.hpl.jena.rdf.arp.impl.XMLHandler
prefix
- The Namespace prefix being declared.uri
- The Namespace URI the prefix is mapped to.
org.xml.sax.SAXParseException
public ARPHandlers getHandlers()
SAX2Model
.
getHandlers
in interface ARPConfig
getHandlers
in class com.hp.hpl.jena.rdf.arp.impl.XMLHandler
ARPConfig.getHandlers()
public void setHandlersWith(ARPHandlers handlers)
SAX2Model
.
setHandlersWith
in interface ARPConfig
setHandlersWith
in class com.hp.hpl.jena.rdf.arp.impl.XMLHandler
handlers
- The new values to use.ARPConfig.setHandlersWith(ARPHandlers)
public ARPOptions getOptions()
ARPConfig
set..
methods
in ARPOptions
.
The options can be copied onto another ARP instance
using the ARPConfig.setOptionsWith(com.hp.hpl.jena.rdf.arp.ARPOptions)
method.
getOptions
in interface ARPConfig
getOptions
in class com.hp.hpl.jena.rdf.arp.impl.XMLHandler
ARPOptions.setDefaultErrorMode()
,
ARPOptions.setLaxErrorMode()
,
ARPOptions.setStrictErrorMode()
,
ARPOptions.setStrictErrorMode(int)
,
ARPOptions.setEmbedding(boolean)
,
ARPOptions.setErrorMode(int, int)
,
ARPConfig.setOptionsWith(com.hp.hpl.jena.rdf.arp.ARPOptions)
public void setOptionsWith(ARPOptions opts)
ARPConfig
ARPConfig.getOptions()
to retrieve this
instance's copy of the options.
setOptionsWith
in interface ARPConfig
setOptionsWith
in class com.hp.hpl.jena.rdf.arp.impl.XMLHandler
opts
- The new values to use.public static void installHandlers(org.xml.sax.XMLReader rdr, com.hp.hpl.jena.rdf.arp.impl.XMLHandler sax2rdf) throws org.xml.sax.SAXException
rdr
- The XMLReader to initialize.sax2rdf
- The SAX2RDF instance to use.
org.xml.sax.SAXException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |