Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

078274121, info0a ip, should prodicers of software_based services be held liable or not liable for economic injuries, should producers of soft ware based services such as ATMs be held liable for economic injuries suffered when their systems fail?, nisc wwwxxx, wwwxxx0cm, should producers of software-based services, such as atms, be held liable for economic injuries suffered when their systems fail?, wwwxxx0cm, www.webdp.net, Event 9 IIS log failed to write entry

Links

XODOX
Impressum

#1: XML::Simple does not pick up multiple entries into array

Posted on 2008-04-10 22:04:53 by jck000

I'm parsing data and one of there are multiple EMBEDDED_FILE tags.
I've set it to put these into an array as well as a hash. However,
only one entry appears

$ref = XMLin($xml_src,
ForceArray => [ 'EMBEDDED_FILE' ],
SuppressEmpty => '');


This is the result. I can view the source and there are multiple
EMBEDDED_FILE tags. So, <EMBEDDED_FILE _type='HTML'>
<DOCUMENT>
<![CDATA[<!DOCTYPEML....>
</DOCUMENT>
</EMBEDDED_FILE>
<EMBEDDED_FILE _type='PDF' EncodingType='Base64'>
<DOCUMENT>
<![CDATA[JVBERi0xLj........>
</DOCUMENT>
</EMBEDDED_FILE>

This is the result:

'EMBEDDED_FILE' => [
{
'DOCUMENT' => '',
'_Type' => 'HTML'
}
],

When there is a single entry usually PDF, I can decode it properly.
Is there an option to force it to correctly interpret the two entries?

Thanks
Jack

Report this message

#2: Re: XML::Simple does not pick up multiple entries into array

Posted on 2008-04-11 02:00:43 by Jim Gibson

In article
<98e232e6-a7d8-4e13-b456-9fc0052b2ba0@u12g2000prd.googlegroups.com>,
<"jck000@gmail.com"> wrote:

> I'm parsing data and one of there are multiple EMBEDDED_FILE tags.
> I've set it to put these into an array as well as a hash. However,
> only one entry appears
>
> $ref = XMLin($xml_src,
> ForceArray => [ 'EMBEDDED_FILE' ],
> SuppressEmpty => '');
>
>
> This is the result. I can view the source and there are multiple
> EMBEDDED_FILE tags. So, <EMBEDDED_FILE _type='HTML'>
> <DOCUMENT>
> <![CDATA[<!DOCTYPEML....>
> </DOCUMENT>
> </EMBEDDED_FILE>
> <EMBEDDED_FILE _type='PDF' EncodingType='Base64'>
> <DOCUMENT>
> <![CDATA[JVBERi0xLj........>
> </DOCUMENT>
> </EMBEDDED_FILE>
>
> This is the result:
>
> 'EMBEDDED_FILE' => [
> {
> 'DOCUMENT' => '',
> '_Type' => 'HTML'
> }
> ],
>
> When there is a single entry usually PDF, I can decode it properly.
> Is there an option to force it to correctly interpret the two entries?
>
> Thanks
> Jack

I am no XML expert, but well-formed XML documents should have a single,
all-enclosing tag at the beginning and end, and yours doesn't. You can
try adding them:

$xml_src = "<top>$xml_src</top>";

If you can't do that, you can try other XML parsers that might work
differently from XML::Simple, but you really should be giving
well-formed input to any XML Parser.

--
Jim Gibson

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
http://www.usenet.com

Report this message