Package org.apache.cxf.staxutils

Examples of org.apache.cxf.staxutils.DepthXMLStreamReader


        depth = root.getDepth();
    }

    public ElementReader(XMLStreamReader reader) {
        this(reader instanceof DepthXMLStreamReader ? (DepthXMLStreamReader)reader
            : new DepthXMLStreamReader(reader));
    }
View Full Code Here


        // XMLStreamReader xmlReader = factory.createXMLStreamReader(is);
        XMLStreamReader xmlReader = StaxUtils.createXMLStreamReader(is, null);

        xmlReader.nextTag();

        this.root = new DepthXMLStreamReader(xmlReader);
        this.localName = root.getLocalName();
        this.name = root.getName();
        this.namespace = root.getNamespaceURI();

        extractXsiType();
View Full Code Here

            // we REALLY want to pass the original reader in.   This is OK with JAXB
            // as it doesn't read beyond the end so the DepthXMLStreamReader state
            // would be OK when it returns.   The main winner is FastInfoset where parsing
            // a testcase I have goes from about 300/sec to well over 1000.
           
            DepthXMLStreamReader dr = (DepthXMLStreamReader)source;
            XMLStreamReader reader = dr.getReader();
            if (u.getSchema() != null) {
                //validating, but we may need more namespaces
                reader = findExtraNamespaces(reader);
            }
            obj = unmarshalWithClass ? u.unmarshal(reader, clazz) : u
                .unmarshal(dr.getReader());
        } else if (source instanceof XMLStreamReader) {
            XMLStreamReader reader = (XMLStreamReader)source;
            if (u.getSchema() != null) {
                //validating, but we may need more namespaces
                reader = findExtraNamespaces(reader);
View Full Code Here

                @SuppressWarnings("unchecked")
                final Map.Entry<String, String> namespaces[]
                    = nsMap.entrySet().toArray(new Map.Entry[nsMap.size()]);
                //OK. we have extra namespaces.  We'll need to wrapper the reader
                //with a new one that will fake extra namespace events
                source = new DepthXMLStreamReader(source) {
                    public int getNamespaceCount() {
                        if (getDepth() == 0 && isStartElement()) {
                            return super.getNamespaceCount() + nsMap.size();
                        }
                        return super.getNamespaceCount();
View Full Code Here

        depth = root.getDepth();
    }

    public ElementReader(XMLStreamReader reader) {
        this(reader instanceof DepthXMLStreamReader ? (DepthXMLStreamReader)reader
            : new DepthXMLStreamReader(reader));
    }
View Full Code Here

        // XMLStreamReader xmlReader = factory.createXMLStreamReader(is);
        XMLStreamReader xmlReader = StaxUtils.createXMLStreamReader(is, null);

        xmlReader.nextTag();

        this.root = new DepthXMLStreamReader(xmlReader);
        this.localName = root.getLocalName();
        this.name = root.getName();
        this.namespace = root.getNamespaceURI();

        extractXsiType();
View Full Code Here

        dw.write(val, part, streamWriter);
        streamWriter.flush();

        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
        XMLStreamReader xr = inFactory.createXMLStreamReader(bais);
        DepthXMLStreamReader reader = new DepthXMLStreamReader(xr);
        StaxUtils.toNextElement(reader);
        assertEquals(new QName("http://apache.org/hello_world_rpclit/types", "in"),
                     reader.getName());

        StaxUtils.nextEvent(reader);
        StaxUtils.toNextText(reader);
        assertEquals("TESTOUTPUTMESSAGE", reader.getText());
    }
View Full Code Here

        dw.write(val, part, streamWriter);
        streamWriter.flush();

        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
        XMLStreamReader xr = inFactory.createXMLStreamReader(bais);
        DepthXMLStreamReader reader = new DepthXMLStreamReader(xr);
        StaxUtils.toNextElement(reader);
        assertEquals(new QName("http://apache.org/hello_world_rpclit/types", "in"),
                     reader.getName());

        StaxUtils.nextEvent(reader);
        StaxUtils.toNextElement(reader);
        assertEquals(new QName("http://apache.org/hello_world_rpclit/types", "elem1"),
                     reader.getName());

        StaxUtils.nextEvent(reader);
        StaxUtils.toNextText(reader);
        assertEquals("This is element 1", reader.getText());
    }
View Full Code Here

        dw.write(val, part, streamWriter);
        streamWriter.flush();

        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
        XMLStreamReader xr = inFactory.createXMLStreamReader(bais);
        DepthXMLStreamReader reader = new DepthXMLStreamReader(xr);
        StaxUtils.toNextElement(reader);
        assertEquals(new QName("http://apache.org/hello_world_doc_lit_bare/types", "inout"),
                     reader.getName());

        StaxUtils.nextEvent(reader);
        StaxUtils.toNextElement(reader);
        assertEquals(new QName("http://apache.org/hello_world_doc_lit_bare/types", "tickerSymbol"),
                     reader.getName());

        StaxUtils.nextEvent(reader);
        StaxUtils.toNextText(reader);
        assertEquals("This is a symbol", reader.getText());
    }
View Full Code Here

        dw.write(val, streamWriter);
        streamWriter.flush();

        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
        XMLStreamReader xr = inFactory.createXMLStreamReader(bais);
        DepthXMLStreamReader reader = new DepthXMLStreamReader(xr);
        StaxUtils.toNextElement(reader);
        assertEquals(new QName("http://apache.org/hello_world_soap_http/types", "greetMe"),
                     reader.getName());

        StaxUtils.nextEvent(reader);
        StaxUtils.toNextElement(reader);
        assertEquals(new QName("http://apache.org/hello_world_soap_http/types", "requestType"),
                     reader.getName());
       
        StaxUtils.nextEvent(reader);
        StaxUtils.toNextText(reader);
        assertEquals("Hello", reader.getText());
    }
View Full Code Here

TOP

Related Classes of org.apache.cxf.staxutils.DepthXMLStreamReader

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.