Package org.apache.cxf.staxutils.transform

Examples of org.apache.cxf.staxutils.transform.InTransformReader$EndEventMarker


    public void testReadFromStreamReader() throws Exception {
        TestSourceProvider p = new TestSourceProvider();
       
        InputStream is = new ByteArrayInputStream("<test xmlns=\"http://bar\"/>".getBytes());
        XMLStreamReader reader = StaxUtils.createXMLStreamReader(is);
        reader = new InTransformReader(reader,
                                       Collections.singletonMap("{http://bar}test", "test2"),
                                       null, false);
       
        p.getMessage().setContent(XMLStreamReader.class, reader);
       
View Full Code Here


            inMap.put("{" + WSDVersion.INSTANCE_1_1.getNamespace() + "}*",
                      "{" + WSDVersion.INSTANCE_1_0.getNamespace() + "}*");
            inMap.put("{" + WSDVersion.INSTANCE_1_1.getAddressingNamespace() + "}*",
                      "{" + WSDVersion.INSTANCE_1_0.getAddressingNamespace() + "}*");
           
            InTransformReader reader = new InTransformReader(domReader, inMap , null, false);
            doc = StaxUtils.read(reader);
            return new DOMSource(doc);           
        }
View Full Code Here

            Map<String, String> inMap = new HashMap<String, String>();
            inMap.put("{" + WSDVersion.INSTANCE_1_0.getNamespace() + "}*",
                      "{" + WSDVersion.INSTANCE_1_1.getNamespace() + "}*");
            inMap.put("{" + WSDVersion.INSTANCE_1_0.getAddressingNamespace() + "}*",
                      "{" + WSDVersion.INSTANCE_1_1.getAddressingNamespace() + "}*");
            InTransformReader reader = new InTransformReader(domReader, inMap , null, false);
            doc = StaxUtils.read(reader);
            //System.out.println(StaxUtils.toString(doc));
          
            return doc;
        }
View Full Code Here

    public void testReadFromStreamReader() throws Exception {
        TestSourceProvider<Source> p = new TestSourceProvider<Source>();
       
        InputStream is = new ByteArrayInputStream("<test xmlns=\"http://bar\"/>".getBytes());
        XMLStreamReader reader = StaxUtils.createXMLStreamReader(is);
        reader = new InTransformReader(reader,
                                       Collections.singletonMap("{http://bar}test", "test2"),
                                       null,
                                       null,
                                       null,
                                       false);
View Full Code Here

                   
                    XMLStreamReader domReader = StaxUtils.createXMLStreamReader(doc);
                    Map<String, String> inMap = new HashMap<String, String>();
                    inMap.put("{http://schemas.xmlsoap.org/ws/2005/04/discovery}*",
                              "{http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01}*");
                    InTransformReader reader = new InTransformReader(domReader, inMap , null, false);
                    doc = StaxUtils.read(reader);
                    mapToOld = true;
                }
               
               
                if (!"http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01"
                    .equals(doc.getDocumentElement().getNamespaceURI())) {
                    //not a proper ws-discovery message, ignore it
                    return null;
                }
               
                Object obj = context.createUnmarshaller().unmarshal(doc.getDocumentElement());
                if (obj instanceof JAXBElement) {
                    obj = ((JAXBElement)obj).getValue();
                }
                if (obj instanceof ProbeType) {
                    ProbeMatchesType pmt = handleProbe((ProbeType)obj);
                    if (pmt == null) {
                        return null;
                    }
                    if (mapToOld) {
                        doc.removeChild(doc.getDocumentElement());
                        DOMResult result = new DOMResult(doc);
                        XMLStreamWriter r = StaxUtils.createXMLStreamWriter(result);
                        context.createMarshaller().marshal(factory.createProbeMatches(pmt), r);
                       
                        XMLStreamReader domReader = StaxUtils.createXMLStreamReader(doc);
                        Map<String, String> inMap = new HashMap<String, String>();
                        inMap.put("{http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01}*",
                                  "{http://schemas.xmlsoap.org/ws/2005/04/discovery}*");
                        InTransformReader reader = new InTransformReader(domReader, inMap , null, false);
                        doc = StaxUtils.read(reader);
                        return new DOMSource(doc);
                    }
                    return new JAXBSource(context, factory.createProbeMatches(pmt));
                } else if (obj instanceof HelloType) {
View Full Code Here

            inMap.put("{" + WSDVersion.INSTANCE_1_1.getNamespace() + "}*",
                      "{" + WSDVersion.INSTANCE_1_0.getNamespace() + "}*");
            inMap.put("{" + WSDVersion.INSTANCE_1_1.getAddressingNamespace() + "}*",
                      "{" + WSDVersion.INSTANCE_1_0.getAddressingNamespace() + "}*");
           
            InTransformReader reader = new InTransformReader(domReader, inMap , null, false);
            doc = StaxUtils.read(reader);
            return new DOMSource(doc);           
        }
View Full Code Here

            Map<String, String> inMap = new HashMap<String, String>();
            inMap.put("{" + WSDVersion.INSTANCE_1_0.getNamespace() + "}*",
                      "{" + WSDVersion.INSTANCE_1_1.getNamespace() + "}*");
            inMap.put("{" + WSDVersion.INSTANCE_1_0.getAddressingNamespace() + "}*",
                      "{" + WSDVersion.INSTANCE_1_1.getAddressingNamespace() + "}*");
            InTransformReader reader = new InTransformReader(domReader, inMap , null, false);
            doc = StaxUtils.read(reader);
            //System.out.println(StaxUtils.toString(doc));
          
            return doc;
        }
View Full Code Here

    public void testReadFromStreamReader() throws Exception {
        TestSourceProvider p = new TestSourceProvider();
       
        InputStream is = new ByteArrayInputStream("<test xmlns=\"http://bar\"/>".getBytes());
        XMLStreamReader reader = StaxUtils.createXMLStreamReader(is);
        reader = new InTransformReader(reader,
                                       Collections.singletonMap("{http://bar}test", "test2"),
                                       null,
                                       null,
                                       null,
                                       false);
View Full Code Here

    public void testReadFromStreamReader() throws Exception {
        TestSourceProvider<Source> p = new TestSourceProvider<Source>();
       
        InputStream is = new ByteArrayInputStream("<test xmlns=\"http://bar\"/>".getBytes());
        XMLStreamReader reader = StaxUtils.createXMLStreamReader(is);
        reader = new InTransformReader(reader,
                                       Collections.singletonMap("{http://bar}test", "test2"),
                                       null,
                                       null,
                                       null,
                                       false);
View Full Code Here

                   
                    XMLStreamReader domReader = StaxUtils.createXMLStreamReader(doc);
                    Map<String, String> inMap = new HashMap<String, String>();
                    inMap.put("{http://schemas.xmlsoap.org/ws/2005/04/discovery}*",
                              "{http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01}*");
                    InTransformReader reader = new InTransformReader(domReader, inMap , null, false);
                    doc = StaxUtils.read(reader);
                    mapToOld = true;
                }
               
               
                if (!"http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01"
                    .equals(doc.getDocumentElement().getNamespaceURI())) {
                    //not a proper ws-discovery message, ignore it
                    return null;
                }
               
                Object obj = context.createUnmarshaller().unmarshal(doc.getDocumentElement());
                if (obj instanceof JAXBElement) {
                    obj = ((JAXBElement)obj).getValue();
                }
                if (obj instanceof ProbeType) {
                    ProbeMatchesType pmt = handleProbe((ProbeType)obj);
                    if (pmt == null) {
                        return null;
                    }
                    if (mapToOld) {
                        doc.removeChild(doc.getDocumentElement());
                        DOMResult result = new DOMResult(doc);
                        XMLStreamWriter r = StaxUtils.createXMLStreamWriter(result);
                        context.createMarshaller().marshal(factory.createProbeMatches(pmt), r);
                       
                        XMLStreamReader domReader = StaxUtils.createXMLStreamReader(doc);
                        Map<String, String> inMap = new HashMap<String, String>();
                        inMap.put("{http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01}*",
                                  "{http://schemas.xmlsoap.org/ws/2005/04/discovery}*");
                        InTransformReader reader = new InTransformReader(domReader, inMap , null, false);
                        doc = StaxUtils.read(reader);
                        return new DOMSource(doc);
                    }
                    return new JAXBSource(context, factory.createProbeMatches(pmt));
                } else if (obj instanceof HelloType) {
View Full Code Here

TOP

Related Classes of org.apache.cxf.staxutils.transform.InTransformReader$EndEventMarker

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.