Alex Rosen wrote: > Has anyone thought about using XNI Augmentations to support round-tripping?
yes and nice to hear that somebody else thinks that it is useful :-) i has similar needs to yours, see: http://marc.theaimsgroup.com/?l=axis-dev&m=100370931104132&w=2 and the approach i used was to allow as an additional feature to report exact location of events (such as start tag). that coupled with retaining original XML input allowed to do in-place edition of XML events. > For example I'd like to be able to parse an XML file, modify a single > attribute value, and then output an XML file that was otherwise identical to > the one I read in. Currently Xerces doesn't support this - e.g. it can't > tell the difference between: > > <a b="c"/> > > and: > > <a b = 'c' /> that is tricky as you want to read information (white space characters between attributes and attribute quotation character) that is not part of XML infoset. as such most of XML experts will point out that this information is insignificant and *shoul not* be exposed by XML parser. however i think it is fine if it is an additional feature ... > I'd like to use XNI Augmentations to (optionally) pass the missing info to > the application. As a test, I modified Xerces 2.0.2 to handle this example > case. It records the whitespace after each element name and each attribute, > the whitespace before and after the equals sign of each attribute, and the > type of quote used for each attribute value. Then I modified the xni.Writer > example to use this info when outputting the XML, and it seems to work fine. > It seems like it would be straightforward to keep going with this, using > Augmentations to add back all of the info that gets lost, so that you can > output exactly the same document as you read in. > > This seems pretty useful. Does this seem like a good idea? Has anyone else > done this kind of thing already? If this were implemented as an optional > parser feature, would there be any interest in adding this as a standard > Xerces feature? i personally think that it would be very useful (and interesting use of augmentation). could you post a cvs diff patch? > (Assuming that there was a negligible performance impact > when it was turned off.) did you run any tests to estimate what is impact on the performance? i think as it would be controlled by boolean feature flag the impact should be minimal. thanks, alek --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
