Skip to content
This repository has been archived by the owner on Aug 26, 2023. It is now read-only.

Flooding of warning saying: "element span: validity error : ID login_btn already defined" #21

Closed
Basher52 opened this issue Mar 11, 2015 · 10 comments

Comments

@Basher52
Copy link

Hi

I'm using nokogumbo as a parser and I'm getting flooded with warnings/messages saying:
element span: validity error : ID login_btn already defined

I boiled down my code and was able to reproduce it with the following code:
require 'open-uri'
require 'nokogumbo'
file = open('http://www.motogp.com/en/Results+Statistics')
doc = Nokogiri::HTML5(file)

The error comes out 2x after performing the 'doc = Nokogiri::HTML5(file)' command.

Would it be possible to supress this message/warning?
Thanks for the help!
Cheers

@rubys
Copy link
Owner

rubys commented Mar 12, 2015

This message is not put out by nokogiri. It seems to be a problem in libxml2.

Issue sparklemotion/nokogiri#1208 was closed with a message that sparklemotion/nokogiri#1196 was re-opened. Issue sparklemotion/nokogiri#1196 was closed saying open a new issue.

@rubys rubys closed this as completed in cbee999 Mar 12, 2015
@rubys
Copy link
Owner

rubys commented Mar 12, 2015

On further investigation, it appears that libxml2 changed, and nokogiri had to change to capture these messages, and that a similar fix is necessary to nokogumbo.

@Basher52
Copy link
Author

I'm still new to github, but i think i understand that your commit should now supress these messages.
So by updating my nokogumbo I assume it should be fixed.
Thanks a lot for the effort and help!

@rubys
Copy link
Owner

rubys commented Mar 12, 2015

hold back for the moment, this fix is broken, I'm still chasing down what the real fix should be.

@Basher52
Copy link
Author

Roger that, I'm not home at the moment but thanks for the heads up

@flavorjones
Copy link
Collaborator

@rubys Let me know if I can assist in any way, having been through a few iterations of this fix on Nokogiri already. ;)

@rubys
Copy link
Owner

rubys commented Mar 12, 2015

Reproducible test case for the problem, with no Nokogumbo:

require 'nokogiri'
doc = Nokogiri::HTML::Document.new()
x1 = Nokogiri::XML::Element.new('a', doc)
x1.set_attribute('id', 'x')
x2 = Nokogiri::XML::Element.new('a', doc)
x2.set_attribute('id', 'x')

@rubys
Copy link
Owner

rubys commented Mar 12, 2015

Opened as sparklemotion/nokogiri#1262

@rubys rubys reopened this Mar 13, 2015
@rubys
Copy link
Owner

rubys commented May 3, 2015

Fixed: sparklemotion/nokogiri@f49e439

@rubys rubys closed this as completed May 3, 2015
@rafbm
Copy link
Contributor

rafbm commented Apr 26, 2016

Isn’t this back? I’m having such warnings when using Nokogumbo only, not with plain Nokogiri.

require 'nokogumbo'
Nokogiri::HTML5('<p id="foo"></p><p id="foo"></p>')
# => element p: validity error : ID foo already defined
require 'nokogiri'
Nokogiri::HTML('<p id="foo"></p><p id="foo"></p>')
# => nothing

Nokogiri: 1.6.7.2
Nokogumbo: 1.4.7

UPDATE: This is gone from later versions.

flavorjones pushed a commit to sparklemotion/nokogiri that referenced this issue Apr 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants