-
-
Notifications
You must be signed in to change notification settings - Fork 905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid xml:id permitted in XML documents #2364
Comments
Hey, Justin, thanks for opening this issue. It may be a day or two before I'm able to dig in, but I promise I will take a look. |
Whoop, I see what's happening. You're using #! /usr/bin/env ruby
require "nokogiri"
doc = Nokogiri.XML('<bad xml:id="////"></bad>')
doc.errors
# => [#<Nokogiri::XML::SyntaxError: 1:19: ERROR: xml:id : attribute value //// is not an NCName>]
doc.xpath('//bad').first.attributes
# => {"id"=>#<Nokogiri::XML::Attr:0x50 name="id" namespace=#<Nokogiri::XML::Namespace:0x3c prefix="xml" href="http://www.w3.org/XML/1998/namespace"> value="////">} So, a few things to note:
Does this answer your questions? |
Going to close this, but please do comment if I haven't addressed your question in my previous post and I'm happy to reopen it. |
Thanks @flavorjones. This was most helpful. Sorry for misunderstanding the spec. |
Please describe the bug
Nokogiri permits invalid "xml:id" attributes.
This id value is not valid according to the spec https://www.w3.org/TR/xml-id/#syntax The value of an "xml:id" attribute must an NCName (https://www.w3.org/TR/xml-names11/#NT-NCName)
I would expect that the case above ought to result in some sort of exception.
I'm very sorry... 🥲
The text was updated successfully, but these errors were encountered: