Title: Message
Hi again,
I am new to XQuery and I am trying to select a value in my XML file which looks a bit like this:

<?xml version="1.0" encoding="UTF-8"?>
<MPG-PVC xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="mpgpvc.xsd">
 <DATE_ENVOI>07/08/2005 09:07:01</DATE_ENVOI>
 <NB_EPJ>92</NB_EPJ>
 <EPJ>
  <IOS>
   <IO>
    <LO_ID_EPJ>751</LO_ID_EPJ>
    <LO_ID_INSCRIPTION>5454</LO_ID_INSCRIPTION>
    <LO_DA_CREATION>10/05/2005 10:07:14</LO_DA_CREATION>    
   </IO>
  <IOS>
 <EPJ>
</MPG-PVC>


How do you get the value of LO_ID_EPJ ?

I tried this: (inputXMLFile is my XML file of course)
 
 MPGPVCDocument mpgpvcdoc = MPGPVCDocument.Factory.parse(inputXMLFile); 
 String nsText = "declare namespace xq='http://www.w3.org/2001/XMLSchema';";
 String pathText = "$this/xq:MPG-PVC/xq:EPJ/xq:IOS/xq:IO/xq:LO_ID_EPJ"; 
 String queryText = nsText + pathText;
 XmlCursor itemCursor = mpgpvcdoc.newCursor().execQuery(queryText);
 System.out.println(itemCursor.xmlText());
 
 Result is :
 <xml-fragment/>

instead of 751

Something wrong with my use of the XML elements ?

Thanks in advance for your help.

 

 

Reply via email to