Ticket #128 (new defect)

Opened 11 months ago

Last modified 11 months ago

Colons in attribute values are seemingly mis-handled

Reported by: robholland Owned by: why
Priority: major Milestone:
Component: lib/hpricot Version:
Keywords: Cc:

Description

Works fine with one ':'

doc = Hpricot("<root id='foo:bah'/>")

=> #<Hpricot::Doc {emptyelem <root id="foo:bah">}>

doc/"#foo:bah"

=> #<Hpricot::Elements[{emptyelem <root id="foo:bah">}]>

2+ ':' breaks things

doc = Hpricot("<root id='foo:bah:foo'/>")

=> #<Hpricot::Doc {emptyelem <root id="foo:bah:foo">}>

doc/"#foo:bah:foo"

=> #<Hpricot::Elements[]>

=> #<Hpricot::Elements[]>

doc/"[@id='foo:bah:foo']"

=> #<Hpricot::Elements[]>

I guess this is some how related to namespace parsing? Either way, I would expect the latter search to work, even if only via the latter method of comparing against @id. As far as I know there is no reason to look for namespaces inside of attribute values.

Change History

Changed 11 months ago by robholland

I forgot to mention, in case it helps/matters, an example of this in the wild is as part of the Oval specifications which I'm attempting to parse with hpricot.

You can see an example here:

http://oval.mitre.org/repository/data/DownloadItem?id=oval%3aorg.mitre.oval%3atst%3a1573&type=view

Note: See TracTickets for help on using tickets.