|
1 | | -# easyml-lib |
2 | | -Repository for the EasyML to and from XML library. |
| 1 | +## EasyML is a Java serialization library, to and from XML, similar to [Gson](http://github.com/google/gson). |
3 | 2 |
|
4 | | -EasyML |
5 | | -- offers basic DTD-type support and full Java support |
6 | | - (see EasyML and EasyML.Profile configuration). |
7 | | -- Dependencies: |
8 | | - "kxml2-min-2.3.0.jar" - compile+runtime |
9 | | - (http://sourceforge.net/projects/kxml/files/kxml2/2.3.0/kxml2-min-2.3.0.jar/download) |
| 3 | +EasyML library converts Java objects into XML and back again, without the need for annotations or other |
| 4 | +types of configuration. EasyML offers extensive support for JDK classes and also supports customization |
| 5 | +through user settings, user extensions, or through the Java Serialization API. |
10 | 6 |
|
| 7 | +EasyML provides support for: |
| 8 | + * reading from and writing to XML text |
| 9 | + * reading from and writing to org.w3c.dom.Document structures |
| 10 | + * Java Collections framework |
| 11 | + * Java Serialization framework |
| 12 | + * Multi-threading |
| 13 | + * Java Generics |
| 14 | + |
| 15 | + |
| 16 | +### Example |
| 17 | + |
| 18 | +Creating a default EasyML instance: |
| 19 | +```java |
| 20 | +EasyML easyml = new EasyML(); |
| 21 | +``` |
| 22 | + |
| 23 | +Creating a custom EasyML instance: |
| 24 | +```java |
| 25 | +EasyML easyml = new EasyMLBuilder() |
| 26 | + .withStyle(EasyML.Style.PRETTY) |
| 27 | + .withCustomRootTag("persons") |
| 28 | + .withAlias(PersonDTO.class, "person") |
| 29 | + .build(); |
| 30 | +``` |
| 31 | +EasyML can also be customized with user-defined serialization strategies. |
| 32 | +Security policies can also be defined, specifying black- or whitelists of |
| 33 | +types which are allowed at deserialization time. |
| 34 | + |
| 35 | +Serializing: |
| 36 | +```java |
| 37 | +easyml.serialize(srcObj, outFile); |
| 38 | + |
| 39 | +easyml.serialize(srcObj, outDOM); |
| 40 | + |
| 41 | +String xml= easyml.serialize(srcObj); |
| 42 | +``` |
| 43 | + |
| 44 | +Deserializing: |
| 45 | +```java |
| 46 | +Object o= easyml.deserialize(inFile); |
| 47 | + |
| 48 | +Object o= easyml.deserialize(inDOM); |
| 49 | + |
| 50 | +Object o= easyml.deserialize(inStr); |
| 51 | +``` |
| 52 | +The low-level components, XMLWriter and XMLReader, can be used directly, |
| 53 | +for a higher control compared to the EasyML Facade. |
| 54 | + |
| 55 | +### Dependencies |
| 56 | + |
| 57 | + KXml2 |
| 58 | + [kxml2-min-2.3.0.jar](http://sourceforge.net/projects/kxml/files/kxml2/2.3.0/kxml2-min-2.3.0.jar/download) |
| 59 | + |
| 60 | + |
| 61 | +### Release Notes |
11 | 62 |
|
12 | 63 | !Release 1.4.4 |
13 | 64 | - refactor: made n.s.e.m.CompositeStrategy.unmarshalInit return type more |
@@ -240,3 +291,4 @@ object input and output streams. |
240 | 291 | - bugfix: n.s.e.m.j.i.SerializableStrategy: fixed Java IO Serialization |
241 | 292 | PutFields/GetFields EasyML impl such that it is not mandatory to |
242 | 293 | define both methods when custom serialization of a class is used. |
| 294 | + |
0 commit comments