Title: Message
Correct, namespace prefix was too much.
Thanks a lot.
----- Original Message -----
Sent: Wednesday, August 10, 2005 10:23 PM
Subject: RE: Using XQuery with XMLbeans

Your query is looking for an Element LO_ID_EPJ in namespace 'http://www.w3.org/2001/XMLSchema'. But in your instance the element containing 751 is not in that namespace, unless I’m missing something. So either bind the default namespace in the instance, or get rid of the namespace in your query.

 

Hope this helps, Yana

 


From: Celinio Fernandes [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 10, 2005 10:58 AM
To: [email protected]
Subject: Using XQuery with XMLbeans

 

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