Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XML binding in Dart

Tags:

parsing

xml

dart

There is any way in Dart to parse XML and obtain an object?

For example if I have this XML:

<person>
 <name>John</name>
 <surname>Smith</surname>
</person>

I want to bind it to this object:

class Person {
 String name;
 String surname;
  ...
}

With a snippet like this:

Person person = parse(xml);
like image 256
Fedy2 Avatar asked Sep 30 '22 03:09

Fedy2


1 Answers

Not out of the box.

Here is currently an extensive discussion going on about serialization/deserialization: https://groups.google.com/a/dartlang.org/forum/#!topic/misc/0pv-Uaq8FGI

The discussion is mostly about JSON but most of it applies to XML as well.

like image 96
Günter Zöchbauer Avatar answered Oct 04 '22 21:10

Günter Zöchbauer