Package org.w3c.dom.ls

Examples of org.w3c.dom.ls.DOMImplementationLS.createLSSerializer()


            }
        }
        LSOutput output = impl.createLSOutput();
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        output.setByteStream(byteArrayOutputStream);
        LSSerializer writer = impl.createLSSerializer();
        writer.write(doc, output);
        byte[] buf = byteArrayOutputStream.toByteArray();
        return new ByteArrayInputStream(buf);
    }
View Full Code Here


            this != node.getOwnerDocument() ) {
            String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null);
            throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, msg);
        }
        DOMImplementationLS domImplLS = (DOMImplementationLS)DOMImplementationImpl.getDOMImplementation();
        LSSerializer xmlWriter = domImplLS.createLSSerializer();
        if (node == null) {
            node = this;
        }
        return xmlWriter.writeToString(node);
    }
View Full Code Here

            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);
View Full Code Here

    }

    private static String serializeTransformElement(Element xformEl) throws DOMException, LSException {
        Document document = xformEl.getOwnerDocument();
        DOMImplementationLS domImplLS = (DOMImplementationLS)document.getImplementation();
        LSSerializer serializer = domImplLS.createLSSerializer();
//        serializer.getDomConfig().setParameter("namespaces", true);
//        serializer.getDomConfig().setParameter("namespace-declarations", true);
        serializer.getDomConfig().setParameter("canonical-form", false);
        serializer.getDomConfig().setParameter("xml-declaration", false);
        String str = serializer.writeToString(xformEl);
View Full Code Here

    d.normalizeDocument();
  }

  public static String serialize(Document document) {
    DOMImplementationLS impl = getDOMImpl();
    LSSerializer serializer = impl.createLSSerializer();
    // document.normalizeDocument();
    DOMConfiguration config = serializer.getDomConfig();
    config.setParameter("xml-declaration", true);
    config.setParameter("format-pretty-print", true);
    LSOutput output = impl.createLSOutput();
View Full Code Here

        DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();

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

        LSSerializer writer = impl.createLSSerializer();
        String str = writer.writeToString(fragment);
       
        final String xmlDecl = "<?xml version=\"1.0\" encoding=\"UTF-16\"?>" + System.getProperty("line.separator");
        assertEquals(xmlDecl + expected, str);
    }
View Full Code Here

    org.w3c.dom.Element output = (org.w3c.dom.Element) beanServerConnection
        .invoke(blacktieAdmin, "getServersStatus", null, null);
    Document document = output.getOwnerDocument();
    DOMImplementationLS domImplLS = (DOMImplementationLS) document
        .getImplementation();
    LSSerializer serializer = domImplLS.createLSSerializer();
    String str = serializer.writeToString(output);
    log.info(str);
  }
}
View Full Code Here

      throw new CommandFailedException(-1);
    }
    Document document = output.getOwnerDocument();
    DOMImplementationLS domImplLS = (DOMImplementationLS) document
        .getImplementation();
    LSSerializer serializer = domImplLS.createLSSerializer();
    String str = serializer.writeToString(output);
    log.info(str);
  }
}
View Full Code Here

            throw new LDPathException(msg, e);
        }

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        DOMImplementationLS lsImpl = (DOMImplementationLS) registry.getDOMImplementation("LS");
        LSSerializer lsSerializer = lsImpl.createLSSerializer();
        LSOutput lsOutput = lsImpl.createLSOutput();
        lsOutput.setEncoding("UTF-8");
        lsOutput.setByteStream(baos);
        lsSerializer.write(document, lsOutput);
        String schemaStr = new String(baos.toByteArray());
View Full Code Here

    * @param doc
    * @return string
    */
   public String getStringFromDoc(org.w3c.dom.Document doc) {
      DOMImplementationLS domImplementation = (DOMImplementationLS) doc.getImplementation();
      LSSerializer lsSerializer = domImplementation.createLSSerializer();
      lsSerializer.getDomConfig().setParameter("xml-declaration", false);
      //lsSerializer.getDomConfig().setParameter("xml-declaration", false);

      return lsSerializer.writeToString(doc);
   }
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.