Package com.caucho.xml

Examples of com.caucho.xml.XmlPrinter


    }

    public void writeToStream(OutputStream os)
      throws IOException
    {
      XmlPrinter xmlPrinter = new XmlPrinter(os);
      xmlPrinter.setPretty(true);
      xmlPrinter.printXml(_data);
    }
View Full Code Here


public class XmlPrinterEcmaWrap {
  public static XmlPrinter create(WriteStream os)
    throws IOException, SAXException
  {
    return new XmlPrinter(os);
  }
View Full Code Here

  }
 
  public static XmlPrinter create(OutputStream os)
    throws IOException, SAXException
  {
    return new XmlPrinter(os);
  }
View Full Code Here

    Properties output = _stylesheet.getOutputProperties();

    com.caucho.vfs.StringWriter sw = new com.caucho.vfs.StringWriter();
    WriteStream ws = sw.openWrite();
   
    XmlPrinter out = new XmlPrinter(ws);

    out.setMethod((String) output.get(OutputKeys.METHOD));
    out.setEncoding("UTF-8");
    out.setMimeType((String) output.get(OutputKeys.MEDIA_TYPE));
    String omit = (String) output.get(OutputKeys.OMIT_XML_DECLARATION);

    if (omit == null || omit.equals("false") || omit.equals("no"))
      out.setPrintDeclaration(true);
    out.setStandalone((String) output.get(OutputKeys.STANDALONE));
    out.setSystemId((String) output.get(OutputKeys.DOCTYPE_SYSTEM));
    out.setPublicId((String) output.get(OutputKeys.DOCTYPE_PUBLIC));
   
    String indent = (String) output.get(OutputKeys.INDENT);
    if (indent != null)
      out.setPretty(indent.equals("true"));
    out.setVersion((String) output.get(OutputKeys.VERSION));
    if (node instanceof CauchoNode) {
      String filename = ((CauchoNode) node).getFilename();
      out.setLineMap(filename != null ? filename : "anonymous.xsl");
    }
    else
      out.setLineMap("anonymous.xsl");
   
      String includeContentType = (String) output.get("include-content-type");
      if (includeContentType != null)
        out.setIncludeContentType(includeContentType.equals("true") ||
                                  includeContentType.equals("yes"));

    try {
      out.startDocument();
      _stylesheet.transform(node, out, this);
      out.endDocument();
      _lineMap = out.getLineMap();
      ws.close();

      return sw.getString();
    } catch (Exception e) {
      throw new IOExceptionWrapper(e);
View Full Code Here

      NodeIterator iter = (NodeIterator) value;

      while (iter.hasNext()) {
  Node subnode = iter.next();

  XmlPrinter printer = new XmlPrinter(System.out);

  try {
    printer.printPrettyXml(subnode);
  } catch (IOException e) {
  }
      }
    }
    else if (value instanceof Node) {
  Node subnode = (Node) value;

  XmlPrinter printer = new XmlPrinter(System.out);

  try {
    printer.printPrettyXml(subnode);
  } catch (IOException e) {
  }
    }
    else
      System.out.println(value);
View Full Code Here

    out.writeEndElement(); // definitions

    _wsdlBuffer = new CharArrayWriter();

    XmlPrinter printer = new XmlPrinter(_wsdlBuffer);
    printer.setPrintDeclaration(true);
    printer.setStandalone("true");
    printer.printPrettyXml(result.getNode());
   
    _wsdlGenerated = true;
  }
View Full Code Here

    writeSchema(out);

    _schemaBuffer = new CharArrayWriter();

    XmlPrinter printer = new XmlPrinter(_schemaBuffer);
    printer.setPrintDeclaration(true);
    printer.setStandalone("true");
    printer.printPrettyXml(result.getNode());
   
    _schemaGenerated = true;
  }
View Full Code Here

      NodeIterator iter = (NodeIterator) value;

      while (iter.hasNext()) {
        Node subnode = iter.next();

        XmlPrinter printer = new XmlPrinter(System.out);

        try {
          printer.printPrettyXml(subnode);
        } catch (IOException e) {
        }
      }
    }
    else if (value instanceof Node) {
        Node subnode = (Node) value;

        XmlPrinter printer = new XmlPrinter(System.out);

        try {
          printer.printPrettyXml(subnode);
        } catch (IOException e) {
        }
    }
    else
      System.out.println(value);
View Full Code Here

  }

  private void saveToStream(WriteStream os, boolean isHTML)
    throws IOException
  {
    XmlPrinter printer = new XmlPrinter(os);

    printer.setMethod(isHTML ? "html" : "xml");

    printer.setPrintDeclaration(true);

    printer.setVersion(_delegate.getXmlVersion());
    printer.setEncoding(_encoding);

    if (_delegate.getXmlStandalone())
      printer.setStandalone("yes");

    printer.printXml(_delegate);

    if (hasChildNodes())
      os.println();
  }
View Full Code Here

TOP

Related Classes of com.caucho.xml.XmlPrinter

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.