Emmanuel Gil Peyrot
1496819546
Implement a nicer Debug for NamespaceSet
...
The existing one was quite hard to parse visually, this makes it a lot
easier to understand what is what.
2019-02-27 20:00:02 +01:00
Emmanuel Gil Peyrot
f68826057b
Fix clippy lints
2019-02-21 21:06:23 +01:00
lumi
f0dd03d633
Split Node
off into its own module: node.rs
2018-12-23 15:59:13 +01:00
lumi
c5c8dee20a
Get rid of IntoElements
, replace it with Into<Node>
and <T: Into<Node> IntoIterator<Item = T>
. This is a backwards-incompatible change, but should require minimal changes.
...
Doing this splits the `append` method in `ElementBuilder` into two methods. `append` now appends exactly one node, while `append_all` appends an iterator of nodes.
Add `remove_child`, which removes the first child that has a specific name and namespace, then returns it if it exists.
Add a lot of convenience methods on `Node`: `as_text_mut`, `as_element_mut`, `into_text`, `into_element`.
2018-12-23 15:42:50 +01:00
Valentin Lorentz
f1f5f5df11
Fix doc to reflect the switch from xml-rs to quick-xml.
2018-06-23 12:06:18 +00:00
lumi
fac64400f1
Put the tests in element.rs into a module block.
2018-05-29 16:22:22 +02:00
Emmanuel Gil Peyrot
7ed4be96eb
impl IntoAttributeValue for std::net::IpAddr
2018-05-29 16:03:44 +02:00
lumi
4f588f615d
Fix CDATA handling, add relevant test, update CHANGELOG, bump version to 0.9.1.
2018-05-29 15:59:36 +02:00
Matt Bilker
96f223b7e3
bump version to 0.9.0 and upgrade quick-xml to 0.12.1
2018-04-10 21:01:18 -04:00
lumi
8924d2d594
Merge branch 'linkmauve/minidom-rs-failure'
...
# Conflicts:
# src/tests.rs
2018-02-18 21:32:51 +01:00
Emmanuel Gil Peyrot
236582b24e
update quick_xml and migrate from error-chain to failure
2018-02-18 20:45:09 +01:00
Emmanuel Gil Peyrot
055caa8e24
add tests for some XML errors
2018-02-18 19:41:03 +01:00
Yue Liu
f456600efd
Support comment and write to quick-xml Writer
2018-01-09 23:29:48 -08:00
lumi
d079f0503a
make sure that my tests actually work...
2018-01-01 14:34:24 +01:00
lumi
118bbb5462
add the spectest.xml from https://gitlab.com/lumi/minidom-rs/issues/8
2018-01-01 14:28:17 +01:00
lumi
cdb2cb8d86
try not to allocate memory when comparing ending tags with starting tags
2018-01-01 14:01:03 +01:00
lumi
0e76e5211d
Merge branch 'compare-with-prefix' into 'master'
...
Compare with prefix
See merge request lumi/minidom-rs!23
2018-01-01 12:26:19 +00:00
Maxime “pep” Buquet
9959abbb25
Be explicit about quick-xml Events we are handling
2017-12-31 16:31:26 +00:00
Maxime “pep” Buquet
db70487a31
Change prefix fn to return Option<&str>
2017-12-31 15:24:28 +00:00
Maxime “pep” Buquet
9c498044ee
element: Add tests for Element::from_reader
2017-12-31 07:19:24 +01:00
Maxime “pep” Buquet
e250e9cf2c
Add doctest for prefix fn
2017-12-30 17:26:15 +01:00
Maxime “pep” Buquet
1c3a701d2e
element: Fix element name comparison in from_reader
...
quick-xml's Events seem to always return prefixed names, and the
from_reader function, when comparing name of the pop-ed element, and
received event element, was using the unprefixed name to compare.
2017-12-30 17:26:15 +01:00
Emmanuel Gil Peyrot
df76bc147a
fix clippy warnings
2017-11-12 19:58:07 +00:00
lumi
f4debf1bbf
Merge branch 'tafia/minidom-rs-quick_xml_optim'
2017-11-08 18:19:05 +01:00
Emmanuel Gil Peyrot
b49ea5175d
implement IntoElements on Into<Element> instead of Element
2017-08-27 01:36:18 +01:00
lumi
87a19e5e58
Merge branch 'element_has_ns' into 'master'
...
add Element::has_ns(&self, NS)
See merge request !16
2017-08-20 15:03:14 +00:00
Emmanuel Gil Peyrot
89ab8d9aca
fix a FIXME, break value is now stable
2017-08-19 00:34:44 +01:00
Astro
8af3e50311
add Element::has_ns(&self, NS)
2017-08-19 01:17:45 +02:00
Astro
b141559081
rename namespaces mod to namespace_set
2017-08-13 17:29:38 +02:00
Astro
7297dbc5fd
namespaces: add some tests
2017-08-13 02:48:28 +02:00
Astro
0148790a01
move NamespaceSet to namespaces mod
2017-08-13 02:35:24 +02:00
Astro
7d2699e08e
NamespaceSet::set_parent(): don't require a full Element
...
by passing just a reference to a NamespaceSet we could reuse this for
xmlns elision in the serialization code.
2017-08-13 02:28:44 +02:00
Astro
98fd71fd3f
NamespaceSet: rm unneeded cast
2017-08-13 02:26:45 +02:00
Astro
26f03c27ed
optimize Element::write_to_inner() with CoW
2017-08-13 02:24:40 +02:00
Astro
a01cf553ae
switch Element namespaces to NamespaceSet with parent reference
2017-08-13 02:24:34 +02:00
Astro
77bc215cba
tests: add namespace inheritance tests
2017-08-13 02:19:17 +02:00
Astro
052c46635a
escape text and attribute values
2017-08-12 02:05:18 +02:00
Johann Tuffe
444b78c63a
unescape_and_decode_value for element attributes
2017-07-08 12:18:15 +08:00
Bastien Orivel
9cec9fce9b
Replace xml-rs by quick_xml
...
quick_xml is way faster than xml-rs
Here is an example with a quick atom parser:
With xml-rs:
test parse_factorio_atom ... bench: 3,295,678 ns/iter (+/- 165,851)
With quick_xml:
test parse_factorio_atom ... bench: 203,215 ns/iter (+/- 13,485)
Unfortunately I had to break the API for this change to happen.
* Element::from_reader now takes `R: BufRead` instead of `R: Read`
* Element::write_to now takes `W: io::Write` instead of `EventWriter<W: Write>`
This migration also allow us to have a write_to function which assumes
we're already in a given namespace (see `write_to_in_namespace`).
2017-06-10 17:17:19 +02:00
lumi
d6a9e6e9ea
implement ToAttributeValue on integral types, bump version
2017-05-28 00:25:57 +02:00
Emmanuel Gil Peyrot
638866fa4c
implement IntoAttributeValue for u32, u16 and u8
2017-05-27 22:56:17 +01:00
Emmanuel Gil Peyrot
d63c7b991d
implement IntoAttributeValue for usize
2017-05-27 22:45:22 +01:00
lumi
9d45230c17
should re-export more things under the error module
2017-05-22 19:30:52 +02:00
lumi
508c971416
port error.rs to error_chain, bump version to 0.4.0
2017-05-22 19:20:01 +02:00
lumi
3341d7e692
turns out i was wrong and clippy was right, all hail clippy
2017-05-22 18:49:24 +02:00
lumi
dbcbe7cd9b
make clippy happy
2017-05-22 18:45:43 +02:00
lumi
3223fc11fe
this will already get auto-dereferenced
2017-05-22 16:15:26 +02:00
lumi
49d25968cb
no need to clone that
2017-05-22 16:15:04 +02:00
Emmanuel Gil Peyrot
f4e5f5380e
implement IntoElements and IntoAttributeValue for &String
2017-05-21 21:07:37 +01:00
lumi
83d80dd235
Add iterators over attributes, nodes and text nodes. Clean up lots of code. Add as_element and as_text on Node. Add some inline annotations.
2017-05-14 16:38:56 +02:00