Examples of LSParser


Examples of org.w3c.dom.ls.LSParser

  }

  private Document getDocument(InputStream is) throws ParserConfigurationException, SAXException, IOException, InstantiationException, IllegalAccessException, ClassNotFoundException {
    final DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
    final DOMImplementationLS impl = (DOMImplementationLS)registry.getDOMImplementation("LS");
    final LSParser parser = impl.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null);
    // we need to ignore whitespace here so the nodeToString() method will be able to indent it properly:
    parser.setFilter(new IgnoreWhitespaceFilter());
    final DOMInputImpl domInput = new DOMInputImpl();
    domInput.setByteStream(is);
    return parser.parse(domInput);
  }
View Full Code Here

Examples of org.w3c.dom.ls.LSParser

    return parse(input, validateIfSchema);
  }
 
  private static Document parse(LSInput input, boolean validateIfSchema) {
    DOMImplementationLS impl = getDOMImpl();
    LSParser parser = impl.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null);
    DOMConfiguration config = parser.getDomConfig();
    config.setParameter("element-content-whitespace", false);
    config.setParameter("namespaces", true);
    config.setParameter("validate-if-schema", validateIfSchema);
    return parser.parse(input);
 
View Full Code Here

Examples of org.w3c.dom.ls.LSParser

        } catch (Exception e) {
            throw new ServiceRuntimeException(e);
        }
        DOMImplementation impl = registry.getDOMImplementation("XML 3.0");
        DOMImplementationLS ls = (DOMImplementationLS)impl.getFeature("LS", "3.0");
        LSParser parser = ls.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, SCHEMA_NS);
        LSInput input = ls.createLSInput();
        input.setCharacterStream(new StringReader(schema));
        Document document = parser.parse(input);
        XSDefinition definition = factory.createXSDefinition();
        definition.setUnresolved(true);
        definition.setDocument(document);
        definition.setNamespace(ns);
        definitions.add(definition);
View Full Code Here

Examples of org.w3c.dom.ls.LSParser

        xml = xml.replaceAll("\\s*<", "<");
        xml = xml.replaceAll(">\\s*", ">");

        DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
        DOMImplementationLS domLS = (DOMImplementationLS) registry.getDOMImplementation("LS");
        LSParser lsParser = domLS.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null);

        LSInput input = domLS.createLSInput();
        input.setStringData(xml);
        Document document = lsParser.parse(input);

        LSSerializer lsSerializer = domLS.createLSSerializer();
        lsSerializer.getDomConfig().setParameter("comments", Boolean.FALSE);
        lsSerializer.getDomConfig().setParameter("format-pretty-print", Boolean.TRUE);
        return lsSerializer.writeToString(document);
View Full Code Here

Examples of org.w3c.dom.ls.LSParser

    DOMImplementationLS impl = (DOMImplementationLS) getDOMImplementation();
    LSInput input = impl.createLSInput();
    input.setByteStream(byteStream);

    // parse without comments and whitespace
    LSParser builder = impl.createLSParser(
        DOMImplementationLS.MODE_SYNCHRONOUS, null);
    DOMConfiguration config = builder.getDomConfig();
    config.setParameter("comments", false);
    config.setParameter("element-content-whitespace", false);

    // returns the document parsed from the input
    return builder.parse(input);
  }
View Full Code Here

Examples of org.w3c.dom.ls.LSParser

           
            LSInput inp = impl.createLSInput();
            inp.setByteStream(in);
            inp.setEncoding(ShapeConstants.ENCODING);

            LSParser lParser = impl.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null);
            Document doc = lParser.parse(inp);

            diagram = new ShapesDiagram();
            diagram.restore((Element)doc.getElementsByTagName(ShapeConstants.DIAGRAM_ELEMENT).item(0));
            in.close();
            setPartName(file.getName());
View Full Code Here

Examples of org.w3c.dom.ls.LSParser

               
                LSInput inp = impl.createLSInput();
                inp.setByteStream(in);
                inp.setEncoding(ShapeConstants.ENCODING);

                LSParser lParser = impl.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null);
                Document doc = lParser.parse(inp);

                NodeList nlist = doc.getElementsByTagName("Column");
                for (int i=0;i<nlist.getLength();i++) {
                    String name = ((Element)nlist.item(i)).getAttribute("Name");
                    String type = ((Element)nlist.item(i)).getAttribute("SQLDataType");
View Full Code Here

Examples of org.w3c.dom.ls.LSParser

        xml = xml.replaceAll("\\s*<", "<");
        xml = xml.replaceAll(">\\s*", ">");

        DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
        DOMImplementationLS domLS = (DOMImplementationLS) registry.getDOMImplementation("LS");
        LSParser lsParser = domLS.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null);

        LSInput input = domLS.createLSInput();
        input.setStringData(xml);
        Document document = lsParser.parse(input);

        LSSerializer lsSerializer = domLS.createLSSerializer();
        lsSerializer.getDomConfig().setParameter("comments", Boolean.FALSE);
        lsSerializer.getDomConfig().setParameter("format-pretty-print", Boolean.TRUE);
        return lsSerializer.writeToString(document);
View Full Code Here

Examples of org.w3c.dom.ls.LSParser

        } catch (Exception e) {
            throw new ServiceRuntimeException(e);
        }
        DOMImplementation impl = registry.getDOMImplementation("XML 3.0");
        DOMImplementationLS ls = (DOMImplementationLS)impl.getFeature("LS", "3.0");
        LSParser parser = ls.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, SCHEMA_NS);
        LSInput input = ls.createLSInput();
        input.setCharacterStream(new StringReader(schema));
        Document document = parser.parse(input);
        XSDefinition definition = factory.createXSDefinition();
        definition.setUnresolved(true);
        definition.setDocument(document);
        definition.setNamespace(ns);
        definitions.add(definition);
View Full Code Here

Examples of org.w3c.dom.ls.LSParser

        return parse(input, validateIfSchema);
    }

    private static Document parse(LSInput input, boolean validateIfSchema) {
        DOMImplementationLS impl = getDOMImpl();
        LSParser parser = impl.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null);
        DOMConfiguration config = parser.getDomConfig();
        config.setParameter("element-content-whitespace", false);
        config.setParameter("namespaces", true);
        config.setParameter("validate-if-schema", validateIfSchema);
        return parser.parse(input);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.