Re: [xml] Potential wrong usage of xmlIsID() in tree.c

On Thu, Feb 23, 2006 at 01:03:24PM +0100, Kasimier Buchcik wrote:
The problem occurs regardless of a validation being performed or not.


<!DOCTYPE foo [
  <!ELEMENT foo (bar)>
  <!ELEMENT bar>

Assume we parse and validate the following XML:
  <bar myID="1"/>

The API wouldn't prevent us to add a <bar> to the <bar>:
  <bar myID="1">

If we now add @myID to the newly created <bar>, then the current
ID-autodetection would mark it as of type ID:
  <bar myID="1">
    <bar myID="2"/>

The problem I see here, is that the second <bar> is not valid according
to the DTD, and thus its @myID shouldn't become an ID; that's why

  I think this is wrong. Even if the element raised a validity error, the
IDNESS property of the attribute would still be there.


Daniel Veillard      | Red Hat
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]