Commit graph

4 commits

Author SHA1 Message Date
lumi
c6f9cc485f Merge branch 'Eijebong/minidom-rs-fix_namespaced_attributes'
# Conflicts:
#	src/tests.rs
2017-04-26 01:02:17 +02: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
7c04aff416 overhauling the library, made tests pass 2017-03-08 20:34:17 +01:00