Yorick Peterse
9959f5cda4
Don't remove namespace attributes when registering
...
When registering namespaces from an attributes list the attributes should _not_
be removed.
This fixes #45 .
2014-09-15 22:04:03 +02:00
Yorick Peterse
795e669632
Ignore default NS when serializing elements.
...
When a default namespace is set (using xmlns="...") the method
XML::Element#to_xml should _not_ include the namespace prefix in the output.
2014-09-15 21:42:08 +02:00
Yorick Peterse
abbd8d6f84
Handle registering of default XML namespaces.
...
When the default namespace is registered (using xmlns="...") Oga now properly
sets the namespace of the container and all child elements.
This fixes #44 .
2014-09-15 21:36:15 +02:00
Yorick Peterse
ad2e040f05
Handle lexing of input such as just "</".
...
Previously this would cause the lexer to go in an infinite loop in the "text"
state machine.
This fixes #37 .
2014-09-15 17:20:06 +02:00
Yorick Peterse
b06eadc812
XPath support for absolute paths without tests.
...
This allows Oga to parse and evaluate the XPath expression "/". This expression
can be used to select just the root node/document.
This fixes #35 .
2014-09-15 17:06:58 +02:00
Yorick Peterse
398aaf68bc
Return a correct list of available namespaces.
...
This ensures that inner namespaces take precedence over outer namespaces.
Fixes #40 .
2014-09-14 18:42:02 +02:00
Tero Tasanen
3c930433c4
Change Hash syntax to be consistent with other tests
2014-09-14 15:04:15 +03:00
Tero Tasanen
d0f48e0e3c
Added a lexer test case for uppercase void elements
2014-09-14 14:20:58 +03:00
Tero Tasanen
9c8dd60f92
Fix test cases
...
- Remove duplicate tests
- use parse_html helper
2014-09-14 14:14:51 +03:00
Tero Tasanen
9f71b1ec7b
Ignore casing when testing for html void elements
...
Fixes #36
2014-09-14 12:02:02 +03:00
Yorick Peterse
d082822cdc
Removed the node_type method crap.
...
The logic this was used for now only resides in the pull parser, instead of
being exposed to the public.
This fixes #30 .
2014-09-13 15:09:52 +02:00
Yorick Peterse
b8a82b2094
Separate XML attributes by spaces.
...
This was originally reported by @jrochkind and partially patched by @billdueber.
My patches are built upon the latter, but without the need of using Array#map,
Array#join, etc. They also contain a few style changes.
This fixes #32 and #33 .
2014-09-13 11:47:06 +02:00
Yorick Peterse
319d622fa5
Include namespaces when converting attrs to XML.
2014-09-11 14:03:04 +02:00
Yorick Peterse
c45d32a37e
Methods for adding attributes to elements.
...
The methods XML::Element#add_attribute and XML::Element#set can be used to more
easily add attributes to elements. The first method simply adds an Attribute
instance and links it to the element. This allows for fine grained control over
what data the attribute should contain. The second method ("set") simply sets an
attribute based on a name and value, optionally creating the attribute if it
doesn't already exist.
2014-09-10 23:55:29 +02:00
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
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
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
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
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
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
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
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
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
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
Yorick Peterse
8884db8cb6
Support for the XPath ">" operator.
2014-09-01 22:23:35 +02:00
Yorick Peterse
6b45a03cb4
Support for the XPath "<" operator.
2014-09-01 22:20:32 +02:00
Yorick Peterse
e1d9e62b72
Support for the XPath "!=" operator.
2014-09-01 20:48:11 +02:00
Yorick Peterse
9e5f15787d
Support for the XPath "=" operator.
2014-09-01 18:57:12 +02:00
Yorick Peterse
1a6c0f0d35
Renamed various XPath operator specs.
2014-09-01 18:50:13 +02:00
Yorick Peterse
a70645fb89
Support for the XPath sub/- operator.
2014-08-29 09:41:17 +02:00
Yorick Peterse
89686b6cff
Support for the XPath mul/* operator.
2014-08-29 09:36:40 +02:00
Yorick Peterse
034b360d13
Support for the XPath "mod" operator.
2014-08-29 09:31:11 +02:00
Yorick Peterse
78c8cd1323
Support for the XPath "div" operator.
2014-08-28 23:05:12 +02:00
Yorick Peterse
ced7f739fc
Support for the XPath "add" / "+" operator.
2014-08-28 21:18:09 +02:00
Yorick Peterse
4fa40b58cf
Support for the XPath "or" operator.
2014-08-28 21:01:12 +02:00
Yorick Peterse
4f189d9218
Support for the XPath "and" operator.
2014-08-28 09:42:55 +02:00