Package org.apache.axiom.om

Examples of org.apache.axiom.om.OMElement.serialize()


    OMText textNode = factory.createOMText(elem,tempText);
   
    ((Text)textNode).appendData(textToAppend);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try {
      elem.serialize(baos);
      System.out.println(new String(baos.toByteArray()));
      //TODO TEMPORARY: remove this
    } catch (Exception e) {
      e.printStackTrace();
      fail(e.getMessage());
View Full Code Here


        OMNamespace namespace1 = factory.createOMNamespace("", "");
        OMElement elem1 = factory.createOMElement("", namespace1);

        StringWriter writer = new StringWriter();
        elem1.build();
        elem1.serialize(writer);
        writer.flush();
        return writer.toString();
    }

    public void testOMElemWithWhiteSpace() throws XMLStreamException {
View Full Code Here

        OMNamespace namespace1 = factory.createOMNamespace("  ", "");
        OMElement elem1 = factory.createOMElement("  ", namespace1);

        StringWriter writer = new StringWriter();
        elem1.build();
        elem1.serialize(writer);
        writer.flush();
        return writer.toString();
    }
}
View Full Code Here

                                                  "  type=\"text/xsl\" href=\"" +
                                                  (contextRoot.equals("/") ? "" : contextRoot) +
                                                  "/styles/" +
                                                  annotatedXsl + "\"");
            }
            docElem.serialize(writer);
            writer.flush();
        } catch (XMLStreamException e) {
            log.error("Error occurred while trying to write processing instruction for attaching " +
                      "annotated style sheet", e);
        }
View Full Code Here

                OutputStream os = new FileOutputStream(file);
                OMElement servicesXML =
                        ServiceDescriptionSerializer.serializeToServiceXML(
                                ruleServiceDescription, parent, AXIOM_XPATH_SERIALIZER);
                servicesXML.build();
                servicesXML.serialize(os);
            } catch (Exception e) {
                throw new RuleServiceManagementException("Cannot write services XML", e, log);
            }

        } else {
View Full Code Here

            OMElement ruleServiceXML =
                    ServiceDescriptionSerializer.serializeToRuleServiceConfiguration(
                            ruleServiceDescription, NULL_NS,
                            AXIOM_XPATH_SERIALIZER, CONFIGURATION_EXTENSION_SERIALIZER);
            ruleServiceXML.build();
            ruleServiceXML.serialize(os);
        } catch (Exception e) {
            throw new RuleServiceManagementException("Cannot write to the rule service file : " +
                    ruleFile, e, log);
        }
View Full Code Here

            OutputStream os = new FileOutputStream(file);
            OMElement servicesXML = createServicesXMLFromSpringBeans(
                    beanClasses, springContextRelLocation);
            servicesXML.build();
            servicesXML.serialize(os);
        } catch (Exception e) {
            String msg = bundle.getString("spring.cannot.write.services.xml");
            handleException(msg, e);
        }
View Full Code Here

            OMElement servicesXML =
                    ServiceDescriptionSerializer.serializeToRuleServiceConfiguration(
                            ruleServiceDescription, NULL_NS,
                            AXIOM_XPATH_SERIALIZER, CONFIGURATION_EXTENSION_SERIALIZER);
            servicesXML.build();
            servicesXML.serialize(os);
        } catch (Exception e) {
            throw new RuleServiceManagementException("Cannot write rule services XML", e, log);
        }

        try {
View Full Code Here

                }
            }
            OMElement omElement = (OMElement) value;
            ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
            try {
                omElement.serialize(arrayOutputStream);
                return new ByteArrayInputStream(arrayOutputStream.toByteArray());
            } catch (XMLStreamException e) {
                throw new LoggedRuntimeException("Error converting to a Stream from OMElement : " +
                        value, e, log);
            }
View Full Code Here

            OMElement contentEle = factory.createOMElement(new QName("content"));
            OMText contentText = factory.createOMText(encodedContent);
            contentEle.addChild(contentText);

            contentEle.serialize(xmlWriter);

            xmlWriter.writeEndElement(); // to end resource tag.
            xmlWriter.flush();
        } else {
            createDirectoryMetaElement(xmlWriter, filePath, path);
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.