Re: Hunt XML released 1.0.0 rc! Support for parsing, encoding, serialize, unserialize, object binding ..

2019-12-06 Thread Adam D. Ruppe via Digitalmars-d-announce
On Friday, 6 December 2019 at 08:58:38 UTC, Joseph Rushton 
Wakeling wrote:

as they were all related to HTML parsing


Indeed, 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).




Re: Hunt XML released 1.0.0 rc! Support for parsing, encoding, serialize, unserialize, object binding ..

2019-12-06 Thread Joseph Rushton Wakeling via Digitalmars-d-announce

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:
And -- mostly out of curiosity -- what are the major 
differences compared to other D XML libraries


or my beloved dom.d


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.


Re: Hunt XML released 1.0.0 rc! Support for parsing, encoding, serialize, unserialize, object binding ..

2019-12-05 Thread JN via Digitalmars-d-announce

On Thursday, 5 December 2019 at 16:48:01 UTC, zoujiaqing wrote:

## Sample code for it
```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 :)


Re: Hunt XML released 1.0.0 rc! Support for parsing, encoding, serialize, unserialize, object binding ..

2019-12-05 Thread zoujiaqing via Digitalmars-d-announce


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 
 and dxml 
 ... ?


Hunt XML: Easier to use API. It's like dom4j..

Have comments like XmlElement, XmlAttribute, XmlIgnore and more ..

## Sample code for it
```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 = 1;
user.name = "Brian";

auto doc = toDocument(user);

writeln(doc.toPrettyString());
}

```

## Result for sample code
```xml

Brian

```



Re: Hunt XML released 1.0.0 rc! Support for parsing, encoding, serialize, unserialize, object binding ..

2019-12-05 Thread Adam D. Ruppe via Digitalmars-d-announce
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 libraries


or my beloved dom.d


Re: Hunt XML released 1.0.0 rc! Support for parsing, encoding, serialize, unserialize, object binding ..

2019-12-05 Thread Joseph Rushton Wakeling via Digitalmars-d-announce

On Thursday, 5 December 2019 at 15:55:29 UTC, zoujiaqing wrote:

# Hunt-XML
A XML library for D Programming Language. Support for parsing, 
encoding, serialize, unserialize, object binding!


## Features
* DOM parser: parse XML Document
* DOM writer: to string and to file
* Object serialization/deserialization


Cool, 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 
 and dxml 
 ... ?


Hunt XML released 1.0.0 rc! Support for parsing, encoding, serialize, unserialize, object binding ..

2019-12-05 Thread zoujiaqing via Digitalmars-d-announce

# Hunt-XML
A XML library for D Programming Language. Support for parsing, 
encoding, serialize, unserialize, object binding!


## Features
* DOM parser: parse XML Document
* DOM writer: to string and to file
* Object serialization/deserialization


### Sample code for parsing
```D
import hunt.xml;

void main()
{
Document doc = Document.parse("attr2=\"two\"/>");


if(doc.validate())
{
auto node = doc.firstNode();

writeln(node.getName()); // print single-element
}
}
```

### Sample code for File load / save
```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