Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: XML::Parser error

by runrig (Abbot)
on Sep 11, 2013 at 18:23 UTC ( #1053546=note: print w/ replies, xml ) Need Help??


in reply to XML::Parser error

The char handler does not necessarily return all of the contiguous char data in one go. From the docs:

Char (Expat, String) This event is generated when non-markup is recognized. The non-markup sequence of characters is in String. A single non-markup sequence of characters may generate multiple calls to this handler. Whatever the encoding of the string in the original document, this is given to the handler in UTF-8.
So you will have to concatenate the char data yourself. That said, I would likely use some higher level library rather than use XML::Parser directly, then you very likely wouldn't have to do the concatenating yourself.


Comment on Re: XML::Parser error
Download Code
Re^2: XML::Parser error
by mwinterer (Initiate) on Sep 11, 2013 at 21:50 UTC

    Thanks. That helped how to fix for now. Any suggestions on what higher level module would be good to use? Basically I am parsing XML files delivered every 15 minutes to my server to parse and load into the DB. I looked around when developing and didn't really see anything that would fit that. Maybe I didn't look hard enough though.

      I'm partial to XML::Rules. Others like XML::Twig. Either is good if the docs are large and you should be processing the doc as you read it. XML::LibXML can be appropriate also (XPath support is great if you need that sort of thing).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1053546]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2015-07-07 06:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (87 votes), past polls