digitalmars.D.announce - Hunt XML released 1.0.0 rc! Support for parsing, encoding, serialize,
- zoujiaqing (34/34) Dec 05 2019 # Hunt-XML
- Joseph Rushton Wakeling (10/17) Dec 05 2019 Cool, congratulations :-)
- Adam D. Ruppe (3/5) Dec 05 2019 or my beloved dom.d
- Joseph Rushton Wakeling (5/10) Dec 06 2019 Indeed! Sorry for missing it out. I've found it friendly and
- Adam D. Ruppe (6/7) Dec 06 2019 Indeed, it is biased toward that use case, but it actually does
- zoujiaqing (29/38) Dec 05 2019 Hunt XML: Easier to use API. It's like dom4j..
- JN (3/14) Dec 05 2019 I like the declarative API, can't wait to give it a go. Reminds
A XML library for D Programming Language. Support for parsing, encoding, serialize, unserialize, object binding! * DOM parser: parse XML Document * DOM writer: to string and to file * Object serialization/deserialization ```D import hunt.xml; void main() { Document doc = Document.parse("<single-element attr1='one' attr2=\"two\"/>"); if(doc.validate()) { auto node = doc.firstNode(); writeln(node.getName()); // print single-element } } ``` ```D import hunt.xml; void main() { Document document = Document.load("resources/books.xml"); document.save("output.xml"); } ``` Source code repository: https://github.com/huntlabs/hunt-xml DLang package: https://code.dlang.org/packages/hunt-xml
Dec 05 2019
On Thursday, 5 December 2019 at 15:55:29 UTC, zoujiaqing wrote:A XML library for D Programming Language. Support for parsing, encoding, serialize, unserialize, object binding! * DOM parser: parse XML Document * DOM writer: to string and to file * Object serialization/deserializationCool, congratulations :-) Just based on a quick check, it looks like the `validate` method used in your example is just about strictly correct XML -- does the library provide any support for validating messages against a schema? And -- mostly out of curiosity -- what are the major differences compared to other D XML libraries such as experimental.xml <https://github.com/dlang-community/experimental.xml> and dxml <https://github.com/jmdavis/dxml> ... ?
Dec 05 2019
On Thursday, 5 December 2019 at 16:14:01 UTC, Joseph Rushton Wakeling wrote:And -- mostly out of curiosity -- what are the major differences compared to other D XML librariesor my beloved dom.d
Dec 05 2019
On Thursday, 5 December 2019 at 16:28:48 UTC, Adam D. Ruppe wrote:On Thursday, 5 December 2019 at 16:14:01 UTC, Joseph Rushton Wakeling wrote:Indeed! Sorry for missing it out. I've found it friendly and helpful for a number of use-cases, but as they were all related to HTML parsing, my mental map of dom.d is a bit focused on that, and its broader uses skipped my mind.And -- mostly out of curiosity -- what are the major differences compared to other D XML librariesor my beloved dom.d
Dec 06 2019
On Friday, 6 December 2019 at 08:58:38 UTC, Joseph Rushton Wakeling wrote:as they were all related to HTML parsingIndeed, it is biased toward that use case, but it actually does quite a few extra things too that I don't market as much (and takes some extra code to fully enable - like the embedded <% code %> support - but still).
Dec 06 2019
Just based on a quick check, it looks like the `validate` method used in your example is just about strictly correct XML -- does the library provide any support for validating messages against a schema?Yes, we will add valid() function to check it.And -- mostly out of curiosity -- what are the major differences compared to other D XML libraries such as experimental.xml <https://github.com/dlang-community/experimental.xml> and dxml <https://github.com/jmdavis/dxml> ... ?Hunt XML: Easier to use API. It's like dom4j.. Have comments like XmlElement, XmlAttribute, XmlIgnore and more .. ```D import hunt.xml; XmlRootElement("user") class User { XmlAttribute("ID") int id = 1001; XmlElement("USERNAME") string name; } void main() { auto user = new User; user.id = 10000; user.name = "Brian"; auto doc = toDocument(user); writeln(doc.toPrettyString()); } ``` ```xml <user ID="1002"> <USERNAME>Brian</USERNAME> </user> ```
Dec 05 2019
On Thursday, 5 December 2019 at 16:48:01 UTC, zoujiaqing wrote:```D import hunt.xml; XmlRootElement("user") class User { XmlAttribute("ID") int id = 1001; XmlElement("USERNAME") string name; }I like the declarative API, can't wait to give it a go. Reminds me of JAXB :)
Dec 05 2019