01-18-2005 03:54 PM
an empty closing tag. Ie supposedly this XML fragment
can be written with the shorthand:
However XML::Simple gags with a "mismatched tag" (details appended).
Thanks in advance!
---- cut here for demo ----
alps(ted) 743>cat dumpit.pl
# use module
# create object
$xml = new XML::Simple;
# read XML file
$data = $xml->XMLin("./$ARGV");
# print output
alps(ted) 746>dumpit.pl fkd.up.xml
mismatched tag at line 3, column 10, byte 56 at /opt/perl/lib/site_perl/5.6.1/PA
-RISC1.1-thread-multi/XML/Parser.pm line 168
Solved! Go to Solution.
01-18-2005 07:12 PM
If nested, XML elements must be strictly nested: each start tag must have a corresponding end tag, and elements cannot overlap.
XML's shorthand for an empty element (that is, one without contents), is ending the tag with a "/>".
01-18-2005 11:53 PM
I experience tremendous difficulties getting XML::Parser's XS stubs linked against the libexpat.sl
But see my thread
01-19-2005 11:13 AM
still open. Perhaps it was oddly worded.
So I'll rephrase the question.
Q: Is there any option/trick/magic potion which will enable XML::Simple to parse this XML document:
alps(ted) 747>cat ugly.xml
without dying with an "unmatched tag" error??
If not, can I use XML::DOM or XML::XPath to parse it? (Sample code appreciated).
To answer the other question, I'm using a
pre-built perl which apparently is distributed with HP-UX standard now. It's built by ActiveState and lives in /opt/perl/bi/perl.
alps(ted) 751>/opt/perl/bin/perl -v
This is perl, v5.6.1 built for PA-RISC1.1-
Copyright 1987-2001, Larry Wall
Binary build 627 provided by ActiveState Tool Corp. http://www.ActiveState.com
Built 21:42:53 Jun 20 2001
01-19-2005 09:01 PM
look like a definite:
"The XML standard is very clear on the issue of non-compliant documents. An error in parsing any single element (for example a missing end tag) must cause the whole document to be rejected. XML::Simple will die with an appropriate message if it encounters a parsing error."
01-20-2005 04:58 AM
I'd thought the spec for an empty element
was to leave off the opening element.
I didn't realize (until Stepen so nicely
spelled it out) that the really syntax
is to have a bizarro element, where the
"/" is moved to the end of the element
instead of the FRONT of it.