Examples of XMLPrinter


Examples of com.caucho.xml.XmlPrinter

    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

Examples of com.caucho.xml.XmlPrinter

        if (data != null) {
          data = data.getFirstChild();

          TempOutputStream os = new TempOutputStream();

          XmlPrinter printer = new XmlPrinter(os);

          printer.printXml(data);

          os.close();

          long length = os.getLength();
View Full Code Here

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

Examples of com.caucho.xml.XmlPrinter

  }

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

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

    printer.setEncoding(_encoding);
    if(delegate._delegate instanceof Document)
    {
        /*
        Print the XML Declaration ( the <?xml thing ) only for Documents,
        as they don't make sense when just printing nodes.
         */
        printer.setPrintDeclaration(true);

        Document document = (Document) delegate._delegate;
        printer.setVersion(document.getXmlVersion());
        if (document.getXmlStandalone()){
            printer.setStandalone("yes");
        }
        printer.printXml(document);
    }
      else
    {
        printer.printXml((org.w3c.dom.Node) delegate._delegate);
    }

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

Examples of com.caucho.xml.XmlPrinter

    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

Examples of com.caucho.xml.XmlPrinter

    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

Examples of com.caucho.xml.XmlPrinter

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

Examples of com.caucho.xml.XmlPrinter

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

Examples of com.caucho.xml.XmlPrinter

    org.w3c.dom.Element xtpDocument = looseToStrictHtml(path);
   
    OutputStream fileOut = path.openWrite();

    XmlPrinter printer = new XmlPrinter(fileOut);

    printer.printXml(xtpDocument);

    fileOut.close();
  }
View Full Code Here

Examples of com.dtrules.xmlparser.XMLPrinter

    * Set the output streams for debug and trace.
    */
   public void setOutput(OutputStream debugtrace, OutputStream error){
       if(debugtrace != null){
           outPs = new PrintStream(debugtrace);
           out   = new XMLPrinter(outPs);
       }
       err   = new PrintStream(error);
   }
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.