On Tue, Aug 5, 2008 at 9:28 AM, Aaron Digulla <[EMAIL PROTECTED]> wrote:
> StAX can't preserve whitespace between attributes, between "<" and the > element name, whitespace > after the last attribute and the ">", between "</" and the end element name. > Same goes for all pull parsers. I must admit that I can life comfortably if these are changed in my POM ... > Not sure about CDATA but I guess StAX can't preserve that, either. Of course it does. There is an event type CDATA, as opposed to SPACE or CHARACTERS. This event type is supposed for both reading and writing. > As for patching it: StAX is a standard API (JSR-173). How big are my chances > that the standard API is going to be extended to allow the features I need? No API forbids extending. In the case of a StAX parser, one could by default supply and accept the standard event types. However, in a particular mode, one could supply and accept additional events. In the case of white space around attributes, you could offer an extension of the Attribute interface that informs about whitespace to the left and to the right. But that would still miss the most important problem: Supplying this information is important. But in practice, the POM file is read and transformed into a model. And these completely syntactical informations will hardly enter the model. But if they don't, then they will also be missing when writing the POM file. At which point they are lost. > Just looking at an XML gives you a visual clue: these guys couldn't care > less how it *looks* as long as their tools can read it. That's exactly the purpose of XML, isn't it. :-) > As I said: My parser is probably not so useful as a general purpose > replacement for POM *reading* in general. It ought to be used in the Maven > artifact plugin and any other code which *writes* POM files. Unfortunately, these can hardly be separated. At least from a software architects point of view, I'd strongly argue against two completely different approaches for reading POM files. Jochen -- Look, that's why there's rules, understand? So that you think before you break 'em. -- (Terry Pratchett, Thief of Time) --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]