in reply to Forcing XML to validate

Anything that isn't well-formed isn't XML, and won't be parsed by any compliant XML parser. This is good. This is by design. Get the thing that is generating something-that-kinda-looks-like-XML to spit out the right stuff, and all will be better.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

Replies are listed 'Best First'.
Re^2: Forcing XML to validate
by Anonymous Monk on Jul 02, 2004 at 11:10 UTC
    As I said, I have no control over what is generating the data. I would love to just pass this by, and not deal with the people that do, but unfortunatly that is not an option.

    I am not trying to force XML::Simple to parse invalid XML. I am trying to throw away the invalid parts, so that there is only valid XML left.

    Then everything will be good.

    I was just wondering if there was already something out there to do this.
      I'm not talking about control. I'm talking about cooperation. If someone is spitting out stuff that they think is XML, or advertised as XML, then it should be XML. Inform the folks generating the data that they need to do some work. That way, you're not trying to error-correct for them, which each consumer will have to do separately. Down That Path Lie Monsters and Madness, and is the very reason that nothing is XML until it is XML, unlike the HTML tag soup we had before it.

      -- Randal L. Schwartz, Perl hacker
      Be sure to read my standard disclaimer if this is a reply.

Re^2: Forcing XML to validate
by Anonymous Monk on Jul 03, 2004 at 04:05 UTC
    Jon Udell likes to use HTML Tidy to clean up XHTML/XML:

    http://www.infoworld.com/article/04/05/28/22OPstrategic_1.html

    http://tidy.sourceforge.net/