Package com.jcabi.xml

Examples of com.jcabi.xml.XMLDocument


                    "lock should be taken before method call"
                );
            }
            this.lock.lock();
            try {
                return new XMLDocument(
                    FileUtils.readFileToString(
                        new File(this.name), Charsets.UTF_8
                    )
                );
            } finally {
View Full Code Here


            }
            this.lock.lock();
            try {
                FileUtils.write(
                    new File(this.name),
                    new XMLDocument(
                        new Xembler(dirs).apply(this.xml().node())
                    ).toString(),
                    Charsets.UTF_8
                );
            } catch (final ImpossibleModificationException ex) {
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

                .set(Long.toString(object.getSize())).up()
                .up();
        }
        try {
            this.content = DirectoryListing.STYLESHEET.transform(
                new XMLDocument(new Xembler(dirs).xml())
            ).toString().getBytes(Charsets.UTF_8);
        } catch (final ImpossibleModificationException ex) {
            throw new IllegalStateException(
                "Unable to generate directory listing", ex
            );
View Full Code Here

                .attr("key", version.getKey())
                .set(version.getVersionId()).up();
        }
        try {
            this.content = ObjectVersionListing.STYLESHEET.transform(
                new XMLDocument(new Xembler(dirs).xml())
            ).toString().getBytes(Charsets.UTF_8);
        } catch (final ImpossibleModificationException ex) {
            throw new IllegalStateException(
                "Unable to generate version listing", ex
            );
View Full Code Here

TOP

Related Classes of com.jcabi.xml.XMLDocument

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.