Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: PERL XML

by Joost (Canon)
on Aug 09, 2005 at 23:11 UTC ( [id://482464]=note: print w/replies, xml ) Need Help??


in reply to Perl XML

Erm... it's not at all clear what you want, but to me, it seems you might want to take a look at XML::Simple.

ps: if you don't want to piss off Perl zealots, spell it Perl (for the language) or perl (for the interpreter).

Replies are listed 'Best First'.
Re^2: Perl XML
by ramya2005 (Scribe) on Aug 09, 2005 at 23:22 UTC
    I can't use XML::Simple because it is not preserving attributes and elements.
    Also for my application, I have to preserve the order and structure of the XML that I am creating.
    Regarding my requirement, I should be able to parse the XML file going step by step from top to bottom.
    While parsing I should be able to edit some of the tags and so on. When I finish I should be able to create an XML which is similar to the original one in structure.
      I tend to use XML::Twig for most of my perl/XML work, but most "full featured" XML parsers should be able to deal with your data provided it's presented as actual XML (your <img> tag is missing an ending slash, so your input is not valid).

      If you have valid XML input, XML::Parser is probably one of the most flexible solutions, but IMO most problems can be solved easier with either XML::Twig or even XML::Simple. (See also the ForceArray and ForceContent options of XML::Simple)

      update: ignore the parts I striked - I was replying to 2 different XML threads at the same time, and I got confused. Luckily, most of the advise is reasonably sound. :-)

        Thanks for your response. I would appreciate if you can provide me with a more specific example or code snippet using XMl::Twig

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2024-04-26 00:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found