Closed gvv-ua closed 5 years ago
Hi,
it is possible. You have full access to a XmlReader
instance and can read (and write in case you have to write xml) as much as you need. Furthermore, you can delegate the work to other TypeAdapter
.
Unfortunately, it is not documented (yet), so the easiest way to get started is most likely to check the source code of one of the generated TypeAdapters and see the public API of XmlReader and you may also find the corresponding unit tests useful as it shows how to use XmlReader
Finally, you have to instantiate your TypeAdapter
in the TikXml
instance while using the builder:
TikXml parser = new TikXml.Builder()
.addTypeAdapter(MyClass.class, new MyClassTypeAdapter())
.build();
Also, whenever you use @Element(compileTimeChecks = false) MyClass myClass;
don't forget to add the compileTimeChecks = false
.
Let me know if you need any help.
Can I write custom TypeAdapter for serializer / deserializer my class? It can be useful for some cases that are not supported by library.