/** * Factory method to create a new SAX2Model. * * @param base * The retrieval URL, or the base URI to be used while parsing. * @param m * A Jena Model in which to put the triples, this can be null. If * it is null, then use {@link SAX2RDF#getHandlers} or * {@link SAX2RDF#setHandlersWith} to provide a * {@link StatementHandler}, and usually an * {@link org.xml.sax.ErrorHandler} * @return A new SAX2Model * @throws SAXParseException * On a.error error during setup, maybe malformed base URI */ static public SAX2Model create(String base, Model m) throws SAXParseException { return new SAX2Model(base, m, ""); }
private Object setArpProperty(String str, Object v) { return JenaReader.processArpOptions(getOptions(), str, v, errorHandler); } }
/** * Constructor, see {@link #create(String, Model, String)} for top-level * javadoc. * * @param base * @param m * @param lang * @throws MalformedURIException * (If base is malformed, and treated as error rather than * warning) */ protected SAX2Model(String base, Model m, String lang) throws SAXParseException { super(base, lang); handler = initHandler(m); }
void loadXMLModel(Model m2, InputStream in, RDFEHArray eh2) throws SAXException, IOException { XMLReader saxParser = XMLReaderFactory.createXMLReader(); SAX2Model handler = SAX2Model.create(base, m2); SAX2RDF.installHandlers(saxParser, handler); handler.setErrorHandler(eh2); InputSource ins = new InputSource(in); ins.setSystemId(base); try { try { saxParser.parse(ins); } finally { handler.close(); } } catch (SAXParseException e) { // already reported, leave it be. } }
public static void read(XMLEventReader eventReader, Model model, String base) throws SAXParseException, XMLStreamException, SAXException { StAX2SAX s2s = new StAX2SAX(SAX2Model.create(base, model)); s2s.parse(eventReader); } }
private JenaHandler initHandler(Model m) { if (m==null) return null; JenaHandler rslt = new JenaHandler(m, errorHandler); rslt.useWith(getHandlers()); return rslt; } private boolean closed = false;
return setArpProperty(str, obj);
void loadXMLModel(Model m2, InputStream in, RDFEHArray eh2) throws SAXException, IOException { XMLReader saxParser = XMLReaderFactory.createXMLReader(); SAX2Model handler = SAX2Model.create(base, m2); SAX2RDF.installHandlers(saxParser, handler); handler.setErrorHandler(eh2); InputSource ins = new InputSource(in); ins.setSystemId(base); try { try { saxParser.parse(ins); } finally { handler.close(); } } catch (SAXParseException e) { // already reported, leave it be. } }
public static void read(XMLEventReader eventReader, Model model, String base) throws SAXParseException, XMLStreamException, SAXException { StAX2SAX s2s = new StAX2SAX(SAX2Model.create(base, model)); s2s.parse(eventReader); } }
private JenaHandler initHandler(Model m) { if (m==null) return null; JenaHandler rslt = new JenaHandler(m, errorHandler); rslt.useWith(getHandlers()); return rslt; } private boolean closed = false;
return setArpProperty(str, obj);
SAX2Model handler = SAX2Model.create("http://example.org/", m2, "fr"); SAX2RDF.installHandlers(saxParser, handler); handler.setErrorHandler(eh2); saxParser.parse(ins); } finally { handler.close();
public static void read(XMLStreamReader streamReader, Model model, String base) throws SAXParseException, XMLStreamException, SAXException { StAX2SAX s2s = new StAX2SAX(SAX2Model.create(base, model)); s2s.parse(streamReader); }
/** * Factory method to create a new SAX2Model. * * @param base * The retrieval URL, or the base URI to be used while parsing. * @param m * A Jena Model in which to put the triples, this can be null. If * it is null, then use {@link SAX2RDF#getHandlers} or * {@link SAX2RDF#setHandlersWith} to provide a * {@link StatementHandler}, and usually an * {@link org.xml.sax.ErrorHandler} * @return A new SAX2Model * @throws SAXParseException * On a.error error during setup, maybe malformed base URI */ static public SAX2Model create(String base, Model m) throws SAXParseException { return new SAX2Model(base, m, ""); }
private Object setArpProperty(String str, Object v) { return JenaReader.processArpOptions(getOptions(), str, v, errorHandler); } }
/** * Constructor, see {@link #create(String, Model, String)} for top-level * javadoc. * * @param base * @param m * @param lang * @throws MalformedURIException * (If base is malformed, and treated as error rather than * warning) */ protected SAX2Model(String base, Model m, String lang) throws SAXParseException { super(base, lang); handler = initHandler(m); }
SAX2Model handler = SAX2Model.create("http://example.org/", m2, "fr"); SAX2RDF.installHandlers(saxParser, handler); handler.setErrorHandler(eh2); saxParser.parse(ins); } finally { handler.close();
public static void read(XMLStreamReader streamReader, Model model, String base) throws SAXParseException, XMLStreamException, SAXException { StAX2SAX s2s = new StAX2SAX(SAX2Model.create(base, model)); s2s.parse(streamReader); }
/** * Factory method to create a new SAX2Model. This is particularly intended * for when parsing a non-root element within an XML document. In which case * the application needs to find this value in the outer context. * Optionally, namespace prefixes can be passed from the outer context using * {@link #startPrefixMapping}. * * @param base * The retrieval URL, or the base URI to be used while parsing. * @param m * A Jena Model in which to put the triples, this can be null. If * it is null, then use {@link SAX2RDF#getHandlers} or * {@link SAX2RDF#setHandlersWith} to provide a * {@link StatementHandler}, and usually an * {@link org.xml.sax.ErrorHandler} * @param lang * The current value of <code>xml:lang</code> when parsing * starts, usually "". * @return A new SAX2Model * @throws SAXParseException * On a.error error during setup, maybe malformed base URI */ static public SAX2Model create(String base, Model m, String lang) throws SAXParseException { return new SAX2Model(base, m, lang); }
/** * Factory method to create a new SAX2Model. This is particularly intended * for when parsing a non-root element within an XML document. In which case * the application needs to find this value in the outer context. * Optionally, namespace prefixes can be passed from the outer context using * {@link #startPrefixMapping}. * * @param base * The retrieval URL, or the base URI to be used while parsing. * @param m * A Jena Model in which to put the triples, this can be null. If * it is null, then use {@link SAX2RDF#getHandlers} or * {@link SAX2RDF#setHandlersWith} to provide a * {@link StatementHandler}, and usually an * {@link org.xml.sax.ErrorHandler} * @param lang * The current value of <code>xml:lang</code> when parsing * starts, usually "". * @return A new SAX2Model * @throws SAXParseException * On a.error error during setup, maybe malformed base URI */ static public SAX2Model create(String base, Model m, String lang) throws SAXParseException { return new SAX2Model(base, m, lang); }