maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Digulla <>
Subject Re: POM rewriting with DecentXML
Date Tue, 05 Aug 2008 19:24:18 GMT
Stuart McCulloch schrieb:

>> Why not fix StAX?
>> Because StAX is not meant to do this. I need to keep the original XML
>> source somewhere to be able to recreate anything you might have done. That
>> includes entities (and how you entered them originally) and all kind of
>> weird stuff that every XML parser out there throws away.
> this isn't necessarily true - you could take the XML source and map
> it into a model that's used by the application - later on you'd take the
> modified model and compare (diff) it against the original model and
> use this to rewrite sections of the XML source while keeping the rest
> undisturbed... (using indexing to improve performance/tracking)

Right. And I could have China paint the moon in red so that I can write
"Coca Cola" on 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.
>>> If we've read in the model using the tools that we currently use which
>>> knows about everything about the whitespace, and then manipulate the
>>> model in memory how exactly would we integrate your writer?
>> Same issue as above. My suggestion is to keep the model reader as it is. If
>> you write a plugin which wants to manipulate any kind of XML, you add a
>> dependency to DecentXML, read the XML, manipulate it and write it out.
> which kind of sucks if you want to pass the model around collecting
> changes from different components - then everyone would have to
> use the DecentXML document, otherwise you'd lose the formatting.

That's one way. Another way would be to generate XML after each step and
pass that on.

Secondly, in the patch I've sent you, I directly modify the StringBuffer
after I've located the bit that should change. So you could hand each
component this buffer.

It would mean some overhead for parsing the document every time but the
documents are small and the parser is very fast.

Thirdly, all components should preserve the formatting and DecentXML is
the only way to do that, so each component has to use it anyway.

>> My solution returns a complete XML document to begin with, so the setup is
>> just a single line of code and then you can start working on the document.
> your solution is interesting, but I think you'd get more support if you
> stopped dissing everything else - there's been a lot of innovation in
> this area already and I expect there's still more to come.
> at least have a serious look at StAX and see if it could be improved

Make StAX pass the test I've sent to the list and I'll have a look. From
what I know, it can't pass this test because it throws that information
away before anyone can see it.


Aaron "Optimizer" Digulla a.k.a. Philmann Dark
"It's not the universe that's limited, it's our imagination.
Follow me and I'll show you something beyond the limits."

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message