[xml] Character Positions


I need to make a couple of modifications to libxml in order to support some
features required on the project I'm currently working on, and wanted to
check their feasibility with regards to reflecting the changes back into
libxml, or just keep our own private modified version.
The reason I'm asking is concerning the license - I'm going to be linking
libxml (and libxsl / gdome) into a proprietary app, and wanted to see if the
mods would be useful to give back. (Also to save me remaking the same
changes the next time libxml gets updated ;-) )

The main change I need to make is to store the start and end character
positions in the input XML stream of the nodes (including attributes) in the
DOM tree.
I know the SAX interface currently gives access to the current line / column
position, but this isn't much use to me as I only see the input XML as a
constant stream and can only get the position relative to the start of the
stream as opposed to the start of the line.

So I'd have to add a new counter to the _xmlParserInput structure to count
the character position, updating it in the same places the line / col
counters are updated.
I'd also need to modify the _xmlNode structure to add variables to store the
char positions once the node is created.
Finally, I'd have to alter the parser code so that it notes the relative
start and end positions and stores them in the xmlNode when it builds up the

I'm only using a read-only DOM, so I don't need to especially worry about
what happens if the DOM mutates. As there are going to be functions to get /
set the character positions in the nodes anyway, it wouldn't matter much as
the application mutating the code could keep track of them if it needed.

As I'm also going to be putting in libxsl and libgdome, I'd need to make
sure that my changes don't break anything outside of libxml. (As far as I'm
aware at the moment, the bits of my app that require access through libgdome
won't require access to these character positions, so I won't have to modify
this at all to make it fit.)

I know these changes fall outside of the APIs for SAX and DOM, but they are
small additions that don't directly affect anything else, and I can always
put #defines or a flag around the changes if required.

If you think these changes might be useful to keep, then I'd be happy to
submit them back for inclusion in libxml, otherwise can I have confirmation
that all I need to do is to include the credits, source (?), license and a
notice marking the changes to libxml with my application when it ships?

Richard Jinks

Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

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