Recuperer un doc xml d'une collection Exist
Bonjour,
J'ai voudrais récupérer un fichier xml ou tout son contenu dans une collection gérée par Exist-Db.
Le fichier xml en question (du moins son début :? ):
Citation:
<TEI xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns="http://www.tei-c.org/ns/1.0" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" xmlns:dbp="http://lalala/ns/1.0" xml:id="cote-g226_1_f_093__r____"><teiHeader type="page"><fileDesc><titleStmt><title>Cote : g226_1_f_093__r____ | ID_folio : 2477 | ID_Transcription : 808 | ID_Image :
Ma fonction
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| function __construct() {
// création d'une instance EXIST
$db2 = new eXist (EXIST_PATH,EXIST_SERVER,EXIST_PORT);
$db2->setCredentials (EXIST_USER,EXIST_PASSWORD);
$db2->setParamIndent (false);
// Pour le debugage
//$db2->setDebug(DEBUG);
$this->db=$db2;
}
function getTranscriptionComplete($ref_bib_doc) {
/*$xquery ='declare namespace dbp="http://dossiers-flaubert.ish-lyon.cnrs.fr/ns/1.0";
let $doc2 := doc("g226_1_f_093__r____-ver3.xml")
return <xml>{$doc2}</xml>';*/ //marche dans Exist
/*$xquery ='declare namespace dbp="http://dossiers-flaubert.ish-lyon.cnrs.fr/ns/1.0";
let $doc2 := doc("g226_1_f_093__r____-ver3.xml")
return $doc2/*:TEI';*/ // marche dans Exist
$xquery ='declare namespace dbp="http://dossiers-flaubert.ish-lyon.cnrs.fr/ns/1.0";
let $doc2 := doc("g226_1_f_093__r____-ver3.xml")
return $doc2/*:TEI';
$result = $this->db->executeQuery($xquery);
return $result;
} |
Tout ces essais retourne le résultat attendu dans le module d'interrogation xquery de Exist-db; mais dans php, je ne parviens pas à obtenir un résultat cohérent: j'ai un entier qui s'incrémente a chaque F5 à la place 8O.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| $file_name='g226_1_f_093__r____-ver3.xml';
$xq = new xqueryBP();
$transc_tei = $xq->getTranscriptionComplete($file_name);
// echo '<pre>';
// print_r($transc_tei); // affiche 1 puis 2, .... :cry:
// echo '</pre>';
$xml=new DOMDocument();
//$xml->load($file_name);
$xml->loadXML('<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="'.PATH_APPLICATION.'/templates/xsl/PP_V3_fragment_v2/xsl/diplomatic.xsl"?>'.$transc_tei);
/*$xml->loadXML('<?xml version="1.0"?>'.$transc_tei);*/
$xsl=new DOMDocument();
$xsl->load(PATH_APPLICATION.'/templates/xsl/PP_V3_fragment_v2/xsl/diplomatic.xsl', LIBXML_NOCDATA);
$proc = new XSLTProcessor();
$proc->importStylesheet($xsl);
echo '<div id="transcription_tei">'.$proc->transformToXml($xml).'</div>';
unset($xq, $file_name, $transc_tei, $xml, $xsl, $proc); |
Je précise que j'accède a cette page (ci-dessus) par ré-écriture d'url.
Que si je copie dans le même répertoire que ma page mon fichier xml et que j'y accède par $xml->load($file_name); tout fonctionne! :) donc sans passer par ma fonction problématique.
mais si je tente d'y accéder dans Exist par ma fonction, je ne retourne rien ou un entier ?! :calim2:
Le message d'erreur retourné par exist_phpapi:
Citation:
---GOT---
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml
Content-Length: 189
Date: Fri, 13 Apr 2012 10:15:56 GMT
Connection: close
<?xml version="1.0" encoding="UTF-8"?><methodResponse xmlns:ex="http://ws.apache.org/xmlrpc/namespaces/extensions"><params><param><value><i4>1</i4></value></param></params></methodResponse>
---END---
HEADER: HTTP/1.1 200 OK
HEADER: Server: Apache-Coyote/1.1
HEADER: Content-Type: text/xml
HEADER: Content-Length: 189
HEADER: Date: Fri, 13 Apr 2012 10:15:56 GMT
HEADER: Connection: close
---EVALING---[22 chars]---
new xmlrpcval(1, 'i4');
---END---