/** * Create a new DOM2Model. * * @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} * @throws SAXParseException */ static public DOM2Model createD2M(String base, Model m) throws SAXParseException { return new DOM2Model(base, m, "", true) ; } /**
public void testDOMwithARP() throws SAXException, IOException { InputStream in = new FileInputStream("testing/wg/Class/conclusions001.rdf"); Document document = domParser .parse(in,"http://www.example.org/"); DOM2Model d2m = DOM2Model.createD2M("http://www.example.org/",null); d2m.getHandlers().setStatementHandler(this); try { d2m.load(document); } finally { d2m.close(); } assertEquals("Incorrect number of triples",3,count); }
@Override void loadXMLModel(Model m2, InputStream in, RDFEHArray eh2) throws SAXException, IOException { Document document = domParser .parse(in,base); // Make DOM into transformer input // Source input = new DOMSource(document); DOM2Model d2m = DOM2Model.createD2M(base,m2); d2m.setErrorHandler(eh2); // try { try { d2m.load(document); } finally { d2m.close(); } // } catch (SAXParseException e) { // // already reported, leave it be. // } }
throw new JenaException(nrte); } finally { close();
public void testDOMwithARP() throws SAXException, IOException { InputStream in = new FileInputStream("testing/wg/Class/conclusions001.rdf"); Document document = domParser .parse(in,"http://www.example.org/"); DOM2Model d2m = DOM2Model.createD2M("http://www.example.org/",null); d2m.getHandlers().setStatementHandler(this); try { d2m.load(document); } finally { d2m.close(); } assertEquals("Incorrect number of triples",3,count); }
@Override void loadXMLModel(Model m2, InputStream in, RDFEHArray eh2) throws SAXException, IOException { Document document = domParser .parse(in,base); // Make DOM into transformer input // Source input = new DOMSource(document); DOM2Model d2m = DOM2Model.createD2M(base,m2); d2m.setErrorHandler(eh2); // try { try { d2m.load(document); } finally { d2m.close(); } // } catch (SAXParseException e) { // // already reported, leave it be. // } }
throw new JenaException(nrte); } finally { close();
/** * Create a new DOM2Model. * * @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} * @throws SAXParseException */ static public DOM2Model createD2M(String base, Model m) throws SAXParseException { return new DOM2Model(base, m, "", true) ; } /**
/** * Create a new DOM2Model. 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 SAX2RDF#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 "". * @throws SAXParseException */ static public DOM2Model createD2M(String base, Model m, String lang) throws SAXParseException { return new DOM2Model(base, m, lang, true) ; }
/** * Create a new DOM2Model. 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 SAX2RDF#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 "". * @throws SAXParseException */ static public DOM2Model createD2M(String base, Model m, String lang) throws SAXParseException { return new DOM2Model(base, m, lang, true) ; }