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



Hi,

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

Example:

<!DOCTYPE foo [
  <!ELEMENT foo (bar)>
  <!ELEMENT bar>
  <!ATTLIST bar myId ID #IMPLIED>
]>

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

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

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

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

OK. So my argument against IDness detection based on DTDs is not valid.


Regards & thanks for clarification,

Kasimier



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