Package org.apache.xml.serialize

Examples of org.apache.xml.serialize.XMLSerializer.serialize()


  private void printElement(Element e) throws Exception {
    OutputFormat of = new OutputFormat(e.getOwnerDocument(), "UTF-8", true);
    XMLSerializer xmls = new XMLSerializer(of);
    StringWriter sw = new StringWriter();
    xmls.setOutputCharStream(sw);
    xmls.serialize(e);
    System.err.println("element=" + sw.toString());
  }
}
View Full Code Here


    protected void dumpXml(Element node) {
        try {
            OutputFormat format = new OutputFormat(node.getOwnerDocument(), "UTF-8", true);
            XMLSerializer serializer = new XMLSerializer(System.out, format);
            serializer.serialize(node);
        }
        catch (IOException e) {
            log.error("Failed to dump the XML node: " + e, e);
        }
View Full Code Here

       
        // write new XML instance
        try {
            OutputFormat format = new OutputFormat(instanceS);
            XMLSerializer output = new XMLSerializer(sw, format);
            output.serialize(instanceS);
        } catch (IOException e) {
            _logger.debug("IOException: "+e.toString());
        }
       
        builtinstance = sw.toString();
View Full Code Here

    public static String elementToString(Element element) throws IOException {
        StringWriter writer = new StringWriter();
        OutputFormat format = new OutputFormat();
        format.setOmitXMLDeclaration(true);
        XMLSerializer serializer = new XMLSerializer(writer, format);
        serializer.serialize(element);
        return writer.toString();
    }
}
View Full Code Here

            if (!file.exists())
                file.createNewFile();

            XMLSerializer serializer = new XMLSerializer();
            serializer.setOutputCharStream(new java.io.FileWriter(fileName));
            serializer.serialize(document);
        } catch (Exception e) {
            throw new UnitTestException("Saving of xml file failed", e);
        }
    }
View Full Code Here

    }

    try {
      OutputFormat format = new OutputFormat(document);
      XMLSerializer output = new XMLSerializer(bw, format);
      output.serialize(document);
    }
    catch (IOException e) {
      logger.debug(e);
    }
  }
View Full Code Here

      OutputFormat format = new OutputFormat(doc);
      format.setLineWidth(80);
      format.setIndenting(true);
      format.setIndent(2);
      XMLSerializer serializer = new XMLSerializer(writer, format);
      serializer.serialize(doc);

      ret = writer.toString();
    } finally {
      IoUtils.closeQuietly(writer);
    }
View Full Code Here

      format.setLineWidth(65);
      format.setIndenting(true);
      format.setIndent(2);
      Writer out = new StringWriter();
      XMLSerializer serializer = new XMLSerializer(out, format);
      serializer.serialize(document);
      return out.toString();
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

        OutputFormat format = new OutputFormat();
        format.setIndenting(true);
        format.setIndent(2);
        XMLSerializer serializer = new XMLSerializer(System.out, format);
        System.out.println("-->Runtime SCDL model for composite " + composite.getName());
        serializer.serialize(document);
    }

    private static void writeWSDL(Component component, Contract contract, Definition definition) {
        if (definition == null) {
            System.out.println("-->No generated WSDL for " + (component != null ? component.getName() : "") + "/" + contract.getName());
View Full Code Here

      format.setLineWidth(65);
      format.setIndenting(true);
      format.setIndent(2);
      Writer out = new StringWriter();
      XMLSerializer serializer = new XMLSerializer(out, format);
      serializer.serialize(document);
      return out.toString();
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
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.