Search in sources :

Example 1 with XercesLoader

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

the class CompleteNewApiTest method loadDOMDocument.

protected void loadDOMDocument(URL fileURL) throws IOException {
    InputStream is = fileURL.openStream();
    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) InputStream(java.io.InputStream) XercesLoader(org.eclipse.wst.xml.xpath2.processor.XercesLoader)

Example 2 with XercesLoader

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

the class SeqCollectionFuncTest method loadCollection1Default.

private void loadCollection1Default() throws Exception {
    DOMLoader domload = new XercesLoader();
    URL fileURL = bundle.getEntry("/TestSources/bib.xml");
    Document dom1 = domload.load(fileURL.openStream());
    fileURL = bundle.getEntry("/TestSources/reviews.xml");
    Document dom2 = domload.load(fileURL.openStream());
    ArrayList arraylist = new ArrayList();
    arraylist.add(dom1);
    arraylist.add(dom2);
    HashMap map = new HashMap();
    map.put(FnCollection.DEFAULT_COLLECTION_URI, arraylist);
    map.put(COLLECTION1, arraylist);
    setCollections(map);
}
Also used : DOMLoader(org.eclipse.wst.xml.xpath2.processor.DOMLoader) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) XercesLoader(org.eclipse.wst.xml.xpath2.processor.XercesLoader) Document(org.w3c.dom.Document) URL(java.net.URL)

Example 3 with XercesLoader

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

the class SeqCollectionFuncTest method loadCollection2Default.

private void loadCollection2Default() throws Exception {
    DOMLoader domload = new XercesLoader();
    URL fileURL = bundle.getEntry("/TestSources/bib.xml");
    Document dom1 = domload.load(fileURL.openStream());
    fileURL = bundle.getEntry("/TestSources/reviews.xml");
    Document dom2 = domload.load(fileURL.openStream());
    fileURL = bundle.getEntry("/TestSources/books.xml");
    Document dom3 = domload.load(fileURL.openStream());
    ArrayList arraylist = new ArrayList();
    arraylist.add(dom1);
    arraylist.add(dom2);
    arraylist.add(dom3);
    HashMap map = new HashMap();
    map.put(FnCollection.DEFAULT_COLLECTION_URI, arraylist);
    map.put(COLLECTION2, arraylist);
    setCollections(map);
}
Also used : DOMLoader(org.eclipse.wst.xml.xpath2.processor.DOMLoader) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) XercesLoader(org.eclipse.wst.xml.xpath2.processor.XercesLoader) Document(org.w3c.dom.Document) URL(java.net.URL)

Example 4 with XercesLoader

use of org.eclipse.wst.xml.xpath2.processor.XercesLoader 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 5 with XercesLoader

use of org.eclipse.wst.xml.xpath2.processor.XercesLoader 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)

Aggregations

DOMLoader (org.eclipse.wst.xml.xpath2.processor.DOMLoader)14 XercesLoader (org.eclipse.wst.xml.xpath2.processor.XercesLoader)14 InputStream (java.io.InputStream)11 ByteArrayInputStream (java.io.ByteArrayInputStream)10 Document (org.w3c.dom.Document)7 URL (java.net.URL)3 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 DOMLoaderException (org.eclipse.wst.xml.xpath2.processor.DOMLoaderException)2 DOMImplementationLS (org.w3c.dom.ls.DOMImplementationLS)2 LSSerializer (org.w3c.dom.ls.LSSerializer)2 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1 Schema (javax.xml.validation.Schema)1