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
Re: XMP Parsing Question
by Christopher Pryce other posts by this author
Sep 22 2005 2:16PM messages near this date
view in the new Beta List Site
Re: XMP Parsing Question | Re: XMP Parsing Question
& XSLT On Sep 22, 2005, at 3:24 PM, Michael Nachbaur wrote:

>  my $parser = new XML::LibXML();
>  my $doc = $parser->parse_string($xmp);
>  # or:
>  # my $doc = $parser->parse_file($xmp_filename);
>  my $rootNode = $doc->documentElement();
>  my $image = $rootNode->findvalue('//xapgimg:image');
> 
>  Or if you want to be more specific, you can use the following for the  
>  last line:
>  my $image =  
>  $rootNode->findvalue('/x:xmpmeta/rdf:rdf//xap:thumbnails//xapgimg: 
>  image');
> 
>  This code assumes that only one thumbnail exists.  However, it should  
>  suffice.
> 
>  The above code illustrates using XPath to query the contents of the  
>  XML file.  You may want to look into XPath more, because it is a very  
>  powerful way of interacting with XML documents, and would let you get  
>  more out of this document easily if you need to.

Mmmm.. yes thanks for the posting. I am sorry that I hadn't posted  
everything that I tried first. The code I came with, was similar to  
yours, and it produces an error :

XPath error Undefined namespace prefix in  
/x:xmpmeta/rdf:rdf//xap:thumbnails//xapgimg:image
xmlXPathCompiledEval: evaluation failed

I'm sorry I wasn't clear.

_______________________________________________
Perl-XML mailing list
Perl-XML@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Christopher Pryce
Michael Nachbaur
Christopher Pryce
Bruce Miller
Michael Nachbaur

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