Computing.Net > Forums > Programming > Perl/XML simple solution

Perl/XML simple solution

Reply to Message Icon

Original Message
Name: drsmartman
Date: January 28, 2004 at 12:34:44 Pacific
Subject: Perl/XML simple solution
OS: RH Linux
CPU/Ram: NA
Comment:

Hey everyone,

I did some research on Perl and XML. All I'm looking
to do is some reporting on my file system with a perl
script outputting to an XML report. The schema is
very basic.

<file>
<name>abc</name>
<md5>xyz</md5>
</file>

It would be simple enough to simply "print" out the
XML, but I want to start using best practices now. So,
I did some googling, but had a case of information
overkill. many tools to use so it seems, but what are
your thoughts? Ranging from basic implementations
(above) to advanced? XML:Handler:XMLWriter looks
very basic....good or bad thing? Anyway, just wanted
to know what everyone here uses.

Thanks as always...


Report Offensive Message For Removal


Response Number 1
Name: anonproxy
Date: January 28, 2004 at 17:58:21 Pacific
Reply: (edit)

You probably understand that XML is the current standard of overhead and complexity. How complicated is the report? Do you plan on doing any transformations on the XML file? If you have bigger plans or just want to learn, that is fine.

Look at XML::Generator.

"It would be simple enough to simply "print" out the XML, but I want to start using best practices now."

Guess what the module code does. The XML::Generator module is really just a wrapper for print. That is probably all you want.

You found this FAQ I assume.



Report Offensive Follow Up For Removal

Response Number 2
Name: drsmartman
Date: February 2, 2004 at 17:34:46 Pacific
Reply: (edit)

Hey Anon,

I actually did go with XML::Writer....my needs were
very simple. However, I hadn't seen that link which
was very helpful as well. Thanks for the insight!

Oh, one wierd formatting option was that XML::Writer
allows you to separate elements with NL, but it puts
it before the the last close bracket '>'. I thought that
was wierd...

<start
>
data
</start
>

Wouldn't this look better?

<start>
data
</start>

Anyway, thanks for your input.


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Perl/XML simple solution

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes Today.
Discuss in The Lounge