Yorick Peterse
6cb2d54875
Added XML::Element#inner_text=
...
This method can be used to more easily set the text of an element, without
having to manually muck around with XML::Text instances.
2014-09-10 23:25:39 +02:00
Yorick Peterse
cfbdf1bdb1
Removed YARD crap from Markdown files.
2014-09-10 22:46:58 +02:00
Yorick Peterse
98cd54685d
Updated the Rubies to run Travis on.
2014-09-10 22:17:04 +02:00
Yorick Peterse
6d19c9b311
Added XML::Element#get
...
This method can be used to directly retrieve an attribute value.
2014-09-10 19:03:32 +02:00
Yorick Peterse
e2dab952d0
Added XML::Node#before and XML::Node#after
...
These methods can be used to insert nodes before/after other nodes without
manually having to mess around with node sets.
This fixes #28 .
2014-09-09 22:48:31 +02:00
Yorick Peterse
e0f8965616
Rephrased parts of the README.
2014-09-09 21:04:50 +02:00
Yorick Peterse
fccc6359e1
Corrected YARD formatting.
2014-09-09 00:47:51 +02:00
Yorick Peterse
ef03a12f99
Optimize descendant-or-self and child axes.
...
By using NodeSet#concat we can further reduce the amount of object allocations.
This in turn greatly reduces the time it takes to query large documents using
descendant-or-self.
2014-09-05 20:20:13 +02:00
Yorick Peterse
9f6035e784
Reduce object allocations in on_axis_descendant
...
By using Traversal#each_node and _not_ calling on_test() (which was only called
for node_matches?) we can save ourselves a few object allocations.
2014-09-05 19:58:37 +02:00
Yorick Peterse
98984de540
Moved Document#each_node into a separate module.
...
This allows it to be re-used by XML::Node.
2014-09-05 19:42:38 +02:00
Yorick Peterse
8f562c24dd
Use NodeSet#concat for descendant-or-self.
...
In a sample XML file this removes around 3400 NodeSet allocations.
2014-09-05 10:56:49 +02:00
Yorick Peterse
bcdce306e5
Added NodeSet#concat.
...
This method allows two sets to be concatenated together without the need of
creating a 3rd node set (as is the case with NodeSet#+).
2014-09-05 10:07:22 +02:00
Yorick Peterse
8601cf6e74
Removed manifest from the Gemspec.
2014-09-04 14:02:56 +02:00
Yorick Peterse
1fdf876a93
Tweaked docs of the XPath code a bit.
2014-09-04 10:17:32 +02:00
Yorick Peterse
d8e2b97031
Tweaked docs of the XML parsers.
2014-09-04 09:34:59 +02:00
Yorick Peterse
89689d9bb6
Basic example for the pull parser.
2014-09-04 00:32:39 +02:00
Yorick Peterse
404ae51fd5
Added a basic set of examples on using Oga.
2014-09-04 00:24:13 +02:00
Yorick Peterse
6c90749ec6
Updated XPath node in the README.
2014-09-04 00:15:41 +02:00
Yorick Peterse
fbf3ae6e36
Manually increment XPath indexes.
...
This ensures that the index is only incremented for elements that match a node
test.
2014-09-03 23:56:13 +02:00
Yorick Peterse
81a62a6f00
Added XML::Attribute#text
...
This allows attributes to also be used for axes such as "=".
2014-09-03 23:38:00 +02:00
Yorick Peterse
9b8e9f49c6
Support for lexing empty attribute values.
...
This ensures that Oga can lex the following properly:
<input value="" />
Previously Ragel would stop upon finding the empty string. This was caused due
to the string rules being declared as following:
string_dquote = (dquote ^dquote+ dquote);
string_squote = (squote ^squote+ squote);
These rules only match strings _with_ content, not without. Since Ragel stops
consuming input the moment it finds unhandled data this resulted in incorrect
tokens being emitted.
2014-09-03 23:10:50 +02:00
Yorick Peterse
dc5874f5aa
Show XML parsing errors when using IO as input.
...
Previously this wouldn't display anything due to the IO object being exhausted.
To fix this the input has to be wound back to the start, which means re-reading
it. Sadly I can't think of a way around this that doesn't require buffering
lines while parsing them (which massively increases memory usage).
2014-09-03 22:52:59 +02:00
Yorick Peterse
d67f43508d
Use #each_line instead of #lines.
...
IO#each_line is deprecated so lets not rely on it.
2014-09-03 22:31:54 +02:00
Yorick Peterse
bd31379c85
Fixed processing of nested predicates.
...
This ensures that nested predicates and functions that depend on predicates are
processed correctly.
2014-09-03 20:56:07 +02:00
Yorick Peterse
3196050978
Specs for nested predicates & self axis.
2014-09-03 20:55:55 +02:00
Yorick Peterse
e858b54c58
Use nested node stacks for predicates.
...
This ensures the current context node is set correctly when using the "self"
axis inside a path that's inside a predicate, e.g.
foo/bar[baz/. = "something"]
Here the "self" axis should refer to foo/bar/baz, _not_ foo/bar.
2014-09-03 19:54:16 +02:00
Yorick Peterse
2b96d65103
XPath "self" axis inside predicates.
...
The "self" axis should use the current context node when inside a predicate.
2014-09-03 09:40:17 +02:00
Yorick Peterse
71f2b42074
Convenience methods for parsing XML/HTML.
2014-09-03 09:31:48 +02:00
Yorick Peterse
efc3827865
Extended the inline JS lexer spec.
2014-09-03 09:26:12 +02:00
Yorick Peterse
49ddebf358
Tighten lexing of T_TEXT nodes.
...
Thanks to some heavy rubberducking with @whitequark the lexer is now a little
bit better at lexing T_TEXT nodes. For example, previously the following could
not be lexed properly:
"foo < bar"
There might still be some tweaking to do but we're getting there.
2014-09-03 00:51:13 +02:00
Yorick Peterse
145315c26a
Spec for inline JS and CDATA tags.
2014-09-03 00:34:10 +02:00
Yorick Peterse
f268af5bc6
Fixed token position in the inline JS spec.
2014-09-03 00:30:27 +02:00
Yorick Peterse
868df603ab
Added spec for inline JS + comments.
2014-09-03 00:26:45 +02:00
Yorick Peterse
07617a9c47
Failing spec for lexing inline Javascript.
2014-09-02 22:50:36 +02:00
Yorick Peterse
96b7296910
Ragel variable of element closing tags.
2014-09-02 22:50:21 +02:00
Yorick Peterse
d92133ef43
Benchmark Oga XPath evaluation without the parser.
...
This gives better insight in the performance of the evaluator itself.
2014-09-02 20:55:42 +02:00
Yorick Peterse
84d6ba96c2
Benchmarks for comparing Oga with others.
...
This includes two benchmarks: one for parsing XML and one for evaluating XPath.
2014-09-02 20:45:23 +02:00
Benjamin Klotz
0b096dfe25
Use proper create_makefile
...
Using create_makefile('liboga/liboga') will compile liboga.so into
path-to-gem/lib/liboga/ and therefore require_relative in oga.rb will fail.
Therefore the right parameter for create_makefile is 'liboga' ->
path-to-gem/lib/liboga.so
2014-09-02 20:27:20 +02:00
Yorick Peterse
9649b50cc9
XML module for more easily querying using XPath.
2014-09-02 20:16:52 +02:00
Yorick Peterse
ad34ab47a0
Support for binding/evaluating XPath variables.
2014-09-02 19:04:02 +02:00
Yorick Peterse
5a0e8c5480
Lexing/parsing of XPath variable references.
2014-09-02 10:52:08 +02:00
Yorick Peterse
3dcd0e4584
Compare results of the XML pull parser benchmark.
2014-09-02 10:06:09 +02:00
Yorick Peterse
adb125c647
Compare results of the XML parser benchmark.
2014-09-02 10:05:11 +02:00
Yorick Peterse
aad9279048
Removed a useless XML parser benchmark.
2014-09-02 10:04:20 +02:00
Yorick Peterse
69f1cd0a40
Compare results of the lexer benchmark.
2014-09-02 10:03:41 +02:00
Yorick Peterse
8bab5c70d8
Removed two useless XML lexer benchmarks.
2014-09-02 10:03:30 +02:00
Yorick Peterse
c69d77109b
Require benchmark-ips 2.0 or newer.
2014-09-02 09:58:14 +02:00
Yorick Peterse
5de37bdf81
Support for the XPath ">=" operator.
2014-09-01 22:45:01 +02:00
Yorick Peterse
099227901a
Support for the XPath "<=" operator.
2014-09-01 22:40:50 +02:00
Yorick Peterse
6eacf74da4
Fixed comparing node equality in XPath expressions
...
Previously this would take the text of the entire node set, not of the first
node in the set.
2014-09-01 22:34:18 +02:00