Package com.sun.org.apache.xml.internal.serialize

Examples of com.sun.org.apache.xml.internal.serialize.XMLSerializer.serialize()


            // Serialize the schema element.
            //
            ByteArrayOutputStream os = new ByteArrayOutputStream();
            OutputFormat of = new OutputFormat(doc);
            XMLSerializer ser = new XMLSerializer(os, of);
            ser.serialize(schemaEl);
            os.flush();
            os.close();
            result.put(tns, os.toByteArray());
        }
        return result;
View Full Code Here


            // xElem.appendChild(xDoc.importNode(xNode, true));
            xDoc.appendChild(xDoc.importNode(xNode, true));
           
            StringWriter out = new StringWriter();
            XMLSerializer serializer = new XMLSerializer(out, new OutputFormat(xDoc));
            serializer.serialize(xDoc);
            String result = out.toString();
           
           
        SOSXMLXPath xpath = new SOSXMLXPath(new StringBuffer("<spooler><answer><ERROR code=\"4711\" text=\"ein Fehler\"/></answer></spooler>"));
      String astring = xpath.selectSingleNodeValue("//ERROR/@code");
View Full Code Here

        Document document = docBuilder.newDocument();
        document.appendChild(document.importNode(node, true));
       
        StringWriter out = new StringWriter();
        XMLSerializer serializer = new XMLSerializer(out, new OutputFormat(document));
        serializer.serialize(document);
        return out.toString();
    }
   
   
   
View Full Code Here

            format.setLineWidth(65);
            format.setIndenting(true);
            format.setIndent(2);
            Writer out = new StringWriter();
            XMLSerializer serializer = new XMLSerializer(out, format);
            serializer.serialize(doc);

            return out.toString();
        } catch (Exception ex) {
            LOGGER.warn("Could not pretty print xml: %s", data);
            return data;
View Full Code Here

      unit_price2.appendChild(document.createTextNode("34.99"));
      order_line2.appendChild(unit_price2);
      content.appendChild(order_line2);

      XMLSerializer ser = new XMLSerializer(writer, new OutputFormat("xml", "UTF-8", true));
      ser.serialize(document);

    } catch (IOException | ParserConfigurationException e) {
      e.printStackTrace();
    }
View Full Code Here

      final StringWriter sWriter = new StringWriter() ;
      final OutputFormat format = new OutputFormat() ;
      format.setIndenting(true) ;
      final XMLSerializer xmlS = new XMLSerializer(sWriter, format) ;
      xmlS.asDOMSerializer() ;
      xmlS.serialize(document) ;
      log.debug(sWriter.toString()) ;
    }
  }
  @Test
  public void testGetValidationResults() throws Exception {
View Full Code Here

        format.setIndent(4);
        format.setIndenting(true);
        XMLSerializer serializer = new XMLSerializer(writer,
                                                     format);
        try {
            serializer.serialize(doc);
            System.out.println(writer.getBuffer().toString());
        }
        catch (IOException e) {
            throw new RuntimeException(e);
        }
View Full Code Here

      File fileDest = new File(pathDest);
      serializer = new XMLSerializer(
          new FileOutputStream( fileDest ),
              format);
     
      serializer.serialize(dom);
    } catch (FileNotFoundException e1) {
      JOptionPane.showMessageDialog(null, "Could not create a serielize xml.\n"+e1.getMessage()  );
    } catch (IOException e1) {
      JOptionPane.showMessageDialog(null, "Could not create a serielize xml.\n"+e1.getMessage()  );
    }
View Full Code Here

        try {
            OutputFormat format = new OutputFormat(document, PluginConstants.UTF_ENCODING, true);
            format.setIndent(2);
            Writer output = new BufferedWriter(new OutputStreamWriter(os, PluginConstants.UTF_ENCODING));
            XMLSerializer serializer = new XMLSerializer(output, format);
            serializer.serialize(document);
        } catch (IOException e) {
            throw new TransformerException(e);
        }
    }
View Full Code Here

        format.setIndenting(true);

        // to generate a file output use fileoutputstream instead of system.out
        FileOutputStream out = new FileOutputStream(new File(file));
        XMLSerializer serializer = new XMLSerializer(out, format);
        serializer.serialize(dom);
    }

    /**
     * Create a document object using which we create a xml tree in memory.
     *
 
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.