Examples of XMLStreamWriter


Examples of javax.xml.stream.XMLStreamWriter

  }

  public void writeMetadata( Metadata metadata, Writer writer )
          throws ThreddsXmlWriterException
  {
    XMLStreamWriter xmlStreamWriter = this.getXmlStreamWriter( writer );
  }
View Full Code Here

Examples of javax.xml.stream.XMLStreamWriter

  }

  public void writeMetadata( Metadata metadata, OutputStream os )
          throws ThreddsXmlWriterException
  {
    XMLStreamWriter xmlStreamWriter = this.getXmlStreamWriter( os );
  }
View Full Code Here

Examples of javax.xml.stream.XMLStreamWriter

    new StreamingSerializerFactory().createStaxSerializer(fiSerializer).write(doc);
    return out.toByteArray();
  }
 
  private static byte[] serializeWithStax(Document doc, XMLOutputFactory staxOutputFactory, ByteArrayOutputStream out) throws XMLStreamException, IOException {
    XMLStreamWriter writer = staxOutputFactory.createXMLStreamWriter(out, "UTF-8");
    StreamingSerializer ser = new StreamingSerializerFactory().createStaxSerializer(writer);
    ser.write(doc);
    return out.toByteArray();
  }
View Full Code Here

Examples of javax.xml.stream.XMLStreamWriter

    new StreamingSerializerFactory().createStaxSerializer(fiSerializer).write(doc);
    return out.toByteArray();
  }
 
  private static byte[] serializeWithStax(Document doc, XMLOutputFactory staxOutputFactory, ByteArrayOutputStream out) throws XMLStreamException, IOException {
    XMLStreamWriter writer = staxOutputFactory.createXMLStreamWriter(out, "UTF-8");
    StreamingSerializer ser = new StreamingSerializerFactory().createStaxSerializer(writer);
    ser.write(doc);
    return out.toByteArray();
  }
View Full Code Here

Examples of javax.xml.stream.XMLStreamWriter

        try {
            this.domResult =
                new DOMResult((new SAX2DOMBuilder()).getDocument());

            XMLOutputFactory factory = XMLOutputFactory.newInstance();
            XMLStreamWriter xmlStreamWriter =
                factory.createXMLStreamWriter(this.domResult);

            if (resultClass == null || resultClass == StAXResult.class) {
                result = new StAXResult(xmlStreamWriter);
            } else {
View Full Code Here

Examples of javax.xml.stream.XMLStreamWriter

        StringWriter buffer = new StringWriter();
        XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
        if (useRepairing) {
            outputFactory.setProperty("javax.xml.stream.isRepairingNamespaces", Boolean.TRUE);
        }
        XMLStreamWriter out = outputFactory.createXMLStreamWriter(buffer);
        out.writeStartDocument();
        if (useRepairing) {
            out.setPrefix("env", SOAP12);
            out.setPrefix("test", TESTNS);
        }
        out.writeStartElement("env", "Envelope", SOAP12);
        if (!useRepairing) {
            out.writeNamespace("env", SOAP12);
            out.writeNamespace("test", TESTNS);
        }
        out.writeStartElement("test", "dummyElement", TESTNS);
        if (useRepairing) {
            out.setPrefix("", CHEESENS);
        }
        out.writeStartElement("", "cheddar", CHEESENS);
        if (!useRepairing) {
            out.writeDefaultNamespace(CHEESENS);
        }
        out.writeEndElement();
        out.writeEndElement();
        out.writeEndElement();
        out.writeEndDocument();
        out.close();
        System.out.println("Created "+(useRepairing ? "" : "not")+" using repairing :-");
        System.out.println(buffer);
    }
View Full Code Here

Examples of javax.xml.stream.XMLStreamWriter

        StringWriter buffer = new StringWriter();
        XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
        if (useRepairing) {
            outputFactory.setProperty("javax.xml.stream.isRepairingNamespaces", Boolean.TRUE);
        }
        XMLStreamWriter out = outputFactory.createXMLStreamWriter(buffer);
        out.writeStartDocument();
        out.writeStartElement("env", "Envelope", SOAP12);
        out.writeNamespace("env", SOAP12);
        out.writeNamespace("test", "http://someTestUri");
        out.writeStartElement("env", "Body", SOAP12);
       
        out.writeStartElement("test");
        out.writeAttribute("foo", "bar");
        out.writeEndElement();
       
        out.writeStartElement("test");
        out.writeAttribute("foo", "bar");
        out.writeCharacters("");
        out.writeEndElement();

        out.writeStartElement("test");
        out.writeAttribute("foo", "bar");
        out.writeCharacters(" ");
        out.writeEndElement();
       
        out.writeEndElement();
        out.writeEndElement();
       
        out.writeEndDocument();
        out.close();
        System.out.println("Created "+(useRepairing ? "" : "not")+" using repairing :-");
        System.out.println(buffer);
    }
View Full Code Here

Examples of javax.xml.stream.XMLStreamWriter

         ********/
        XMLOutputFactory output = XMLOutputFactoryBase.newInstance();
        output.setProperty(javax.xml.stream.XMLOutputFactory.IS_REPAIRING_NAMESPACES,new Boolean(true));
        Writer myWriter = new java.io.OutputStreamWriter(
            new java.io.FileOutputStream("tmp"),"us-ascii");
        XMLStreamWriter writer2 = output.createXMLStreamWriter(myWriter);
        writer2.writeStartDocument();
        writer2.setPrefix("c","http://c");
        writer2.setDefaultNamespace("http://d");
        writer2.writeStartElement("http://c","a");
        writer2.writeAttribute("b","blah");
        writer2.writeEmptyElement("http://c","d");
        writer2.writeEmptyElement("http://d","e");
        writer2.writeEmptyElement("http://e","f");
        writer2.writeEmptyElement("http://f","g");
        writer2.writeAttribute("http://c","chris","fry");
        writer2.writeCharacters("foo bar foo");
        writer2.writeCharacters("bad char coming[");
        char c = 0x1024;
        char[] array = new char[1];
        array[0]=c;
        writer2.writeCharacters(new String(array));
        writer2.writeCharacters("]");
        writer2.writeEndElement();
        writer2.flush();
       
       
    }
View Full Code Here

Examples of javax.xml.stream.XMLStreamWriter

        StringWriter buffer = new StringWriter();
        XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
        if (useRepairing) {
            outputFactory.setProperty("javax.xml.stream.isRepairingNamespaces", Boolean.TRUE);
        }
        XMLStreamWriter out = outputFactory.createXMLStreamWriter(buffer);
        out.writeStartDocument();
        out.writeStartElement("env", "Envelope", SOAP12);
        out.writeNamespace("env", SOAP12);
        out.writeNamespace("test", "http://someTestUri");
        out.writeEndElement();
        out.writeEndDocument();
        out.close();
        System.out.println("Created "+(useRepairing ? "" : "not")+" using repairing :-");
        System.out.println(buffer);
    }
View Full Code Here

Examples of javax.xml.stream.XMLStreamWriter

    @Test
    public void testSerializer() {
        try {
            AttributeModelSerializer serializer = new AttributeModelSerializer();
            StringWriter stringWriter = new StringWriter();
            XMLStreamWriter writer = createWriter(stringWriter);
            serializer.writeModel(writer, model);
            writer.close();
            String s1 = stringWriter.toString();
            System.out.println(s1);
            IndexedAttributeModel model2 = new IndexedAttributeModel();
            StringReader stringReader = new StringReader(s1);
            XMLStreamReader reader = createReader(stringReader);
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.