Git Product home page Git Product logo

simple-easy-xml-parser's Introduction

๐Ÿ›‘ THIS REPOSITORY IS OFFICIALLY NO LONGER UNDER MAINTENANCE since 10/02/2022 ๐Ÿ›‘

simple-easy-xml-parser Download Apache 2.0 Licence

XML parsing is now sexy!

Description

A simple, high performance, typed XML parser based upon Android sax parser but written in pure Java. SEXP gives callbacks for all parsing events and being written in pure java allows faster and more comprehensive testability.

Moreover SEXP is a pull-parsing XML deserialiser which affects both performance (no reflection is required) and low memory footprint (unncessary objects are not allocated). Our testing shows that SEXP performs:

You can refer to the following micro-benchmarking for further information.

Adding to your project

To start using this library, add these lines to the build.gradle of your project:

repositories {
    jcenter()
}

dependencies {
    compile 'com.novoda:sexp:1.0.8'
}

Simple usage

String XML =
            "<novoda>" +
              "<favouriteColour>Blue</favouriteColour>" +
            "</novoda>";

ElementFinderFactory factory = SimpleEasyXmlParser.getElementFinderFactory();
elementFinder = factory.getStringFinder();
Streamer<String> streamer = new SimpleStreamer(elementFinder);
String favouriteColour = SimpleEasyXmlParser.parse(XML, streamer);

private static class SimpleStreamer implements Streamer<String> {

    private final ElementFinder<String> elementFinder;
    private final String elementTag;

    public SimpleStreamer(ElementFinder<String> elementFinder, String elementTag) {
        this.elementFinder = elementFinder;
        this.elementTag = elementTag;
    }

    @Override
    public RootTag getRootTag() {
        return RootTag.create("novoda");
    }

    @Override
    public void stream(RootElement rootElement) {
        elementFinder.find(rootElement, elementTag);
    }

    @Override
    public String getStreamResult() {
        return elementFinder.getResultOrThrow();
    }
}

(See the demo and demoAndroid modules for more.)

Links

Here are a list of useful links:

  • We always welcome people to contribute new features or bug fixes, here is how
  • If you have a problem check the Issues Page first to see if we are working on it
  • For further usage or to delve more deeply checkout the Project Wiki
  • Looking for community help, browse the already asked Stack Overflow Questions or use the tag: support-sexp when posting a new question

simple-easy-xml-parser's People

Contributors

blundell avatar juankysoriano avatar ouchadam avatar xrigau avatar charroch avatar paulinemontmayeur avatar fourlastor avatar ataulm avatar dorvaryn avatar datadanne avatar alpert avatar cketti avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.