4 Replies Latest reply: Oct 24, 2013 10:29 PM by RokoA RSS

    0 result returned for query "collection ('exampledata.dbxml')/article


      Iam  using  BDB XML I create a container called Exampledata.dbxml using java API. using a separate program I put my sigmodRecord.xml  file into the container. I then wrote another program (see the program below) to test my Query

      where Query =  "collection ('Exampledata.dbxml')/article"  but dont know why i always have

                                                        0 result returned for query "collection ('exampledata.dbxml')/article  if  the program is run. Pls can anybody help




      package xmldbdemo;


      import com.sleepycat.db.Environment;

      import com.sleepycat.dbxml.*;

      import dbxml.gettingStarted.myDbEnv;

      import java.io.File;

      public class simpleQuery3 {

          public static void main (String[] args) throws Throwable  {


           String theContainer = "Exampledata.dbxml";


            File path2DbEnv = new File("c:/myJavaProgs/examplesEnvironment");

           if (path2DbEnv == null || ! path2DbEnv.isDirectory()) {

                 System.out.println("Bad file name");

            System.exit( -1 );




        myDbEnv env = null;

        XmlContainer openedContainer = null;


           env = new myDbEnv(path2DbEnv);


                  Environment enviro = env.getEnvironment();



           // create xmlmanager

             XmlManagerConfig myManagerConf = new  XmlManagerConfig();



             XmlManager myManager = new XmlManager  (enviro, myManagerConf);



         // XmlManager myManager = new XmlManager();

          XmlContainerConfig myContainerConf = new  XmlContainerConfig();



          XmlContainer myContainer = myManager.openContainer( theContainer, myContainerConf);

          XmlQueryContext myContext =  myManager.createQueryContext();



          String myQuery = "collection('Exampledata.dbxml')/article";

          XmlResults myResults = myManager.query(myQuery, myContext, null);

          XmlValue myValue = myResults.next();

          while (myValue != null){

           XmlDocument myDocument = myValue.asDocument();

           String name  = myDocument.getName();