Examples of XMLSource


Examples of com.dtrules.automapping.access.XMLSource

     */
    public String getType() { return null; }
   
    public AutoDataMapDef(){
        dataSources.put("java",    new JavaSource(this));
        dataSources.put("xml",     new XMLSource(this));
        dataTargets.put("dtrules", new DTRulesTarget(this));
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.ext.xml.XMLSource

        Book b = new Book("CXF rocks", 123L);
        Response r = store.addBook(b);
        assertNotNull(r);
        InputStream is = (InputStream)r.getEntity();
        assertNotNull(is);
        XMLSource source = new XMLSource(is);
        source.setBuffering();
        assertEquals(124L, Long.parseLong(source.getValue("Book/id")));
        assertEquals("CXF rocks", source.getValue("Book/name"));
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.ext.xml.XMLSource

        String endpointAddress =
            "http://localhost:" + PORT + "/the/thebooks5/bookstore/books/xslt";
        WebClient wc = WebClient.create(endpointAddress);
        wc.accept("application/xhtml+xml").path(666).matrix("name2", 2).query("name", "Action - ");
        XMLSource source = wc.get(XMLSource.class);
        Map<String, String> namespaces = new HashMap<String, String>();
        namespaces.put("xhtml", "http://www.w3.org/1999/xhtml");
        Book2 b = source.getNode("xhtml:html/xhtml:body/xhtml:ul/xhtml:Book", namespaces, Book2.class);
        assertEquals(666, b.getId());
        assertEquals("CXF in Action - 2", b.getName());
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.ext.xml.XMLSource

        Book b = new Book("CXF rocks", 123L);
        Response r = store.addBook(b);
        assertNotNull(r);
        InputStream is = (InputStream)r.getEntity();
        assertNotNull(is);
        XMLSource source = new XMLSource(is);
        source.setBuffering(true);
        assertEquals(124L, Long.parseLong(source.getValue("Book/id")));
        assertEquals("CXF rocks", source.getValue("Book/name"));
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.ext.xml.XMLSource

        try {
            WebClient wc = WebClient.create("http://localhost:9080/webapp/petstore");
            HTTPConduit conduit = WebClient.getConfig(wc).getHttpConduit();
            conduit.getClient().setReceiveTimeout(1000000);
            conduit.getClient().setConnectionTimeout(1000000);
            XMLSource source = wc.query("_code", "").query("_os", getOs()).get(XMLSource.class);
            String link = source.getValue("ns:html/ns:body/ns:ul/ns:a/@href",
                                          Collections.singletonMap("ns", "http://www.w3.org/1999/xhtml"));
            WebClient wc2 = WebClient.create(link);
            HTTPConduit conduit2 = WebClient.getConfig(wc2).getHttpConduit();
            conduit2.getClient().setReceiveTimeout(1000000);
            conduit2.getClient().setConnectionTimeout(1000000);
View Full Code Here

Examples of org.apache.cxf.jaxrs.ext.xml.XMLSource

        Book b = new Book("CXF rocks", 123L);
        Response r = store.addBook(b);
        assertNotNull(r);
        InputStream is = (InputStream)r.getEntity();
        assertNotNull(is);
        XMLSource source = new XMLSource(is);
        source.setBuffering(true);
        assertEquals(124L, Long.parseLong(source.getValue("Book/id")));
        assertEquals("CXF rocks", source.getValue("Book/name"));
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.ext.xml.XMLSource

    @Test
    public void testGetBook123XMLSource() throws Exception {
        String baseAddress = "http://localhost:9092/test/services/rest";
        WebClient client = WebClient.create(baseAddress);
        client.path("/bookstore/123").accept(MediaType.APPLICATION_XML_TYPE);
        XMLSource source = client.get(XMLSource.class);
        source.setBuffering(true);
        Book b = source.getNode("/Book", Book.class);
        assertEquals(123, b.getId());
        assertEquals("CXF in Action", b.getName());
        b = source.getNode("/Book", Book.class);
        assertEquals(123, b.getId());
        assertEquals("CXF in Action", b.getName());
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.ext.xml.XMLSource

                InputStream is = ResourceUtils.getResourceStream(loc, BusFactory.getDefaultBus());
                if (is == null) {
                    return;
                }
                ByteArrayInputStream bis = IOUtils.loadIntoBAIS(is);
                XMLSource source = new XMLSource(bis);
                source.setBuffering(true);
                String targetNs = source.getValue("/*/@targetNamespace");
               
                Map<String, String> nsMap =
                    Collections.singletonMap("xs", XmlSchemaConstants.XSD_NAMESPACE_URI);
                String[] elementNames = source.getValues("/*/xs:element/@name", nsMap);
                externalQnamesMap.put(targetNs, Arrays.asList(elementNames));
                String schemaValue = source.getNode("/xs:schema", nsMap, String.class);
                externalSchemasCache.add(schemaValue);
            } catch (Exception ex) {
                LOG.warning("No schema resource " + loc + " can be loaded : " + ex.getMessage());
                externalSchemasCache = null;
                externalQnamesMap = null;
View Full Code Here

Examples of org.apache.cxf.jaxrs.ext.xml.XMLSource

        public StringSchemaWriter(List<String> schemas, List<URI> links, UriInfo ui) {
           
            this.theSchemas = new LinkedList<String>();
            // we'll need to do the proper schema caching eventually
            for (String s : schemas) {
                XMLSource source = new XMLSource(new ByteArrayInputStream(s.getBytes()));
                source.setBuffering(true);
                Map<String, String> locs = getLocationsMap(source, "import", links, ui);
                String actualSchema = !locs.isEmpty() ? transformSchema(s, locs) : s;
                theSchemas.add(actualSchema);
            }
        }
View Full Code Here

Examples of org.apache.cxf.jaxrs.ext.xml.XMLSource

        Book b = new Book("CXF rocks", 123L);
        Response r = store.addBook(b);
        assertNotNull(r);
        InputStream is = (InputStream)r.getEntity();
        assertNotNull(is);
        XMLSource source = new XMLSource(is);
        source.setBuffering(true);
        assertEquals(124L, Long.parseLong(source.getValue("Book/id")));
        assertEquals("CXF rocks", source.getValue("Book/name"));
    }
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.