Re: libxml2 application data

Robin Berjon <[email protected]>
Newsgroups gmane.comp.lang.perl.xml
Message-ID <[email protected]>
Hi Philippe,

On Dec 22, 2008, at 21:51 , philippe marguinaud wrote:
> Well, I am not very keen on stuffing data into attributes; moreover,  
> I could not store Perl data such as hashrefs, etc...

You don't need to limit yourself to attributes, this is XML you can  
store pretty much anything in it. But it's hard to give you a precise  
example because you're not telling us what exactly your requirements  
are.

If you're only dealing with elements, and your data structures don't  
contain anything too special, you could put your data in an attribute  
using Data::Dumper or Storable+Base64. Not exactly elegant, but  
effective. But again, it's hard to know if that can solve your problem  
since we know so little about it. We can keep tossing up ideas, but  
it'll all be wild guesses.

> Using an id is not very effective too; I would have no clue when  
> nodes get destroyed or created.
> I really need to associate data to my XML nodes. I would like to do  
> that in Perl, and I like XML::LibXML because I know it is fast and  
> gives access to XPath.

Can you please clarify this: do you need to associate data with  
arbitrary nodes, or just with elements?

-- 
Robin Berjon - http://berjon.com/
     Feel like hiring me? Go to http://robineko.com/





_______________________________________________
Perl-XML mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.