ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-xml
perl-xml
Need Suggestion for Writing and Appending to an XML Doc
by Amanda Hubbard other posts by this author
May 23 2006 3:52PM messages near this date
view in the new Beta List Site
RE: Can I use a variable in an xpath? | Re: Need Suggestion for Writing and Appending to an XML Doc
& XSLT Hi, 
 
I have been reading about various XML parsing modules in Perl (XML::Simple, XML::XPath, XML:
:Twig, XML::LibXML, XML::SAX, etc).  I was hoping to get some advice on which module can bes
t help me with a particular problem.  I need to:
 
--Parse an existing XML document and extract the relevant elements (I am using XML::SAX for 
this)
--Write the relevant data to a new XML file - need a module for this
--Add elements to the new file over time - need a module for this
 
My XML file will be extremely simple - only two elements deep.  I would like to be able to s
imply append an element with attributes to the root element rather than querying for and app
ending to a particular node.  Here is a sample XML document:
 
<?xml version="1.0" encoding="UTF-8"?>   
<testcaselist> 
         <testcase searchPath="chassis/fileStorageLocation/locationType" searchValue="flash"
/>   
         <testcase searchPath="chassis/fileStorageLocation/size" searchValue="7679"/>   
         <testcase searchPath="chassis/fileStorageLocation/available" searchValue="2497"/>   
         <testcase searchPath="chassis/fileStorageLocation/imageFile/filename" searchValue="
c3620-i-mz.120-28d.bin"/>   
         <testcase searchPath="chassis/fileStorageLocation/imageFile/filesize" searchValue="
11817"/> 
</testcaselist>   
 
Any suggestions would be greatly appreciated.
 
Regards,
Amanda
Thread:
Amanda Hubbard
Tod Harter
johns
Dominic Mitchell

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved