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
|