Examples of XBProjector


Examples of org.xmlbeam.XBProjector

import com.hascode.tutorial.xbeam.projection.Rss;

public class RssFeedParsing {
  public static void main(final String[] args) throws IOException {
    System.out.println("loading rss feed..");
    Rss rss = new XBProjector().io().url("http://www.hascode.com/feed/").read(Rss.class);

    System.out.println("rss feed received - channel: " + rss.channel().title());
    rss.channel().items().forEach(i -> {
      System.out.println("title: " + i.title() + ", link: " + i.link());
    });
View Full Code Here

Examples of org.xmlbeam.XBProjector

import com.hascode.tutorial.xbeam.projection.Books;

public class SimpleXmlFileParsingExample {
  public static void main(final String[] args) throws IOException {
    Books bookProjection = new XBProjector().io().fromURLAnnotation(Books.class);
    bookProjection.getBooks().forEach(book -> {
      System.out.println("book -> title: " + book.getTitle() + " and authors: ");
      System.out.println(book.getAuthors().stream().map(a -> {
        return a.getFirstname() + " " + a.getLastname();
      }).collect(Collectors.joining(", ")));
View Full Code Here

Examples of org.xmlbeam.XBProjector

import com.hascode.tutorial.xbeam.projection.MavenPom;

public class MavenPomParsing {
  public static void main(final String[] args) throws IOException {
    MavenPom pom = new XBProjector().io().fromURLAnnotation(MavenPom.class);
    System.out.println("Project: " + pom.project().artifactId() + ":" + pom.project().groupId() + ":" + pom.project().version());
    pom.dependencies().forEach(dep -> {
      System.out.println("-dependency -> " + dep.artifactId() + ":" + dep.groupId() + ":" + dep.version());
    });
    System.out.println("updating project version to 1.2.3..");
    pom.project().version("1.2.3");

    Path path = FileSystems.getDefault().getPath("/tmp", "changed.xml");
    System.out.println("writing pom to file: " + path);
    new XBProjector().io().file(path.toFile()).write(pom);
    Files.readAllLines(path).forEach(System.out::println);
  }
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.