Examples of DOMConfiguration


Examples of org.w3c.dom.DOMConfiguration

    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.DOMConfiguration

      }
   }

   private static void setResourceResolver(XSLoader schemaLoader, final SchemaBindingResolver schemaResolver)
   {
      DOMConfiguration config = schemaLoader.getConfig();
      config.setParameter("resource-resolver", new LSResourceResolver()
      {
         public LSInput resolveResource(String type,
                                                       String namespaceURI,
                                                       String publicId,
                                                       String systemId,
View Full Code Here

Examples of org.w3c.dom.DOMConfiguration

      );
   }

   private static void setDOMErrorHandler(XSLoader schemaLoader)
   {
      DOMConfiguration config = schemaLoader.getConfig();
      config.setParameter("error-handler", XsdBinderTerminatingErrorHandler.newInstance());
   }
View Full Code Here

Examples of org.w3c.dom.DOMConfiguration

                // normalizations supported by DOM, this is generally not a heavy operation.
                // In particular, the Axiom implementation is not required to expand the object
                // model (including OMSourcedElements) because the Axiom builder is required to
                // perform namespace repairing, so that no modifications to unexpanded parts of
                // the message are required.
                DOMConfiguration domConfig = document.getDomConfig();
                domConfig.setParameter("split-cdata-sections", Boolean.FALSE);
                domConfig.setParameter("well-formed", Boolean.FALSE);
                domConfig.setParameter("namespaces", Boolean.TRUE);
                document.normalizeDocument();
                return document;
            }
           
            if (useDoom) {
View Full Code Here

Examples of org.w3c.dom.DOMConfiguration

            System.setProperty(DOMImplementationRegistry.PROPERTY,
                    "org.apache.xerces.dom.DOMXSImplementationSourceImpl");
            DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
            XSImplementation impl = (XSImplementation) registry.getDOMImplementation("XS-Loader");
            XSLoader schemaLoader = impl.createXSLoader(null);
            DOMConfiguration domConfig = schemaLoader.getConfig();

            // create Error Handler
            DOMErrorHandler errorHandler = new Generator(config);
            domConfig.setParameter("error-handler", errorHandler);
            domConfig.setParameter("validate", Boolean.TRUE);

            // parse document
            String input = config.getInputFile();
            if (input == null || input.length() == 0) {
                System.err.println("No input file!");
View Full Code Here

Examples of org.w3c.dom.DOMConfiguration

            XSImplementation impl = (XSImplementation) registry.getDOMImplementation("XS-Loader");

            XSLoader schemaLoader = impl.createXSLoader(null);

            DOMConfiguration config = schemaLoader.getConfig();

            // create Error Handler
            DOMErrorHandler errorHandler = new QueryXS();

            // set error handler
            config.setParameter("error-handler", errorHandler);

            // set validation feature
            config.setParameter("validate", Boolean.TRUE);

            // parse document
            System.out.println("Parsing " + argv[0] + "...");
            XSModel model = schemaLoader.loadURI(argv[0]);
            if (model != null) {
View Full Code Here

Examples of org.w3c.dom.DOMConfiguration

                (DOMImplementationLS)registry.getDOMImplementation("LS");

            // create DOMBuilder
            builder = impl.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null);
           
            DOMConfiguration config = builder.getDomConfig();

            // create Error Handler
            DOMErrorHandler errorHandler = new DOM3();
           
            // create filter
            LSParserFilter filter = new DOM3();
           
            builder.setFilter(filter);

            // set error handler
            config.setParameter("error-handler", errorHandler);


            // set validation feature
            //config.setParameter("validate", Boolean.FALSE);
            config.setParameter("validate",Boolean.TRUE);
           
            // set schema language
            config.setParameter("schema-type", "http://www.w3.org/2001/XMLSchema");
            //config.setParameter("psvi",Boolean.TRUE);
            //config.setParameter("schema-type","http://www.w3.org/TR/REC-xml");
           
            // set schema location
            config.setParameter("schema-location","personal.xsd");
           
            // parse document
            System.out.println("Parsing "+argv[0]+"...");
            Document doc = builder.parseURI(argv[0]);

            // set error handler on the Document
            config = doc.getDomConfig();
           
            config.setParameter("error-handler", errorHandler);

            // set validation feature
            config.setParameter("validate", Boolean.TRUE);
            config.setParameter("schema-type", "http://www.w3.org/2001/XMLSchema");
            //config.setParameter("schema-type","http://www.w3.org/TR/REC-xml");
            config.setParameter("schema-location","data/personal.xsd");
           
            // remove comments from the document
            config.setParameter("comments", Boolean.FALSE);

            System.out.println("Normalizing document... ");
            doc.normalizeDocument();


            // create DOMWriter
            LSSerializer domWriter = impl.createLSSerializer();
           
            System.out.println("Serializing document... ");
            config = domWriter.getDomConfig();
            config.setParameter("xml-declaration", Boolean.FALSE);
            //config.setParameter("validate",errorHandler);

            // serialize document to standard output
            //domWriter.writeNode(System.out, doc);
            LSOutput dOut = impl.createLSOutput();
View Full Code Here

Examples of org.w3c.dom.DOMConfiguration

                }
            }
            if (domImplementationLS != null) {
                final LSSerializer lsSerializer = domImplementationLS
                        .createLSSerializer();
                final DOMConfiguration domConfiguration = lsSerializer
                        .getDomConfig();
                if (domConfiguration.canSetParameter("format-pretty-print",
                        Boolean.TRUE)) {
                    lsSerializer.getDomConfig().setParameter(
                            "format-pretty-print", Boolean.TRUE);
                    final LSOutput lsOutput = domImplementationLS
                            .createLSOutput();
View Full Code Here

Examples of org.w3c.dom.DOMConfiguration

            XSImplementation impl = (XSImplementation) registry.getDOMImplementation("XS-Loader");

            XSLoader schemaLoader = impl.createXSLoader(null);

            DOMConfiguration config = schemaLoader.getConfig();

            // create Error Handler
            DOMErrorHandler errorHandler = new QueryXS();

            // set error handler
            config.setParameter("error-handler", errorHandler);

            // set validation feature
            config.setParameter("validate", Boolean.TRUE);

            // parse document
            System.out.println("Parsing " + argv[0] + "...");
            XSModel model = schemaLoader.loadURI(argv[0]);
            if (model != null) {
View Full Code Here

Examples of org.w3c.dom.DOMConfiguration

  private void write(Document doc, OutputStream out, boolean close) throws IOException {
    try {
      DOMImplementationLS ls = (DOMImplementationLS) doc.getImplementation().getFeature( "LS", "3.0" );
      LSSerializer serializer = ls.createLSSerializer();
      DOMConfiguration domConfig = serializer.getDomConfig();
      trySetPrettyPrint( domConfig );

      LSOutput lsOutput = ls.createLSOutput();
      lsOutput.setEncoding( "UTF-8" );
      lsOutput.setByteStream( out );
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.