Search in sources :

Example 1 with DOMLoaderException

use of org.eclipse.wst.xml.xpath2.processor.DOMLoaderException in project webtools.sourceediting by eclipse.

the class AbstractPsychoPathWTPTest method loadDOMDocument.

protected void loadDOMDocument(URL fileURL, Schema schema) throws IOException, DOMLoaderException {
    InputStream is = testResolve(fileURL);
    DOMLoader domloader = new XercesLoader(schema);
    domloader.set_validating(false);
    domDoc = domloader.load(is);
    domDoc.setDocumentURI(fileURL.toString());
}
Also used : DOMLoader(org.eclipse.wst.xml.xpath2.processor.DOMLoader) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) XercesLoader(org.eclipse.wst.xml.xpath2.processor.XercesLoader)

Example 2 with DOMLoaderException

use of org.eclipse.wst.xml.xpath2.processor.DOMLoaderException in project webtools.sourceediting by eclipse.

the class AbstractPsychoPathWTPTest method resolveCharacterReferences.

protected String resolveCharacterReferences(String xpath) {
    String docText = "<doc>" + xpath + "</doc>";
    InputStream is;
    try {
        is = new ByteArrayInputStream(docText.getBytes("UTF-8"));
        DOMLoader domloader = new XercesLoader();
        domloader.set_validating(false);
        Document temp = domloader.load(is);
        return temp.getDocumentElement().getFirstChild().getTextContent();
    } catch (UnsupportedEncodingException e) {
        throw new RuntimeException(e);
    } catch (DOMLoaderException e) {
        throw new RuntimeException(e);
    }
}
Also used : DOMLoader(org.eclipse.wst.xml.xpath2.processor.DOMLoader) ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) UnsupportedEncodingException(java.io.UnsupportedEncodingException) XercesLoader(org.eclipse.wst.xml.xpath2.processor.XercesLoader) Document(org.w3c.dom.Document) DOMLoaderException(org.eclipse.wst.xml.xpath2.processor.DOMLoaderException)

Example 3 with DOMLoaderException

use of org.eclipse.wst.xml.xpath2.processor.DOMLoaderException in project webtools.sourceediting by eclipse.

the class AbstractPsychoPathTest method loadDOMDocument.

protected void loadDOMDocument(URL fileURL, Schema schema) throws IOException, DOMLoaderException {
    InputStream is = testResolve(fileURL);
    DOMLoader domloader = new XercesLoader(schema);
    domloader.set_validating(false);
    domDoc = domloader.load(is);
    domDoc.setDocumentURI(fileURL.toString());
}
Also used : DOMLoader(org.eclipse.wst.xml.xpath2.processor.DOMLoader) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) XercesLoader(org.eclipse.wst.xml.xpath2.processor.XercesLoader)

Example 4 with DOMLoaderException

use of org.eclipse.wst.xml.xpath2.processor.DOMLoaderException in project webtools.sourceediting by eclipse.

the class AbstractPsychoPathTest method loadDOMDocument.

protected void loadDOMDocument(URL fileURL, URL schemaURL) throws IOException, DOMLoaderException, SAXException {
    InputStream is = testResolve(fileURL);
    InputStream schemaIs = testResolve(schemaURL);
    Schema jaxpSchema = getSchema(schemaIs);
    DOMLoader domloader = new XercesLoader(jaxpSchema);
    domloader.set_validating(false);
    domDoc = domloader.load(is);
}
Also used : DOMLoader(org.eclipse.wst.xml.xpath2.processor.DOMLoader) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) Schema(javax.xml.validation.Schema) XercesLoader(org.eclipse.wst.xml.xpath2.processor.XercesLoader)

Example 5 with DOMLoaderException

use of org.eclipse.wst.xml.xpath2.processor.DOMLoaderException in project webtools.sourceediting by eclipse.

the class AbstractPsychoPathWTPTest method loadDOMDocument.

protected void loadDOMDocument(URL fileURL) throws IOException, DOMLoaderException {
    InputStream is = testResolve(fileURL);
    DOMLoader domloader = new XercesLoader();
    domloader.set_validating(false);
    domDoc = domloader.load(is);
    domDoc.setDocumentURI(fileURL.toString());
}
Also used : DOMLoader(org.eclipse.wst.xml.xpath2.processor.DOMLoader) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) XercesLoader(org.eclipse.wst.xml.xpath2.processor.XercesLoader)

Aggregations

ByteArrayInputStream (java.io.ByteArrayInputStream)8 InputStream (java.io.InputStream)8 DOMLoader (org.eclipse.wst.xml.xpath2.processor.DOMLoader)8 XercesLoader (org.eclipse.wst.xml.xpath2.processor.XercesLoader)8 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 DOMLoaderException (org.eclipse.wst.xml.xpath2.processor.DOMLoaderException)2 Document (org.w3c.dom.Document)2 Schema (javax.xml.validation.Schema)1