Examples of XMLPrettyPrinter


Examples of org.wso2.carbon.utils.xml.XMLPrettyPrinter

        return printer.xmlFormat();
    }
    public static String parseAnonSequenceToPrettyfiedString(SequenceMediator seqMediator) {
        OMElement elem = parseAnonSequenceToOM(seqMediator);
        ByteArrayInputStream stream = new ByteArrayInputStream(elem.toString().getBytes());
        XMLPrettyPrinter printer = new XMLPrettyPrinter(stream);
        return printer.xmlFormat();
    }
View Full Code Here

Examples of org.wso2.carbon.utils.xml.XMLPrettyPrinter

    public static String serializeMediator(Mediator mediator) throws SequenceEditorException {
        OMElement ele = mediator.serialize(null);
        if (ele != null) {
            ByteArrayInputStream byteArrayInputStream
                = new ByteArrayInputStream(ele.toString().getBytes());
            XMLPrettyPrinter printer = new XMLPrettyPrinter(byteArrayInputStream);
            return printer.xmlFormat();
        }
        return null;
    }
View Full Code Here

Examples of org.wso2.carbon.utils.xml.XMLPrettyPrinter

                            StAXUtils.createXMLStreamReader(
                                    new ByteArrayInputStream(operationParameter.getBytes()));
                    OMElement paramEle = new StAXOMBuilder(xmlSR).getDocumentElement();
                    String paramName = paramEle.getAttribute(new QName("name")).getAttributeValue();
                    InputStream xmlIn = new ByteArrayInputStream(operationParameter.getBytes());
                    XMLPrettyPrinter xmlPrettyPrinter = new XMLPrettyPrinter(xmlIn, null);
                    Parameter parameter = new Parameter(paramName,
                                                        xmlPrettyPrinter.xmlFormat());
                    boolean isLocked = false;
                    OMAttribute lockedAttrib = paramEle.getAttribute(new QName("locked"));
                    if (lockedAttrib != null) {
                        isLocked = "true".equals(lockedAttrib.getAttributeValue());
                    }
View Full Code Here

Examples of org.wso2.carbon.utils.xml.XMLPrettyPrinter

    public static String prettyPrint(String rawXML) {
        rawXML = rawXML.replaceAll("\n|\\r|\\f|\\t", "");
        rawXML = rawXML.replaceAll("> +<", "><");
        InputStream xmlIn = new ByteArrayInputStream(rawXML.getBytes());
        XMLPrettyPrinter xmlPrettyPrinter = new XMLPrettyPrinter(xmlIn);
        rawXML = xmlPrettyPrinter.xmlFormat();
//        rawXML = rawXML.replaceAll("\n", "<br>");

        return rawXML;
    }
View Full Code Here

Examples of org.wso2.carbon.utils.xml.XMLPrettyPrinter

  /** 
   * Prettify a given XML string
   */
  public static String prettifyXML(String xmlContent) {
    ByteArrayInputStream byteIn = new ByteArrayInputStream(xmlContent.getBytes());
    XMLPrettyPrinter prettyPrinter = new XMLPrettyPrinter(byteIn);
    return prettyPrinter.xmlFormat().trim();
  }
View Full Code Here

Examples of org.wso2.carbon.utils.xml.XMLPrettyPrinter

 
  /**
   * Prettify a given XML file
   */ 
  public static void prettifyXMLFile(String filePath) throws IOException {
    XMLPrettyPrinter prettyPrinter = new XMLPrettyPrinter(new FileInputStream(filePath));
    String prettyXML = prettyPrinter.xmlFormat().trim();
    if (prettyXML != null && prettyXML.trim().length() > 0) {
        FileUtils.writeStringToFile(new File(filePath), prettyXML);
    }
  }
View Full Code Here

Examples of org.wso2.carbon.utils.xml.XMLPrettyPrinter

            XMLStreamWriter writer =
                    XMLOutputFactory.newInstance().createXMLStreamWriter(outBuffer);
            policy.serialize(writer);
            writer.flush();
            ByteArrayInputStream bais = new ByteArrayInputStream(outBuffer.toByteArray());
            XMLPrettyPrinter xmlPrettyPrinter = new XMLPrettyPrinter(bais);
            return xmlPrettyPrinter.xmlFormat();

        } catch (XMLStreamException e) {
            throw new RuntimeException("Serialization of Policy object failed " + e);
        }
View Full Code Here

Examples of org.wso2.carbon.utils.xml.XMLPrettyPrinter

                            StAXUtils.createXMLStreamReader(
                                    new ByteArrayInputStream(serviceParameter.getBytes()));
                    OMElement paramEle = new StAXOMBuilder(xmlSR).getDocumentElement();
                    String paramName = paramEle.getAttribute(new QName("name")).getAttributeValue();
                    InputStream xmlIn = new ByteArrayInputStream(serviceParameter.getBytes());
                    XMLPrettyPrinter xmlPrettyPrinter = new XMLPrettyPrinter(xmlIn, null);
                    Parameter parameter = new Parameter(paramName,
                                                        xmlPrettyPrinter.xmlFormat());
                    boolean isLocked = false;
                    OMAttribute lockedAttrib = paramEle.getAttribute(new QName("locked"));
                    if(lockedAttrib != null) {
                        isLocked = "true".equals(lockedAttrib.getAttributeValue());
                    }
View Full Code Here

Examples of org.wso2.carbon.utils.xml.XMLPrettyPrinter

                                            .getBytes()));
                            OMElement paramEle = new StAXOMBuilder(xmlSR).getDocumentElement();
                            String paramName = paramEle.getAttribute(new QName("name"))
                                    .getAttributeValue();
                            InputStream xmlIn = new ByteArrayInputStream(groupParameter.getBytes());
                            XMLPrettyPrinter xmlPrettyPrinter = new XMLPrettyPrinter(xmlIn, null);
                            Parameter parameter = new Parameter(paramName,
                                                                xmlPrettyPrinter.xmlFormat());
                            boolean isLocked = false;
                            OMAttribute lockedAttrib = paramEle.getAttribute(new QName("locked"));
                            if (lockedAttrib != null) {
                                isLocked = "true".equals(lockedAttrib.getAttributeValue());
                            }
View Full Code Here

Examples of org.wso2.carbon.utils.xml.XMLPrettyPrinter

            XMLStreamWriter writer =
                    XMLOutputFactory.newInstance().createXMLStreamWriter(outBuffer);
            policy.serialize(writer);
            writer.flush();
            ByteArrayInputStream bais = new ByteArrayInputStream(outBuffer.toByteArray());
            XMLPrettyPrinter xmlPrettyPrinter = new XMLPrettyPrinter(bais);
            return xmlPrettyPrinter.xmlFormat();

        } catch (XMLStreamException e) {
            throw new RuntimeException("Serialization of Policy object failed " + 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.