Examples of XMLStreamWriter


Examples of javax.xml.stream.XMLStreamWriter

    public void doDOMWrite2() throws Exception
    {
        org.w3c.dom.Document doc = DOMUtils.readXml(getResourceAsStream("nowhitespace.xml"));

        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        XMLStreamWriter writer = ofactory.createXMLStreamWriter(bos);
       
        STAXUtils.writeElement(doc.getDocumentElement(), writer, false);
       
        writer.close();
       
        Document testDoc = readDocument(bos.toString(), ifactory);
    }
View Full Code Here

Examples of javax.xml.stream.XMLStreamWriter

    {
        //XMLOutputFactory factory = XMLOutputFactory.newInstance();
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
       
        //XMLStreamWriter byteArrayWriter = factory.createXMLStreamWriter(outputStream);
        XMLStreamWriter byteArrayWriter = STAXUtils.createXMLStreamWriter(outputStream, null, null);
       
        STAXUtils.writeDocument(doc, byteArrayWriter, false);
       
        byteArrayWriter.flush();
        return outputStream.toByteArray();
    }
View Full Code Here

Examples of javax.xml.stream.XMLStreamWriter

                    mObj = method.invoke(objectFactory.newInstance(), new Object[] {obj});
                }
            }

            javax.xml.stream.XMLOutputFactory fact = javax.xml.stream.XMLOutputFactory.newInstance();
            XMLStreamWriter writer = fact.createXMLStreamWriter(pw);
            writer.setNamespaceContext(new javax.xml.namespace.NamespaceContext() {
               
                public String getNamespaceURI(String arg) {
                    return wsdl.getNamespace(arg);
                }
                               
                public String getPrefix(String arg) {
                    for (Object ent : wsdl.getNamespaces().entrySet()) {
                        Map.Entry entry = (Map.Entry)ent;
                        if (arg.equals(entry.getValue())) {
                            return (String)entry.getKey();
                        }
                    }
                    return null;
                }
               
                public Iterator getPrefixes(String arg) {
                    return wsdl.getNamespaces().keySet().iterator();
                }
            });
           
            u.marshal(mObj, writer);
            writer.flush();           
        } catch (Exception ex) {
            throw new WSDLException(WSDLException.PARSER_ERROR,
                                    "",
                                    ex);
        }
View Full Code Here

Examples of javax.xml.stream.XMLStreamWriter

          throws ThreddsXmlWriterException, IOException
  {
    if ( file == null )
      throw new IllegalArgumentException( "File must not be null." );
    OutputStream os = new FileOutputStream( file);
    XMLStreamWriter xmlStreamWriter = this.getXmlStreamWriter( os );
    CatalogElementWriter catalogWriter = new CatalogElementWriter();
    catalogWriter.writeElement( catalog, xmlStreamWriter, 0 );
    os.close();
  }
View Full Code Here

Examples of javax.xml.stream.XMLStreamWriter

  }

  public void writeCatalog( Catalog catalog, Writer writer )
          throws ThreddsXmlWriterException
  {
    XMLStreamWriter xmlStreamWriter = getXmlStreamWriter( writer );
    CatalogElementWriter catalogWriter = new CatalogElementWriter();
    catalogWriter.writeElement( catalog, xmlStreamWriter, 0 );
  }
View Full Code Here

Examples of javax.xml.stream.XMLStreamWriter

  }

  public void writeCatalog( Catalog catalog, OutputStream os )
          throws ThreddsXmlWriterException
  {
    XMLStreamWriter xmlStreamWriter = getXmlStreamWriter( os );
    CatalogElementWriter catalogWriter = new CatalogElementWriter();
    catalogWriter.writeElement( catalog, xmlStreamWriter, 0 );
  }
View Full Code Here

Examples of javax.xml.stream.XMLStreamWriter

          throws ThreddsXmlWriterException, IOException
  {
    if ( file == null )
      throw new IllegalArgumentException( "File must not be null." );
    OutputStream os = new FileOutputStream( file );
    XMLStreamWriter xmlStreamWriter = this.getXmlStreamWriter( os );
    // Do good stuff
    os.close();
  }
View Full Code Here

Examples of javax.xml.stream.XMLStreamWriter

  }

  public void writeDataset( Dataset dataset, Writer writer )
          throws ThreddsXmlWriterException
  {
    XMLStreamWriter xmlStreamWriter = this.getXmlStreamWriter( writer );
  }
View Full Code Here

Examples of javax.xml.stream.XMLStreamWriter

  }

  public void writeDataset( Dataset dataset, OutputStream os )
          throws ThreddsXmlWriterException
  {
    XMLStreamWriter xmlStreamWriter = this.getXmlStreamWriter( os );
  }
View Full Code Here

Examples of javax.xml.stream.XMLStreamWriter

          throws ThreddsXmlWriterException, IOException
  {
    if ( file == null )
      throw new IllegalArgumentException( "File must not be null." );
    OutputStream os = new FileOutputStream( file );
    XMLStreamWriter xmlStreamWriter = this.getXmlStreamWriter( os );
    // Do good stuff
    os.close();
  }
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.