Package org.w3c.dom.ls

Examples of org.w3c.dom.ls.LSOutput


                                   "com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl");
                registry = DOMImplementationRegistry.newInstance();
                impl = (DOMImplementationLS)registry.getDOMImplementation("LS");
            }
        }
        LSOutput output = impl.createLSOutput();
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        output.setByteStream(byteArrayOutputStream);
        LSSerializer writer = impl.createLSSerializer();
        writer.write(doc, output);
        byte[] buf = byteArrayOutputStream.toByteArray();
        return new ByteArrayInputStream(buf);
    }
View Full Code Here


    }
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    DOMXSImplementationSourceImpl dis = new org.apache.xerces.dom.DOMXSImplementationSourceImpl();
    DOMImplementationLS impl = (DOMImplementationLS) dis.getDOMImplementation("LS");
    LSSerializer writer = impl.createLSSerializer();
    LSOutput output = impl.createLSOutput();
    output.setByteStream(baos);
    writer.write(dom, output);
    return baos.toByteArray();
  }
View Full Code Here

                                   "com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl");
                registry = DOMImplementationRegistry.newInstance();
                impl = (DOMImplementationLS)registry.getDOMImplementation("LS");
            }
        }
        LSOutput output = impl.createLSOutput();
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        output.setByteStream(byteArrayOutputStream);
        LSSerializer writer = impl.createLSSerializer();
        writer.write(doc, output);
        byte[] buf = byteArrayOutputStream.toByteArray();
        return new ByteArrayInputStream(buf);
    }
View Full Code Here

       // serialize the DOM to XML Schema document
       DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
       DOMImplementationLS impl =  (DOMImplementationLS) registry.getDOMImplementation("LS");
       LSSerializer writer = impl.createLSSerializer();
       writer.getDomConfig().setParameter("format-pretty-print", Boolean.TRUE);                 
       LSOutput output = impl.createLSOutput();
       output.setEncoding("UTF-8");
       output.setByteStream(System.out);
       writer.write(xsdDocument, output);    
    }
View Full Code Here

                                   "com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl");
                registry = DOMImplementationRegistry.newInstance();
                impl = (DOMImplementationLS)registry.getDOMImplementation("LS");
            }
        }
        LSOutput output = impl.createLSOutput();
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        output.setByteStream(byteArrayOutputStream);
        LSSerializer writer = impl.createLSSerializer();
        writer.write(doc, output);
        byte[] buf = byteArrayOutputStream.toByteArray();
        return new ByteArrayInputStream(buf);
    }
View Full Code Here

             */
            DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
            DOMImplementationLS domImplLS = (DOMImplementationLS)registry.getDOMImplementation("LS");

            LSSerializer ser = domImplLS.createLSSerializer();
            LSOutput out = domImplLS.createLSOutput();

            /*
             * Store XML to file
             */
            if (configuration == null)
                loadConfiguration(CONFIG_FILE);
           
            String url = configuration.userDirectory + table.getTableName() + FILE_EXT;
           
            /*
             * Create directories if its does not exists
             */
            File fp = new File(configuration.userDirectory);
            if (!fp.exists())
                fp.mkdirs();

            FileOutputStream fos = new FileOutputStream(url);
            out.setByteStream(fos);
            ser.write(dom, out);
            fos.close();
        }
        catch(Exception pce) {
            Logger.getLogger(UserConfig.class.getName()).log(
View Full Code Here

            writer.setNewLine("\n");
            writer.getDomConfig().setParameter("format-pretty-print", true); // Set this to true if the output needs to be beautified.
            writer.getDomConfig().setParameter("xml-declaration", keepDeclaration); // Set this to true if the declaration is needed to be outputted.

            LSOutput lsOutput = impl.createLSOutput();
            lsOutput.setEncoding(encoding);
            Writer stringWriter = new StringWriter();
            lsOutput.setCharacterStream(stringWriter);
            writer.write(document, lsOutput);

            return stringWriter.toString();
        }
        catch (ParserConfigurationException ex) {
View Full Code Here

      DOMImplementationLS ls = (DOMImplementationLS) doc.getImplementation().getFeature( "LS", "3.0" );
      LSSerializer serializer = ls.createLSSerializer();
      DOMConfiguration domConfig = serializer.getDomConfig();
      trySetPrettyPrint( domConfig );

      LSOutput lsOutput = ls.createLSOutput();
      lsOutput.setEncoding( "UTF-8" );
      lsOutput.setByteStream( out );

      try {
        serializer.write( doc, lsOutput );
      } catch (LSException e) {
        throw (IOException) new IOException( e.getMessage() ).initCause( e );
View Full Code Here

       // serialize the DOM to XML Schema document
       DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
       DOMImplementationLS impl =  (DOMImplementationLS) registry.getDOMImplementation("LS");
       LSSerializer writer = impl.createLSSerializer();
       writer.getDomConfig().setParameter("format-pretty-print", Boolean.TRUE);                 
       LSOutput output = impl.createLSOutput();
       output.setEncoding("UTF-8");
       output.setByteStream(System.out);
       writer.write(xsdDocument, output);
      
    } // serialize
View Full Code Here

                                   "com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl");
                registry = DOMImplementationRegistry.newInstance();
                impl = (DOMImplementationLS)registry.getDOMImplementation("LS");
            }
        }
        LSOutput output = impl.createLSOutput();
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        output.setByteStream(byteArrayOutputStream);
        LSSerializer writer = impl.createLSSerializer();
        writer.write(doc, output);
        byte[] buf = byteArrayOutputStream.toByteArray();
        return new ByteArrayInputStream(buf);
    }
View Full Code Here

TOP

Related Classes of org.w3c.dom.ls.LSOutput

Copyright © 2018 www.massapicom. 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.