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



Kasimier Buchcik wrote:
Hi,

Bugzilla:
http://bugzilla.gnome.org/show_bug.cgi?id=331273

Regards,

Kasimier
Kasimier,

To give you an idea of how I think the IDs should be modified, take a look at this diff:
http://www.ctindustries.net/libxml/tree.c.diff.txt

It's still a work in progress, as I am also fixing up some of the other sibling functions. These aren't DOM compliant functions (DOM only works on children with these functions), but the library in general has always allowed attributes to be added using these functions (as they are generic and not DOM specific), so I don't think they should prevent it now and probably should deal with IDs as well. There are a few potential crashes dealing with attribute additions in these which is what I'm currently still fixing.

As far as copy/import/adopt goes. I have found a couple of conflicting opinions for this. One is that the importing doc should determine if an attribute is added as an ID. The other (which is also how it is implemented in Xerces) is that an attribute should be copied/imported with the same ID-ness as in the source document. The latter would be in line with how XInclude works and imo would make it easy for a user to retrieve by ID in the importing doc.

I also found out that all attributes require an element to be considered an ID (even the manually set ones), so modified the code appropriately for this. In the event the copy/import goes the way of the importing doc determining ID-ness, the manually set IDs do copy over as IDs regardless of what the importing doc says, which would add a bit more complexity on top of the XInclude handling.

Thoughts?

Rob



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