in reply to Re: XML cleanup - regex or ?
in thread XML cleanup - regex or ?

The issue is that the file won't parse at all until I remove the noisy entries. I comb through it line by line looking for errors before I pass it to XML::Twig.

Replies are listed 'Best First'.
Re^3: XML cleanup - regex or ?
by ikegami (Patriarch) on Sep 21, 2010 at 16:27 UTC
    It's not an XML error to be missing a meow attribute on a cat element. Did you misrepresent the problem, or are you actually getting the error when you validate the XML against a schema? There's no reason you can't do that after removing the offending elements.

      It's not an XML error to be missing a meow attribute on a cat element.

      That depends, if the attribute is mandatory it would be an error. Or do you mean something else by XML error? I'm thinking XSD here but I recall that with DTD's you can also specify attributes and make them "required".

      Cheers

      Harry

        XML doesn't have any mandatory attributes on any elements. It doesn't even define any elements. As I suggested, you are talking of validation errors and not parsing errors. Those are two unrelated concepts. You need not validate the XML the parse it and manipulate it.