Yes, "XML". I know this isn't XMLMonks.org, but gosh-darnit, I can't think of a group of experts I'd rather ask about this... and I can't think of a better language to code the solution in...
So -- anyone aware of existing applications/scripts to "fix" non-well-formed XML, where the only sin is overlapping elements? (I.e., otherwise well-formed)
For example, given the following XML snippet:
<A><B>...</A></B>
I'd like to switch the end-tags. In this example, A and B have precisely the same content, so this fix is straightforward and well-defined. (I'm ignoring DTD/schema enforcement here.)
Generalizing a bit, these can nest deeper and get less trivial:
<D><A><B><C>...</D></C></B></A>
...or (shudder)...
<D><A><B><C>...</D></A></C></B>
Note all begin-tags have a corresponding end-tag.
Also, I dream of one day finding an elegant way to handle non-trivial overlapping elements, call them "pseudo-elements". I know none of the current standards (XML parsers, XPath/XSL/...) could handle that, naturally, so it wouldn't be as useful with them. This is a much harder problem, and one I think XML-ers just consider "out-of-scope". But a guy can dream, can't he?
Anybody got advice here? Any modules that might help?
Thanks,
Jim W.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.