After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 319964 - HTMLparser bug in which attributes with quotes are parsed as namespaces
HTMLparser bug in which attributes with quotes are parsed as namespaces
Status: RESOLVED FIXED
Product: libxml2
Classification: Platform
Component: general
2.6.x
Other All
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2005-10-27 10:37 UTC by Michael Day
Modified: 2007-06-12 15:15 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Michael Day 2005-10-27 10:37:28 UTC
Please describe the problem:
HTMLparser treats "foo:bar" as an XML namespaced attribute, when it should just
treat it as a simple attribute containing a colon.

Steps to reproduce:
1. 
2. 
3. 


Actual results:


Expected results:


Does this happen every time?


Other information:
Comment 1 Daniel Veillard 2006-10-17 18:41:59 UTC
 I don't understand. It seems to work fine for me:

paphio:~/XML -> cat tst.html
<html>
<body>

<img src="foo.gif" alt="foo:bar">
</body>
</html>

paphio:~/XML -> xmllint --html --debug tst.html
HTML DOCUMENT
URL=tst.html
standalone=true
  DTD(html), PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN, SYSTEM http://www.w3.org/TR/REC-html40/loose.dtd
  ELEMENT html
    ELEMENT body
      TEXT
        content=
      ELEMENT img
        ATTRIBUTE src
          TEXT
            content=foo.gif
        ATTRIBUTE alt
          TEXT
            content=foo:bar
paphio:~/XML ->

  please provide an example,

Daniel
Comment 2 Michael Day 2006-10-19 11:15:25 UTC
Sorry, I wasn't clear: the problem is that if the *name* of the attribute contains a colon, then it tries to treat it as a namespaced attribute, but in a HTML document there are no such thing as namespaces. Example:

<p foo:bar="meep">Hello, world!</p>

foo.html:3: namespace error : Namespace prefix foo of attribute bar is not defined

Of course, if you actually try to declare the namespace prefix that won't work either:

<p xmlns:foo="blah" foo:bar="meep">Hello, world!</p>

foo.html:3: namespace error : Namespace prefix xmlns of attribute foo is not defined

Ideally the HTMLparser should treat attribute names as tokens that may contain colons, just like the XML 1.0 spec pre-namespaces.
Comment 3 Daniel Veillard 2007-06-12 15:15:56 UTC
Makes sense, fixed in SVN:

paphio:~/XML -> xmllint --html test.html 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body><p foo:bar="meep">Hello, world!</p></body></html>
paphio:~/XML -> xmllint --debug --html test.html 
HTML DOCUMENT
URL=test.html
standalone=true
  DTD(html), PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN, SYSTEM http://www.w3.org/TR/REC-html40/loose.dtd
  ELEMENT html
    ELEMENT body
      ELEMENT p
        ATTRIBUTE foo:bar
          TEXT
            content=meep
        TEXT
          content=Hello, world!
paphio:~/XML -> 

  thanks for the report !

Daniel