Skip to content
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

A lot of validity errors after upgrading from 1.6.3.1 to 1.6.5 #1208

Closed
PascalTurbo opened this issue Dec 16, 2014 · 7 comments
Closed

A lot of validity errors after upgrading from 1.6.3.1 to 1.6.5 #1208

PascalTurbo opened this issue Dec 16, 2014 · 7 comments

Comments

@PascalTurbo
Copy link

Hi There,

I've upgraded nokogiri version and now I got a lot of validity errors like these:

element a: validity error : ID convocation_hall already defined
element a: validity error : ID French_Language_Service already defined
element a: validity error : ID Information%20on%20lawyers%20or%20paralegals already defined
element a: validity error : ID Law%20Society%20Referral%20Service%20(LRS) already defined
element a: validity error : ID licensing_process already defined
element a: validity error : ID Media%20Inquiries already defined
element a: validity error : ID membership_inquiry already defined
element a: validity error : ID lsuc_portal_support already defined
element a: validity error : ID helpline already defined
element a: validity error : ID Practice%20Review already defined
element a: validity error : ID Spot%20Audit already defined
element a: validity error : ID Tribunal%20Notices already defined
element a: validity error : ID trustee_services already defined
element div: validity error : ID skype_c2c_menu_container already defined
element a: validity error : ID skype_c2c_menu_click2call_action already defined
element a: validity error : ID skype_c2c_menu_click2sms_action already defined
element a: validity error : ID skype_c2c_menu_add2skype_text already defined
element table: validity error : ID bodyContentTable already defined
element td: validity error : ID breadCrumbCell already defined
element td: validity error : ID printIconCell already defined
element td: validity error : ID bodyContentCell2 already defined
element area: validity error : ID DefaultHotspot13 already defined
element td: validity error : ID infoboxCell already defined
element table: validity error : ID infoboxTable1 already defined
element td: validity error : ID infobox1BG already defined
element table: validity error : ID infoboxTable2 already defined
element td: validity error : ID infobox2BG already defined
element table: validity error : ID infoboxTable3 already defined
element td: validity error : ID infobox3BG already defined
element table: validity error : ID bodyContentTable already defined
element td: validity error : ID breadCrumbCell already defined

@zenspider
Copy link
Contributor

We at least need a repro to help on this. Please provide a code / data snippet that reproduces this error.

@flavorjones
Copy link
Member

Hi @PascalTurbo,

This is likely due to the upgrade of libxml2 from 2.8.0 to 2.9.2. If you provide us with code and XML to reproduce this, we may be able to help. Otherwise, I'll close this in a few days.

-m

@Thibaut
Copy link

Thibaut commented Dec 29, 2014

This happens whenever Nokogiri parses an element with a duplicate id attribute:

2.2.0 :001 > require 'nokogiri'
 => true 
2.2.0 :002 > Nokogiri::VERSION
 => "1.6.5" 
2.2.0 :003 > Nokogiri::HTML.fragment('<div id="foo"></div><div id="foo"></div>')
element div: validity error : ID foo already defined
 => #<Nokogiri::HTML::DocumentFragment:0x3ffc65813d68 name="#document-fragment" children=[#<Nokogiri::XML::Element:0x3ffc65813a84 name="div" attributes=[#<Nokogiri::XML::Attr:0x3ffc65813a5c name="id" value="foo">]>, #<Nokogiri::XML::Element:0x3ffc658139d0 name="div" attributes=[#<Nokogiri::XML::Attr:0x3ffc658139a8 name="id" value="foo">]>]> 

@zenspider
Copy link
Contributor

On Dec 29, 2014, at 07:54, Thibaut Courouble notifications@github.com wrote:

This happens whenever Nokogiri parses an element with a duplicate id attribute:

2.2.0 :001 > require 'nokogiri'
=> true
2.2.0 :002 > Nokogiri::VERSION
=> "1.6.5"
2.2.0 :003 > Nokogiri::HTML.fragment('

')
element div: validity error : ID foo already defined
=> #<Nokogiri::HTML::DocumentFragment:0x3ffc65813d68 name="#document-fragment" children=[#<Nokogiri::XML::Element:0x3ffc65813a84 name="div" attributes=[#<Nokogiri::XML::Attr:0x3ffc65813a5c name="id" value="foo">]>, #<Nokogiri::XML::Element:0x3ffc658139d0 name="div" attributes=[#<Nokogiri::XML::Attr:0x3ffc658139a8 name="id" value="foo">]>]>

That looks like a warning, not an error. You got a DocumentFragement back... and the warning seems perfectly valid to me, does it not?

@Thibaut
Copy link

Thibaut commented Dec 30, 2014

@zenspider yes, this doesn't break any functionality, but an option to disable the warnings would be nice. I use Nokogiri to parse thousands of 3rd-party pages for devdocs.io and the warnings are flooding my debug logs, making them hard to read.

@s3ththompson
Copy link

Dupe of #1196

@flavorjones
Copy link
Member

I've re-opened #1196. Closing this one.

larskanis added a commit to larskanis/nokogiri that referenced this issue Nov 22, 2015
…nc behavior with JRuby.

This was introduced due to sparklemotion#1196
and sparklemotion#1208 .

However it turned out, that the change in libxml-2.9.2 was a regression, that was
fixed in: https://bugzilla.gnome.org/show_bug.cgi?id=737840 and libxml-2.9.3.

If I read the libxml sources right, it seems, that xmlDocCopyNode() is not
intended to emit any such warnings at all. Only errors leading to a failure
of the function are emitted. However these errors should be reported to ruby
space in the form of exceptions (this is not yet implemented - currently either
nil is returned or a generic error text is raised).

This patch also synchronizes the behavior on MRI to that of JRuby, so that
the error list is filled from the parser only and that it is shared after
Document#dup .
larskanis added a commit that referenced this issue Dec 17, 2015
…nc behavior with JRuby.

This was introduced due to #1196
and #1208 .

However it turned out, that the change in libxml-2.9.2 was a regression, that was
fixed in: https://bugzilla.gnome.org/show_bug.cgi?id=737840 and libxml-2.9.3.

If I read the libxml sources right, it seems, that xmlDocCopyNode() is not
intended to emit any such warnings at all. Only errors leading to a failure
of the function are emitted. However these errors should be reported to ruby
space in the form of exceptions (this is not yet implemented - currently either
nil is returned or a generic error text is raised).

This patch also synchronizes the behavior on MRI to that of JRuby, so that
the error list is filled from the parser only and that it is shared after
Document#dup .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants