my question here is how can i get the child nodes from a RDF file using xpath.
here you can see these set of nodes used multiple times:
<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF xml:base="http://www.gutenberg.org/"
xmlns:pgterms="http://www.gutenberg.org/2009/pgterms/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:dcam="http://purl.org/dc/dcam/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:marcrel="http://id.loc.gov/vocabulary/relators/"
xmlns:dcterms="http://purl.org/dc/terms/"
>
<pgterms:ebook rdf:about="ebooks/45916">
<dcterms:hasFormat>
<pgterms:file rdf:about="http://www.gutenberg.org/files/45916/45916-h.zip">
<dcterms:format>
<rdf:Description rdf:nodeID="N8bcaca7a1c7d421bb84e17512209a18e">
<dcam:memberOf rdf:resource="http://purl.org/dc/terms/IMT"/>
<rdf:value rdf:datatype="http://purl.org/dc/terms/IMT">text/html; charset=iso-8859-1</rdf:value>
</rdf:Description>
</dcterms:format>
<dcterms:format>
<rdf:Description rdf:nodeID="Nf2b3fd0a0a8846708ffa66bef504ceb3">
<dcam:memberOf rdf:resource="http://purl.org/dc/terms/IMT"/>
<rdf:value rdf:datatype="http://purl.org/dc/terms/IMT">application/zip</rdf:value>
</rdf:Description>
</dcterms:format>
<dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2014-06-08T09:02:38</dcterms:modified>
<dcterms:isFormatOf rdf:resource="ebooks/45916"/>
<dcterms:extent rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">651365</dcterms:extent>
</pgterms:file>
</dcterms:hasFormat>
<dcterms:hasFormat>
<pgterms:file rdf:about="http://www.gutenberg.org/ebooks/45916.kindle.noimages">
<dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2014-06-08T22:26:22.432333</dcterms:modified>
<dcterms:extent rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">1123982</dcterms:extent>
<dcterms:isFormatOf rdf:resource="ebooks/45916"/>
<dcterms:format>
<rdf:Description rdf:nodeID="Nd99359d8b38946be9050e90d512f195b">
<dcam:memberOf rdf:resource="http://purl.org/dc/terms/IMT"/>
<rdf:value rdf:datatype="http://purl.org/dc/terms/IMT">application/x-mobipocket-ebook</rdf:value>
</rdf:Description>
</dcterms:format>
</pgterms:file>
</dcterms:hasFormat>
<dcterms:creator>
<pgterms:agent rdf:about="2009/agents/1609">
<pgterms:webpage rdf:resource="http://en.wikipedia.org/wiki/August_Strindberg"/>
<pgterms:deathdate rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">1912</pgterms:deathdate>
<pgterms:birthdate rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">1849</pgterms:birthdate>
<pgterms:alias>Strindberg, Johan August</pgterms:alias>
<pgterms:name>Strindberg, August</pgterms:name>
</pgterms:agent>
</dcterms:creator>
<dcterms:publisher>Project Gutenberg</dcterms:publisher>
<dcterms:hasFormat>
<pgterms:file rdf:about="http://www.gutenberg.org/ebooks/45916.txt.utf-8">
<dcterms:isFormatOf rdf:resource="ebooks/45916"/>
<dcterms:format>
<rdf:Description rdf:nodeID="Nbbecde9fae7f49d3a61c4636a3f23b3f">
<rdf:value rdf:datatype="http://purl.org/dc/terms/IMT">text/plain</rdf:value>
<dcam:memberOf rdf:resource="http://purl.org/dc/terms/IMT"/>
</rdf:Description>
</dcterms:format>
<dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2014-06-08T22:26:13.886845</dcterms:modified>
<dcterms:extent rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">644491</dcterms:extent>
</pgterms:file>
</dcterms:hasFormat>
<dcterms:hasFormat>
<pgterms:file rdf:about="http://www.gutenberg.org/ebooks/45916.epub.images">
<dcterms:extent rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">410485</dcterms:extent>
<dcterms:isFormatOf rdf:resource="ebooks/45916"/>
<dcterms:format>
<rdf:Description rdf:nodeID="Nf57694627093478cb2f1b79fe569b0bb">
<rdf:value rdf:datatype="http://purl.org/dc/terms/IMT">application/epub+zip</rdf:value>
<dcam:memberOf rdf:resource="http://purl.org/dc/terms/IMT"/>
</rdf:Description>
</dcterms:format>
<dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2014-06-08T22:26:15.113789</dcterms:modified>
</pgterms:file>
</dcterms:hasFormat>
<dcterms:title>Inferno Legenden</dcterms:title>
<marcrel:trl>
<pgterms:agent rdf:about="2009/agents/26434">
<pgterms:birthdate rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">1873</pgterms:birthdate>
<pgterms:deathdate rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">1951</pgterms:deathdate>
<pgterms:name>Schering, Emil</pgterms:name>
</pgterms:agent>
</marcrel:trl>
<dcterms:hasFormat>
<pgterms:file rdf:about="http://www.gutenberg.org/files/45916/45916-8.zip">
<dcterms:format>
<rdf:Description rdf:nodeID="Nd11587d6f2c54ed588554457e438f745">
<dcam:memberOf rdf:resource="http://purl.org/dc/terms/IMT"/>
<rdf:value rdf:datatype="http://purl.org/dc/terms/IMT">application/zip</rdf:value>
</rdf:Description>
</dcterms:format>
<dcterms:extent rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">252086</dcterms:extent>
<dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2014-06-08T09:02:36</dcterms:modified>
<dcterms:isFormatOf rdf:resource="ebooks/45916"/>
<dcterms:format>
<rdf:Description rdf:nodeID="Nde9a69d5a10a4eac8bc341fbd6b284e2">
<rdf:value rdf:datatype="http://purl.org/dc/terms/IMT">text/plain; charset=iso-8859-1</rdf:value>
<dcam:memberOf rdf:resource="http://purl.org/dc/terms/IMT"/>
</rdf:Description>
</dcterms:format>
</pgterms:file>
</dcterms:hasFormat>
<dcterms:hasFormat>
<pgterms:file rdf:about="http://www.gutenberg.org/ebooks/45916.epub.noimages">
<dcterms:isFormatOf rdf:resource="ebooks/45916"/>
<dcterms:format>
<rdf:Description rdf:nodeID="Nc8d0a845bc934efb9d272657cb764850">
<dcam:memberOf rdf:resource="http://purl.org/dc/terms/IMT"/>
<rdf:value rdf:datatype="http://purl.org/dc/terms/IMT">application/epub+zip</rdf:value>
</rdf:Description>
</dcterms:format>
<dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2014-06-08T22:26:15.623745</dcterms:modified>
<dcterms:extent rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">272322</dcterms:extent>
</pgterms:file>
</dcterms:hasFormat>
<pgterms:downloads rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">0</pgterms:downloads>
<dcterms:hasFormat>
<pgterms:file rdf:about="http://www.gutenberg.org/files/45916/45916-8.txt">
<dcterms:extent rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">637384</dcterms:extent>
<dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2014-06-08T09:02:34</dcterms:modified>
<dcterms:isFormatOf rdf:resource="ebooks/45916"/>
<dcterms:format>
<rdf:Description rdf:nodeID="N7aa2a69d1003438ba4003eb259bd35ac">
<dcam:memberOf rdf:resource="http://purl.org/dc/terms/IMT"/>
<rdf:value rdf:datatype="http://purl.org/dc/terms/IMT">text/plain; charset=iso-8859-1</rdf:value>
</rdf:Description>
</dcterms:format>
</pgterms:file>
</dcterms:hasFormat>
<dcterms:hasFormat>
<pgterms:file rdf:about="http://www.gutenberg.org/files/45916/45916-h/45916-h.htm">
<dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2014-06-08T09:02:36</dcterms:modified>
<dcterms:isFormatOf rdf:resource="ebooks/45916"/>
<dcterms:extent rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">666476</dcterms:extent>
<dcterms:format>
<rdf:Description rdf:nodeID="N8eac5ace146f40b692be7124998929f6">
<dcam:memberOf rdf:resource="http://purl.org/dc/terms/IMT"/>
<rdf:value rdf:datatype="http://purl.org/dc/terms/IMT">text/html; charset=iso-8859-1</rdf:value>
</rdf:Description>
</dcterms:format>
</pgterms:file>
</dcterms:hasFormat>
<dcterms:hasFormat>
<pgterms:file rdf:about="http://www.gutenberg.org/ebooks/45916.kindle.images">
<dcterms:extent rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">1362365</dcterms:extent>
<dcterms:isFormatOf rdf:resource="ebooks/45916"/>
<dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2014-06-08T22:26:19.053536</dcterms:modified>
<dcterms:format>
<rdf:Description rdf:nodeID="N21c75eb3a0324793b23f0f2da05987d8">
<dcam:memberOf rdf:resource="http://purl.org/dc/terms/IMT"/>
<rdf:value rdf:datatype="http://purl.org/dc/terms/IMT">application/x-mobipocket-ebook</rdf:value>
</rdf:Description>
</dcterms:format>
</pgterms:file>
</dcterms:hasFormat>
<dcterms:rights>Public domain in the USA.</dcterms:rights>
<dcterms:hasFormat>
<pgterms:file rdf:about="http://www.gutenberg.org/ebooks/45916.qioo">
<dcterms:isFormatOf rdf:resource="ebooks/45916"/>
<dcterms:extent rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">314173</dcterms:extent>
<dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2014-06-08T22:26:14.223837</dcterms:modified>
<dcterms:format>
<rdf:Description rdf:nodeID="N2042f4d0e515438f86a835a107f3069f">
<dcam:memberOf rdf:resource="http://purl.org/dc/terms/IMT"/>
<rdf:value rdf:datatype="http://purl.org/dc/terms/IMT">application/x-qioo-ebook</rdf:value>
</rdf:Description>
</dcterms:format>
</pgterms:file>
</dcterms:hasFormat>
<dcterms:type>
<rdf:Description rdf:nodeID="N23936464382a478dbd492861f3ddcec0">
<rdf:value>Text</rdf:value>
<dcam:memberOf rdf:resource="http://purl.org/dc/terms/DCMIType"/>
</rdf:Description>
</dcterms:type>
<dcterms:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2014-06-08</dcterms:issued>
<dcterms:language>
<rdf:Description rdf:nodeID="Ne8641b6eba6e463c8dd983956a243179">
<rdf:value rdf:datatype="http://purl.org/dc/terms/RFC4646">de</rdf:value>
</rdf:Description>
</dcterms:language>
<dcterms:license rdf:resource="license"/>
</pgterms:ebook>
<cc:Work rdf:about="">
<cc:license rdf:resource="http://www.gnu.org/licenses/gpl.html"/>
</cc:Work>
<rdf:Description rdf:about="http://en.wikipedia.org/wiki/August_Strindberg">
<dcterms:description>Wikipedia</dcterms:description>
</rdf:Description>
</rdf:RDF>
what is want is to get the value <pgterms:name>Strindberg, August</pgterms:name>
from all these nodes.
and the main problem is that: <dcterms:creator>
always changes in all the RDF files. so i want to deal with it dynamically.
my code is something like this:
$dom = simplexml_load_file('my.rdf');
$title = $dom->xpath('//rdf:RDF/pgterms:ebook/dcterms:creator/pgterms:agent/pgterms:name');
echo $title;
any help please.
Thank You.