Yorick Peterse
9e20b5ca3e
Support for the XPath local-name() function.
2014-08-21 10:21:02 +02:00
Yorick Peterse
2deb7a6d84
Support for the XPath id() function.
...
This comes with the limitation that it *always* uses the "id" attribute. This is
due to Oga not supporting DTD parsing/evaluation.
2014-08-20 21:06:35 +02:00
Yorick Peterse
d351bc26cc
Support for the XPath count() function.
2014-08-20 10:16:06 +02:00
Yorick Peterse
709fa365e0
XPath support for last() + evaluator docs.
...
I really dislike using a stack as it introduces an internal state. Sadly there
doesn't seem to be an easy way around this.
2014-08-19 22:59:26 +02:00
Yorick Peterse
423af37422
Basic support for the XPath last() function.
2014-08-18 19:00:32 +02:00
Yorick Peterse
2817784e6b
Support for the XPath pipe operator.
2014-08-17 22:04:08 +02:00
Yorick Peterse
d1735750c1
Only store unique nodes in XML::NodeSet.
...
It's called a "set" after all.
2014-08-17 22:03:44 +02:00
Yorick Peterse
bb503728af
XPath support for processing instructions.
2014-08-16 22:37:57 +02:00
Yorick Peterse
0d7609da88
Support for parsing XML processing instructions.
2014-08-15 22:23:26 +02:00
Yorick Peterse
8f4eaf3823
Lexing of XML processing instructions.
2014-08-15 22:04:45 +02:00
Yorick Peterse
ccd95d69d8
Support for the XPath comment() test.
2014-08-15 20:49:13 +02:00
Yorick Peterse
4e8cca258c
Fixed lexing of XML CDATA tags.
2014-08-15 20:47:58 +02:00
Yorick Peterse
81edce2eb8
Fixed lexing of XML comments.
...
The previous setup would consume too much. For example the following HTML:
<a><!--foo--><b><!--bar--></b></a>
would result in the following T_COMMENT token:
"foo--><b><!--bar"
The new setup requires the marking of a start position. I'm not a huge fan of
this but there doesn't appear to be a way around this.
2014-08-15 20:42:32 +02:00
Yorick Peterse
4d7f224892
Support for the XPath text() type test.
2014-08-15 10:46:00 +02:00
Yorick Peterse
14aa420091
Use a new base class for XML text nodes.
...
The classes Text, Cdata and Comment now extend CharacterData instead of Text.
2014-08-15 10:43:16 +02:00
Yorick Peterse
24bc84e15e
Added XML::Element#text_nodes.
...
This method returns all the text nodes directly nested in an element.
2014-08-15 10:07:49 +02:00
Yorick Peterse
d0092b434d
Removed Document#available_namespaces.
...
Namespaces aren't scoped per document but instead per element, thus this method
doesn't make that much sense. This also fixes the remaining, failing XPath test.
2014-08-14 23:12:33 +02:00
Yorick Peterse
d34e4697de
Match node types in node_matches?
...
The method XPath::Evaluator#node_matches? now has a special case to handle
"type-test" nodes. This in turn fixes a bunch of failing tests such as those for
the XPath query "parent::node()".
2014-08-14 22:54:19 +02:00
Yorick Peterse
a437d67573
Renamed node_type to type_test.
2014-08-14 22:35:41 +02:00
Yorick Peterse
05f6fc2f8d
Implement node() as a type test, not a function.
2014-08-14 22:30:14 +02:00
Yorick Peterse
6ad5170476
Support for lexing/parsing XPath type tests.
...
Unlike what I thought before syntax such as "node()" is not a function call.
Instead this is a special node test that tests the *types* of nodes, not their
names.
2014-08-14 21:51:58 +02:00
Yorick Peterse
23441bb5a4
Basic support for the XPath node() function.
2014-08-14 18:17:08 +02:00
Yorick Peterse
f2fe2a4b47
Failing XPath spec for double slashes.
...
The lexer doesn't lex things correctly due to "//" and "/" both being separate
rules. As a result the lexer emits two T_SLASH tokens for queries such as
".//foo".
2014-08-13 00:37:12 +02:00
Yorick Peterse
f4ae83498e
Eval specs for the self axis short form.
2014-08-11 09:35:01 +02:00
Yorick Peterse
ffcefa92a7
Eval specs for the descendant-or-self short axis.
...
This currently fails due to the node() function not being implemented just yet.
2014-08-11 09:33:09 +02:00
Yorick Peterse
aef3e0f27e
Evaluator specs for the attribute axis short form.
2014-08-11 09:32:45 +02:00
Yorick Peterse
4d956c9ef0
Support for the XPath "namespace" axis.
2014-08-11 00:58:57 +02:00
Yorick Peterse
873bd82273
Stricted matching of namespaced elements.
2014-08-11 00:47:07 +02:00
Yorick Peterse
78da274452
Updated XPath specs for better namespace handling.
2014-08-11 00:42:06 +02:00
Yorick Peterse
33c28f633b
Proper namespace support for elements.
...
This is still a bit rough on the edges but already way better than the broken
setup I had before.
2014-08-11 00:41:36 +02:00
Yorick Peterse
04cbbdcf9e
Proper namespace support for attributes.
...
This separates namespace handling into namespace names and namespace objects.
The namespace objects are retrieved from the element an attribute belongs to.
Once retrieved the namespace is cached, due to the overhead of retrieving
namespaces in large documents.
2014-08-11 00:40:17 +02:00
Yorick Peterse
fe8f77cf45
Basic work for supporting namespace URIs.
2014-08-08 19:03:42 +02:00
Yorick Peterse
f002061aaa
Extra type validation for XML::Element options.
2014-08-07 21:10:01 +02:00
Yorick Peterse
b1388ff84a
Ripped out inspect fuckery.
...
The old code used for generating Object#inspect values has been ripped out (for
the most part). The result is a non indented but far more compact #inspect
output. The code for this is also easier and doesn't break the signature of
Object#inspect.
2014-08-07 21:09:10 +02:00
Yorick Peterse
798372d099
Test for element attributes without namespaces.
2014-08-07 20:18:02 +02:00
Yorick Peterse
3b2279e410
Don't create empty Namespace nodes.
2014-08-07 20:16:46 +02:00
Yorick Peterse
97e59fe449
Use the Namespace class for namespaces vs Strings.
2014-08-07 20:03:26 +02:00
Yorick Peterse
f653203220
Tests for the Namespace class.
2014-08-07 20:02:56 +02:00
Yorick Peterse
8e8ea64206
Fixed serializing of elements to XML.
2014-08-06 00:04:42 +02:00
Yorick Peterse
d7df908649
Trimmed XML inspect values.
2014-08-05 23:57:12 +02:00
Yorick Peterse
26d4bdc5b1
Support for the XPath "self" axis.
2014-08-05 21:10:12 +02:00
Yorick Peterse
669ad25000
Corrected following-sibling spec description.
2014-08-05 19:28:47 +02:00
Yorick Peterse
8a9b26fa73
Basic support for the preceding-sibling xpath axis
2014-08-05 19:28:26 +02:00
Yorick Peterse
e34a1ed481
Corrected specs for the "parent" xpath axis.
2014-08-05 19:26:01 +02:00
Yorick Peterse
fc1d9776f3
Basic support for the XPath "preceding" axis.
2014-08-05 10:16:37 +02:00
Yorick Peterse
375f3d7870
Basic support for the XPath "parent" axis.
...
The usage of `parent::node()` is not yet supported.
2014-08-05 09:34:57 +02:00
Yorick Peterse
a1f80b4995
Support for the "following-sibling" axis.
...
This also comes with some small cleanups regarding
XPath::Evaluator#node_matches?. This change removes the need to, every time,
also use can_match_node?() to prevent NoMethodError errors from popping up.
2014-08-04 21:51:51 +02:00
Yorick Peterse
57fcbbd0fc
Allow Document#each_node to skip child nodes.
...
Child nodes can be skipped by throwing :skip_children.
2014-08-04 10:00:32 +02:00
Yorick Peterse
ef1ad5406a
Don't yield indexes in Document#each_node.
...
These indexes won't be used so there's no point in yielding them.
2014-08-04 09:08:39 +02:00
Yorick Peterse
4dc85df4e7
Corrected the XPath "following" axis specs.
2014-08-03 22:14:44 +02:00