Package com.sun.org.apache.xml.internal.serialize

Examples of com.sun.org.apache.xml.internal.serialize.OutputFormat


        // get the object XML as it exists in the repository's
        // persitent storage area.
        byte[] bytes = TypeUtility.convertDataHandlerToBytes(apim.getObjectXML(pid));
        try {
            // use xerces to pretty print the xml, assuming it's well formed
            OutputFormat fmt = new OutputFormat("XML", "UTF-8", true);
            fmt.setIndent(2);
            fmt.setLineWidth(120);
            fmt.setPreserveSpace(false);
            XMLSerializer ser = new XMLSerializer(outStream, fmt);
            DocumentBuilderFactory factory =
                    DocumentBuilderFactory.newInstance();
            factory.setNamespaceAware(true);
            DocumentBuilder builder = factory.newDocumentBuilder();
View Full Code Here


        try {

            StringWriter sout = new StringWriter();

            OutputFormat formatter = new OutputFormat();
            formatter.setEncoding("UTF-8"); // is the default

            XMLSerializer serializer = new XMLSerializer(sout, formatter);
            serializer.serialize(rdfRels);
            rels =
                    RDFRelationshipReader
View Full Code Here

        // get a string from the inputstream, assume it's UTF-8
        String content;
        if (m_xml) {
            try {
                // use xerces to pretty print the xml to the editor
                OutputFormat fmt = new OutputFormat("XML", "UTF-8", true);
                fmt.setOmitXMLDeclaration(true);
                fmt.setIndent(2);
                fmt.setLineWidth(120);
                fmt.setPreserveSpace(false);
                ByteArrayOutputStream buf = new ByteArrayOutputStream();
                XMLSerializer ser = new XMLSerializer(buf, fmt);
                DocumentBuilderFactory factory =
                        DocumentBuilderFactory.newInstance();
                factory.setNamespaceAware(true);
View Full Code Here

            // use Xerces to pretty print the xml, assuming it's well formed
            DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
            factory.setNamespaceAware(true);
            DocumentBuilder builder=factory.newDocumentBuilder();
            Document doc=builder.parse(new ByteArrayInputStream(objectXML));
            OutputFormat fmt=new OutputFormat("XML", "UTF-8", true);
            fmt.setIndent(2);
            fmt.setLineWidth(120);
            fmt.setPreserveSpace(false);
            XMLSerializer ser=new XMLSerializer(outStream, fmt);
            ser.serialize(doc);
        } catch (Exception e) {
            System.out.println("Error on export while serializing object XML." +
                e.getClass().getName() + " : " + e.getMessage());
View Full Code Here

            if(entry.getName().endsWith(".xml") || entry.getName().endsWith(".vml")){
                //pass the xml through the Xerces serializer to produce nicely formatted output
                Document doc = builder.parse(zip.getInputStream(entry));

                OutputFormat  format  = new OutputFormat( doc );
                format.setIndenting(true);

                XMLSerializer serial = new  XMLSerializer( out, format );
                serial.asDOMSerializer();
                serial.serialize( doc.getDocumentElement() );
View Full Code Here

    root.appendChild(volume);
  }

  public void saveTo(String path) {
    try {
      OutputFormat format = new OutputFormat(doc);
      format.setIndenting(true);
      XMLSerializer serializer = new XMLSerializer(new FileOutputStream(new File(path)), format);
      serializer.serialize(doc);
    } catch (FileNotFoundException e) {
      e.printStackTrace();
      ErrorUtil.openStackTraceDialog("A Fatal Error has occured and the application will need to shut down", e);
View Full Code Here

                    // add missing xsi namespace
                    Document w3cDoc = builder.newDocument();
                    Node dup = w3cDoc.importNode(node, true);
                    w3cDoc.appendChild(dup);
                    // print document
                    OutputFormat xmlFormat = new OutputFormat("xml","ISO-8859-1", true);
                    xmlFormat.setOmitXMLDeclaration(true);
                    XMLSerializer serializer = new XMLSerializer(stringWriter, xmlFormat);
                    serializer.serialize(w3cDoc);
                   
                    value = stringWriter.toString();
                } catch (ParserConfigurationException e) {
View Full Code Here

                    normalizeChildPrefixes(node, "wdt");
                    Document w3cDoc = builder.newDocument();
                    Node dup = w3cDoc.importNode(node, true);
                    w3cDoc.appendChild(dup);
                    // print document
                    OutputFormat xmlFormat = new OutputFormat("xml","ISO-8859-1", true);
                    xmlFormat.setOmitXMLDeclaration(true);
                    XMLSerializer serializer = new XMLSerializer(stringWriter, xmlFormat);
                    serializer.serialize(w3cDoc);
                   
                    value = stringWriter.toString();
                } catch (ParserConfigurationException e) {
View Full Code Here

   * @param printToScreen Mirror output to screen?
   */
  public XmlEditsVisitor(OutputStream out)
      throws IOException {
    this.out = out;
    OutputFormat outFormat = new OutputFormat("XML", "UTF-8", true);
    outFormat.setIndenting(true);
    outFormat.setIndent(2);
    outFormat.setDoctype(null, null);
    XMLSerializer serializer = new XMLSerializer(out, outFormat);
    contentHandler = serializer.asContentHandler();
    try {
      contentHandler.startDocument();
      contentHandler.startElement("", "", "EDITS", new AttributesImpl());
View Full Code Here

    @Override
    public void save(Writer writer) {
        logger.fine("Saving configuration");
       
        try {
            OutputFormat format = new OutputFormat(createDocument());
            format.setLineWidth(65);
            format.setIndenting(true);
            format.setIndent(2);
            XMLSerializer serializer = new XMLSerializer(writer, format);
            serializer.serialize(getDocument());
            writer.close();
        }
        catch (ConfigurationException ce) {
View Full Code Here

TOP

Related Classes of com.sun.org.apache.xml.internal.serialize.OutputFormat

Copyright © 2018 www.massapicom. 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.