Commit graph

122 commits

Author SHA1 Message Date
lumi
64f212d11b Merge branch 'fix_equality' into 'master'
Fix the PartialEq implementation for Element

Closes #3

See merge request !3
2017-04-25 22:44:59 +00:00
Eijebong
0d0c4b76eb Fix the PartialEq implementation for Element
The order of attributes in an `Element` doesn't matter anymore.
`<elem a="b" c="d" />` and `<elem c="d" a="b" />` are now correctly
considered equal.

For that I had to derive `PartialOrd` and `Ord` for `Attribute`.
This allows us to sort cloned vectors of `Attribute` in the `PartialEq`
implementation and compare them instead of the struct `attributes`.

Fixes #3
2017-04-24 21:15:53 +02:00
Eijebong
6f0e88b25b Correctly add namespaced attributes to elements
Instead of adding the local_name of an attribute, if a prefix exists,
add prefix:local_name to allow users to retrieve it via the namespaced
key name.

For example, with this XML:
```
<?xml version="1.0" encoding="utf-8"?>
<root xml:lang="en" >
</root>
```

`root.attr("xml:lang").unwrap()` will now correctly return "en".
`root.attr("lang")` will not retrieve "xml:lang" value anymore.

This is a breaking change.

Fixes #2
2017-04-24 18:19:50 +02:00
lumi
8f027cfee2 Merge branch 'valid-xml' into 'master'
Make the Debug trait output valid XML

See merge request !1
2017-04-02 20:50:40 +00:00
Emmanuel Gil Peyrot
9af7d252d7 auto-close elements with no child 2017-04-01 13:34:08 +01:00
Emmanuel Gil Peyrot
f301f2cb10 make Debug on Element return valid XML 2017-04-01 13:34:08 +01:00
lumi
7c04aff416 overhauling the library, made tests pass 2017-03-08 20:34:17 +01:00
lumi
5da36ecdf4 license updates 2017-02-27 16:59:47 +01:00
lumi
112b3fa0c8 added documentation url and fixed a dumb mistake 2017-02-25 15:43:56 +01:00
lumi
a047fdd870 add data to Cargo.toml 2017-02-25 15:31:58 +01:00
lumi
9a00c998ae add a test for an issue with namespace propagation 2017-02-25 00:10:18 +01:00
lumi
0a45a6993e document all the things! 2017-02-21 15:46:06 +01:00
lumi
e0b35477cd add ElementBuilder::text 2017-02-20 23:58:44 +01:00
lumi
41e1cf2654 added has_child, fixed some warnings 2017-02-20 02:04:45 +01:00
lumi
663eba6754 implemented text, get_child and get_child_mut; added and updated some tests 2017-02-19 23:42:31 +01:00
lumi
2d97e2d5d9 put Attribute into its own module, take into account prefixes when determining namespaces 2017-02-19 23:29:19 +01:00
lumi
8663a14040 lots of fixes and simplifications of the API 2017-02-19 23:15:43 +01:00
lumi
fda38ff242 add child iterators and fix up some of the tests, which still do not pass (yet) 2017-02-19 21:45:51 +01:00
lumi
75b494e02c Add .gitlab-ci.yml 2017-02-19 20:02:28 +00:00
lumi
977dace536 resolve a cyclic dependency in README.md 2017-02-19 20:59:34 +01:00
lumi
f0ebf7583a add .gitignore, add README.md, add license 2017-02-19 20:57:59 +01:00
lumi
28045361f3 initial commit 2017-02-19 20:46:44 +01:00