2008/8/5 Aaron Digulla <[EMAIL PROTECTED]> > Quoting Stuart McCulloch <[EMAIL PROTECTED]>: > > 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. >>> >> >> personally speaking, I don't actually mind if </ foo > is changed to >> </foo> >> for me preserving comments and the general layout, such as indentation >> is much more important than attribute spacing. >> > > Same here, but how about newlines in the project element to keep the > namespace declarations in view? >
honestly, that's not usually a problem for me - my IDE wraps the line > as Milos mentioned: how do you decide where to slot new elements, like >> dependencies if there weren't any dependencies in the original pom - are >> they always appended? do they inherit the surrounding indentation? >> > > DecentXML doesn't try to be smarter than you. It just gives you all the > tools to get what you want. It doesn't throw information away which was in > the original file, so you can examine it and make an educated guess what > would probably look right. > ah, ok - so it's up to me as a user of DecentXML to detect and apply the correct indentation for the inserted element (based on level, etc.) Even if it's not 100% correct, it will at least preserve all comments and > processing instructions and other special XML data because the guy who wrote > that XML probably had a reason to write it the way it is. > > For example, the first version of the m2eclipse POM editor would remove all > comments after "Add dependency". That's not cool. Those comments contained > references to web pages and explanations why some stuff was set up "oddly". > yeah, I hate it when an editor zaps all the intermediate comments and whitespace - that's why in the past I've used a modified version of the plexus XML parser that preserves comments and maintains consistent indentation levels: (although it definitely doesn't preserve 100%) http://www.ops4j.org/projects/pax/construct/maven-pax-plugin/xref/org/ops4j/pax/construct/util/RoundTripXml.html bit hacky, but was good enough for my purposes at the time :) > 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. >>> >> >> usually I'm more concerned about getting it working than the *look*, in >> fact often what I need is an XML formatting tool that I can apply to our >> poms to make them consistent (ie. like formatting code in an IDE) >> > > In that case, DecentXML is for you. With it, you can pick all the > whitespace in the POM file (and *only* that) and replace it with something > that is more correct. It will leave comments, etc. alone. > > Or you can also reorder the elements without messing with the indentation. > > I've been thinking about such a cleanup tool myself. All the POM creators > create POMs which look different, which have a different indentation, > different order of elements, etc. With DecentXML, all that could be fixed > without messing with parts of the XML which we might want to preserve. > yep, I think such a configurable cleanup/formatting tool would be very useful. Regards, > > -- > 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." > http://www.pdark.de/ > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- Cheers, Stuart