Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
Perl programming advice needed: handling XML files?
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- Perl programming advice needed: handling XML files...
Perl programming advice needed: handling XML files?
23-03-2008 10:23 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Sorry if this is a bit misplaced but stuff in "computers and hardware" doesn't get much attention.
Anyway...
I'm thinking of writing some web-based tools that process datafiles in an XML-ish format.
I've looked through the list of parsers in CPAN and I'm lost. I sort of want something like XML::Structured but without having to install the backend package.
I'm aware that the modules are unlikely to be on ccgi.plus.net but as long as its a pure module or an XSUB it can probably be installed non-root using PREFIX=~ or similar.
Anyway...
I'm thinking of writing some web-based tools that process datafiles in an XML-ish format.
I've looked through the list of parsers in CPAN and I'm lost. I sort of want something like XML::Structured but without having to install the backend package.
I'm aware that the modules are unlikely to be on ccgi.plus.net but as long as its a pure module or an XSUB it can probably be installed non-root using PREFIX=~ or similar.
Message 1 of 5
(1,007 Views)
4 REPLIES 4
Re: Perl programming advice needed: handling XML files?
24-03-2008 7:17 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
I usually use XML::Simple if I'm parsing XML in Perl - although it will depend on what you want to use it for.
Message 2 of 5
(272 Views)
Re: Perl programming advice needed: handling XML files?
26-03-2008 7:16 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Hey thanks for the tip.
Looks like a good choice, I only started looking at Structured because Indigoperl appeared to have it in their package repository. Didn't work though. Much to my suprise CPAN did though.
I'm torn ... I've got XML::Structured installed now, and I like the DTD system it uses, but its stricter than I'd like and I'm finding that "CAL3D" XML isn't "well formed" as it has two root tags, which XML::Structured objects to. I can work around that by adding tags around the whole document so it thinks the two roots are subtags.
I like the idea of XML::Simple but I don't like the idea of it throwing curve balls like how if a tag only appears once its a pointer to a hash but if it appears more than once it points to an array.
Looks like a good choice, I only started looking at Structured because Indigoperl appeared to have it in their package repository. Didn't work though. Much to my suprise CPAN did though.
I'm torn ... I've got XML::Structured installed now, and I like the DTD system it uses, but its stricter than I'd like and I'm finding that "CAL3D" XML isn't "well formed" as it has two root tags, which XML::Structured objects to. I can work around that by adding tags around the whole document so it thinks the two roots are subtags.
I like the idea of XML::Simple but I don't like the idea of it throwing curve balls like how if a tag only appears once its a pointer to a hash but if it appears more than once it points to an array.
Message 3 of 5
(272 Views)
Re: Perl programming advice needed: handling XML files?
26-03-2008 8:24 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Anything parsing XML should object to having two root tags IMO 
I can't say I've used XML::Simple that much recently - the last time I actually recall using it for definite was as a quick script when using Tomcat at Uni to update one of it's XML config files with new classes

I can't say I've used XML::Simple that much recently - the last time I actually recall using it for definite was as a quick script when using Tomcat at Uni to update one of it's XML config files with new classes

Message 4 of 5
(272 Views)
Re: Perl programming advice needed: handling XML files?
27-03-2008 8:20 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Yes, I take your point but the problem is I didn't come up with the format.
I guess this is what happens when a designer decides they can just use "XML" without actually being compliant.
Here's what the beginning of the file looks like:
<HEADER MAGIC="XMF" VERSION="910" />
<MESH NUMSUBMESH="1">
<SUBMESH NUMVERTICES="4" NUMFACES="2" MATERIAL="2" NUMLODSTEPS="0" NUMSPRINGS="0" NUMTEXCOORDS="2">
You're exactly right it wants to interpret that "header" as being the entire document.
I guess this is what happens when a designer decides they can just use "XML" without actually being compliant.
Here's what the beginning of the file looks like:
<HEADER MAGIC="XMF" VERSION="910" />
<MESH NUMSUBMESH="1">
<SUBMESH NUMVERTICES="4" NUMFACES="2" MATERIAL="2" NUMLODSTEPS="0" NUMSPRINGS="0" NUMTEXCOORDS="2">
You're exactly right it wants to interpret that "header" as being the entire document.
Message 5 of 5
(272 Views)
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- Perl programming advice needed: handling XML files...