in reply to XML cleanup - regex or ?

It sounds as though you wish to verify that the XML conforms to a particular DTD specification.

XML::Rules looks like a good fit for your needs.

print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."

Replies are listed 'Best First'.
Re^2: XML cleanup - regex or ?
by ethrbunny (Monk) on Sep 21, 2010 at 15:06 UTC
    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.
      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