[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl-xml
Subject:    Re: [XML::Twig] - Mismatched tag errors.
From:       Michel Rodriguez <mirod () xmltwig ! com>
Date:       2005-03-23 8:37:11
Message-ID: 42412AB7.6050907 () xmltwig ! com
[Download RAW message or body]

Mohammed Khatib wrote:

> I'm working on up-conversions from ASCII to (fairly complex) XML. I'm using
> Twig to process the XML once it's in a semi structured, well-formed state,
> to further insert new elements. In doing so, I'm getting "mismatched tag"
> errors from XML::Parser. This is OK, I expect these errors, but what I need
> to do is track where the error is so I can modify either the converter or
> the regexes in the converter configuration file. Any ideas on a way of
> retrieving the mismatched tag position??

You can pass the error_context option to XML::Twig->new to get the 
line(s) where the problem happens. See the docs for XML::Parser. The 
XML::Twig FAQ also has an entry on how to store this information:
http://www.xmltwig.com/xmltwig/XML-Twig-FAQ.html#Q17

You could also adapt http://perlmonks.org/index.pl?node_id=427722 with 
additional ways to fix the XML, maybe using XML::Twig instead of 
XML::Parser to be able to fix more types of errors.


-- 
Michel Rodriguez
Perl &amp; XML
xmltwig.com
_______________________________________________
Perl-XML mailing list
Perl-XML@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic