C
Chris
Please set your reader to fixed width for readabilities sake...
I'm aware of the plethora of XML formatters (e.g. though with Xerces,
JDOM, DOM4J), but I have a few special wants.
- To be able to drop attributes down to the next line if there are more
than a certain number of them, or if they exceed a certain length.
- To be able to not only wrap text content but indent it at the current
indentation level.
- To be able to set wrap and indentation levels for CDATA sections.
For example:
<one two="asdfghjasdfhjk"
three="asdfhsajkdl"
four="asdfasdfhjkl"
five="asfahjkle"<six>content</six>
<seven>content</seven>
<eight>
This content is longer than eight characters and will ....
This content is longer than eight characters and will ....
This content is longer than eight characters and will ....
<eight>
<nine>
<![CDATA[
This is CDATA content that I would like to be formatted as well.
This is CDATA content that I would like to be formatted as well.
This is CDATA content that I would like to be formatted as well.
]]>
</nine>
<one>
I've googled for a couple of days and while there are a lot of
formatters out there none seem to be as powerful as I'd like. Ideally
there should be a formatter that allows you to set the position of
every token (element, attribute, attribute text, text, CDATA etc.) in a
nice configurable and extensible way. Maybe even different element
formatting depending on it's nested level.
We have to look at a *lot* of XML that is produced elsewhere and some
of it abuses XML design so much it makes my eyes bleed. We already
have a custom XML viewer/search tool (using DOM4J's Outputformatter to
display), but we still have a lot of xml that is terrible to look at.
So two questions: is there anything Java based that can do this? I'm
not expecting there to be so that leads me to the next question: how
would you go about implementing this? Custom Sax parser? Extend an
already existing formatter? Use a parser generator? Remember I'm
pretty much stuck with a java solution.
Ideas?
Thanks for your time,
~Chris
I'm aware of the plethora of XML formatters (e.g. though with Xerces,
JDOM, DOM4J), but I have a few special wants.
- To be able to drop attributes down to the next line if there are more
than a certain number of them, or if they exceed a certain length.
- To be able to not only wrap text content but indent it at the current
indentation level.
- To be able to set wrap and indentation levels for CDATA sections.
For example:
<one two="asdfghjasdfhjk"
three="asdfhsajkdl"
four="asdfasdfhjkl"
five="asfahjkle"<six>content</six>
<seven>content</seven>
<eight>
This content is longer than eight characters and will ....
This content is longer than eight characters and will ....
This content is longer than eight characters and will ....
<eight>
<nine>
<![CDATA[
This is CDATA content that I would like to be formatted as well.
This is CDATA content that I would like to be formatted as well.
This is CDATA content that I would like to be formatted as well.
]]>
</nine>
<one>
I've googled for a couple of days and while there are a lot of
formatters out there none seem to be as powerful as I'd like. Ideally
there should be a formatter that allows you to set the position of
every token (element, attribute, attribute text, text, CDATA etc.) in a
nice configurable and extensible way. Maybe even different element
formatting depending on it's nested level.
We have to look at a *lot* of XML that is produced elsewhere and some
of it abuses XML design so much it makes my eyes bleed. We already
have a custom XML viewer/search tool (using DOM4J's Outputformatter to
display), but we still have a lot of xml that is terrible to look at.
So two questions: is there anything Java based that can do this? I'm
not expecting there to be so that leads me to the next question: how
would you go about implementing this? Custom Sax parser? Extend an
already existing formatter? Use a parser generator? Remember I'm
pretty much stuck with a java solution.
Ideas?
Thanks for your time,
~Chris