Package org.apache.xml.serialize

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


            doc.appendChild( root );                        // Add Root to Document

            OutputFormat    format  = new OutputFormat( doc );   //Serialize DOM
            StringWriter  stringOut = new StringWriter();        //Writer will be a String
            XMLSerializer    serial = new XMLSerializer( stringOut, format );
            serial.asDOMSerializer();                            // As a DOM Serializer

            serial.serialize( doc.getDocumentElement() );

            System.out.println( "STRXML = " + stringOut.toString() ); //Spit out DOM as a String
        } catch ( Exception ex ) {
View Full Code Here



            OutputFormat    format  = new OutputFormat( doc );   //Serialize DOM
            StringWriter  stringOut = new StringWriter();        //Writer will be a String
            XMLSerializer    serial = new XMLSerializer( stringOut, format );
            serial.asDOMSerializer();                            // As a DOM Serializer

            serial.serialize( doc.getDocumentElement() );

            System.out.println( "STRXML = " + stringOut.toString() ); //Spit out DOM as a String
        } catch ( Exception ex ) {
View Full Code Here

  }

  private DOMSerializer getSerializer(StringWriter writer) throws Exception {
    OutputFormat outputFormat = new OutputFormat("xml", "UTF-8", true);
    XMLSerializer serializer = new XMLSerializer(writer, outputFormat);
    return serializer.asDOMSerializer();
  }

  private DocumentBuilder getDocumentBuilder() throws Exception {
    factory.setNamespaceAware(true);
    DocumentBuilder builder = factory.newDocumentBuilder();
View Full Code Here

        format.setOmitXMLDeclaration(true);
        format.setIndenting(false);

        XMLSerializer serializer = new XMLSerializer(os, format);
        try {
            serializer.asDOMSerializer();
            serializer.serialize(requestDocument.getDocumentElement());
        } catch (IOException e) {
            throw new UspsRequestException("Error serializing requestDocument: " + e.getMessage());
        }
View Full Code Here

                FileWriter fw = new FileWriter(webXml);

                XMLSerializer serial = new XMLSerializer(fw, format);

                serial.asDOMSerializer();
                serial.serialize(doc.getDocumentElement());
                fw.close();

                System.out.println("Updated " + webXml + " saved.....");
View Full Code Here

            doc.appendChild( root );                        // Add Root to Document

            OutputFormat    format  = new OutputFormat( doc );   //Serialize DOM
            StringWriter  stringOut = new StringWriter();        //Writer will be a String
            XMLSerializer    serial = new XMLSerializer( stringOut, format );
            serial.asDOMSerializer();                            // As a DOM Serializer

            serial.serialize( doc.getDocumentElement() );

            System.out.println( "STRXML = " + stringOut.toString() ); //Spit out DOM as a String
        } catch ( Exception ex ) {
View Full Code Here

        StringWriter stringOut = new StringWriter();
        try {
            OutputFormat format = new OutputFormat(doc); // Serialize DOM
            XMLSerializer serial = new XMLSerializer(stringOut, format);
            serial.asDOMSerializer(); // As a DOM serializer
            serial.serialize(doc.getDocumentElement());
        } catch (IOException e) {
            throw new NSForwardException(e);
        }
        return stringOut.toString();
View Full Code Here

        outputFormat.setIndent(3);
        outputFormat.setIndenting(true);

        try {
            XMLSerializer serializer = new XMLSerializer(new PrintWriter(out), outputFormat);
            serializer.asDOMSerializer();
            serializer.serialize(xmlDocumentResult);
        } catch (IOException e) {
            SoapUI.logError(e);
        }
View Full Code Here

      format.setLineWidth( 0 );
      format.setPreserveSpace( false );
      format.setOmitXMLDeclaration( false );

      XMLSerializer serial = new XMLSerializer( out, format );
      serial.asDOMSerializer();

      serial.serialize( el );

      return out.toString();
    } catch( IOException e ) {
View Full Code Here

        // always indent XML output, otherwise Protege hangs
        format.setIndenting( true );
        format.setOmitXMLDeclaration( false );
       
        XMLSerializer serial = new XMLSerializer( out, format );
        serial.asDOMSerializer();                           

        serial.serialize( result.getDocumentElement() );
       
        if( log.isLoggable( Level.FINE ) ) log.fine( "\n" + serialize( result ) + "\n" );
    }
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.