Package com.jcabi.xml

Examples of com.jcabi.xml.XML


    @NotNull(message = "Gist is never NULL")
    public Gist fork() throws IOException {
        this.storage.lock();
        final String number;
        try {
            final XML xml = this.storage.xml();
            number = Integer.toString(
                1 + xml.xpath("/github/gists/gist/id/text()").size()
            );
            final Directives dirs = new Directives().xpath("/github/gists")
                .add("gist")
                .add("id").set(number).up()
                .add("files");
            final List<XML> files = xml.nodes(
                String.format("%s/files/file", this.xpath())
            );
            for (final XML file : files) {
                final String filename = file.xpath("filename/text()").get(0);
                // @checkstyle MultipleStringLiterals (3 lines)
View Full Code Here


            Json.createObjectBuilder()
                .add("name", "hi you!")
                .add("number", 1)
                .build()
        );
        final XML xml = storage.xml();
        MatcherAssert.assertThat(
            xml.xpath("/github/name/text()").get(0),
            Matchers.describedAs(xml.toString(), Matchers.endsWith("you!"))
        );
    }
View Full Code Here

     * JsonNode can text XML to JSON.
     * @throws Exception If some problem inside
     */
    @Test
    public void convertsXmlToJson() throws Exception {
        final XML xml = new XMLDocument(
            "<user><name>Jeff</name><dept><title>IT</title></dept></user>"
        );
        final JsonObject json = new JsonNode(xml.nodes("user").get(0)).json();
        MatcherAssert.assertThat(json, Matchers.notNullValue());
        MatcherAssert.assertThat(
            json.getString("name"),
            Matchers.equalTo("Jeff")
        );
View Full Code Here

                xmlString = client.target(camelComponentsListLocation).request(MediaType.WILDCARD_TYPE).get(String.class);
            } catch (Exception e) {
                throw new RuntimeException("Unable to fetch list of Camel components from: " + camelComponentsListLocation, e);
            }

            XML xml = new XMLDocument(xmlString);
            List<String> connectors = xml.xpath("/connectors/connector/@id");
            for (String id : connectors) {
                result.add("camel-" + id);
            }
            availableComponents = Collections.unmodifiableSet(result);
        }
View Full Code Here

TOP

Related Classes of com.jcabi.xml.XML

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.