Berkeley DB XML, Python, TEI and DTDs

Dear BDB XML experts,
I am developing a web application (Django based) that uses python to manipulate and query TEI based documents within a BDB XML container.
The XML documents I am loading into the container contain a reference to an external DTD, which in turn references .ent files. The documents contain entity references that require resolving.
I can successfully put the XML documents into the container if I include the contents of the DTD within each file, but the process fails if I do not include the contents of the DTD in the XML document and instead try to reference the DTD via a reference. Xquery queries also do not seem to work properly if the DTD contents is included within each XML document.
I have found references in the forums to the following JAVA code which appears to allow BDB XML to reference an external DTD in the file system from within the database (I may be wrong on this though):
XmlManagerConfig config = new XmlManagerConfig();
config.setAllowExternalAccess(true);
XmlManager manager = new XmlManager(config);
My query is, can the same be achieved using python? The BDB documentation specifies this as a JAVA only operation and does not mention it as possible using python.
Thanks for reading
AL

Hi AL,
I have gathered quite a bit of experience with the Python bindings now, but I haven't been exactly in your situation. My experience has been that pretty much anything that you can do in Java you can do in Python but sometimes the syntax is a little different. From what I see Python does not have an XmlManagerConfig class but instead uses flags given to the XmlManager constructor. To do what you want to do I think you want (assuming from dbxml import *)
mgr = XmlManager(env, DBXML_ALLOW_EXTERNAL_ACCESS)

Similar Messages

  • Berkeley DB XML crashing on Vista (entry point not found in Xqilla.dll)

    Hello,
    I'm trying to run Berkely DB XML on Windows Vista but it countinues crashing and I cannot find the reason. I downloaded the Berkeley DB XML source project and compiled it in Visual Studio 2005, following the compiling instructions.
    If I compile everything in debug mode all the sample apps and the dbxml.exe work correctly. The problem arises when I compile everything in release mode and I try to run dbxml.exe or any aother sample app.
    Debugging the helloWorld application I get the following error, even before entering the main() function:
    Entry Point not Found - The procedure entry point ?allocateTempVarName@XQDynamicContextImpl@@UAEPB_WXZ could not be located in the dynamic link library xqilla21.dll
    Anyone ever encountered this problem ?
    Thanks
    Regards
    Matteo

    Matteo,
    Have you tried just compiling and running the xqilla.exe command-line program to see if that works?
    Regards,
    George

  • Berkeley DB XML crash with multiple readers (dbxml-2.5.16 and db-4.8.26)

    I am using Berkeley DB XML (v. 2.5.16 and the bundled underlying Berkeley DB 4.8.26, which I suppose is now fairly old) to manage an XML database which is read by a large number (order 100) of independent worker processes communicating via MPI. These processes only read from the database; a single master process performs writes.
    Everything works as expected with one or two worker processes. But with three or more, I am experiencing database panics with the error
    pthread lock failed: Invalid argument
    PANIC: Invalid argument
    From searching with Google I can see that issues arising from incorrectly setting up the environment to support concurrency are are fairly common. But I have not been able to find a match for this problem, and as far as I can make out from the documentation I am using the correct combination of flags; I use DB_REGISTER and DB_RECOVER to handle the fact that multiple processes join the environment independently. Each process uses on a single environment handle, and joins using
    DB_ENV* env;
    db_env_create(&env, 0);
    u_int32_t env_flags = DB_INIT_LOG | DB_INIT_MPOOL | DB_REGISTER | DB_RECOVER | DB_INIT_TXN | DB_CREATE;
    env->open(env, path to environment, env_flags, 0);
    Although the environment requests DB_INIT_TXN, I am not currently using transactions. There is an intention to implement this later, but my understanding was that concurrent reads would function correctly without the full transaction infrastructure.
    All workers seem to join the environment correctly, but then fail when an attempt is made to read from the database. They will all try to access the same XML document in the same container (because it gives them instructions about what work to perform). However, the worker processes open each container setting the read-only flag:
    DbXml::XmlContainerConfig models_config;
    models_config.setReadOnly(true);
    DbXml::XmlContainer models = this->mgr->openContainer(path to container, models_config);
    Following the database panic, the stack trace is
    [lcd-ds283:27730] [ 0] 2   libsystem_platform.dylib            0x00007fff8eed35aa _sigtramp + 26
    [lcd-ds283:27730] [ 1] 3   ???                                 0x0000000000000000 0x0 + 0
    [lcd-ds283:27730] [ 2] 4   libsystem_c.dylib                   0x00007fff87890bba abort + 125
    [lcd-ds283:27730] [ 3] 5   libc++abi.dylib                     0x00007fff83aff141 __cxa_bad_cast + 0
    [lcd-ds283:27730] [ 4] 6   libc++abi.dylib                     0x00007fff83b24aa4 _ZL25default_terminate_handlerv + 240
    [lcd-ds283:27730] [ 5] 7   libobjc.A.dylib                     0x00007fff89ac0322 _ZL15_objc_terminatev + 124
    [lcd-ds283:27730] [ 6] 8   libc++abi.dylib                     0x00007fff83b223e1 _ZSt11__terminatePFvvE + 8
    [lcd-ds283:27730] [ 7] 9   libc++abi.dylib                     0x00007fff83b21e6b _ZN10__cxxabiv1L22exception_cleanup_funcE19_Unwind_Reason_CodeP17_Unwind_Exception + 0
    [lcd-ds283:27730] [ 8] 10  libdbxml-2.5.dylib                  0x000000010f30e4de _ZN5DbXml18DictionaryDatabaseC2EP8__db_envPNS_11TransactionERKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEERKNS_15ContainerConfigEb + 1038
    [lcd-ds283:27730] [ 9] 11  libdbxml-2.5.dylib                  0x000000010f2f348c _ZN5DbXml9Container12openInternalEPNS_11TransactionERKNS_15ContainerConfigEb + 1068
    [lcd-ds283:27730] [10] 12  libdbxml-2.5.dylib                  0x000000010f2f2dec _ZN5DbXml9ContainerC2ERNS_7ManagerERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEPNS_11TransactionERKNS_15ContainerConfigEb + 492
    [lcd-ds283:27730] [11] 13  libdbxml-2.5.dylib                  0x000000010f32a0af _ZN5DbXml7Manager14ContainerStore13findContainerERS0_RKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEPNS_11TransactionERKNS_15ContainerConfigEb + 175
    [lcd-ds283:27730] [12] 14  libdbxml-2.5.dylib                  0x000000010f329f75 _ZN5DbXml7Manager13openContainerERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEPNS_11TransactionERKNS_15ContainerConfigEb + 101
    [lcd-ds283:27730] [13] 15  libdbxml-2.5.dylib                  0x000000010f34cd46 _ZN5DbXml10XmlManager13openContainerERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKNS_18XmlContainerConfigE + 102
    Can I ask if it's clear to anyone what I am doing wrong?

    Is it possible that the root problem to this is in the MPI code or usage?  Because if the writer process crashes while holding an active transaction or open database handles, it could leave the environment in an inconsistent state that would result in the readers throwing a PANIC error when they notice the inconsistent environment.
    Thanks for looking into this.
    It looks like there was a small typo in the code I quoted, and I think it was this which caused the segmentation fault or memory corruption. Although I checked a few times that the code snippet produced expected results before posting it, I must have been unlucky that it just happened not to cause a segfault on those attempts.
    This is a corrected version:
    #include <iostream>
    #include <vector>
    #include "dbxml/db.h"
    #include "dbxml/dbxml/DbXml.hpp"
    #include "boost/mpi.hpp"
    static std::string envname = std::string("test");
    static std::string pkgname = std::string("packages.dbxml");
    static std::string intname = std::string("integrations.dbxml");
    int main(int argc, char *argv[])
        boost::mpi::environment  mpi_env;
        boost::mpi::communicator mpi_world;
        if(mpi_world.rank() == 0)
            std::cerr << "-- Writer creating environment" << std::endl;
            DB_ENV *env;
            int dberr = ::db_env_create(&env, 0);
            std::cerr << "**   creation response = " << dberr << std::endl;
            if(dberr > 0) std::cerr << "**   " << ::db_strerror(dberr) << std::endl;
            std::cerr << "-- Writer opening environment" << std::endl;
            u_int32_t env_flags = DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_REGISTER | DB_RECOVER | DB_INIT_TXN | DB_CREATE;
            dberr = env->open(env, envname.c_str(), env_flags, 0);
            std::cerr << "**   opening response = " << dberr << std::endl;
            if(dberr > 0) std::cerr << "**   " << ::db_strerror(dberr) << std::endl;
            // set up XmlManager object
            DbXml::XmlManager *mgr = new DbXml::XmlManager(env, DbXml::DBXML_ADOPT_DBENV | DbXml::DBXML_ALLOW_EXTERNAL_ACCESS);
            // create containers - these will be used by the workers
            DbXml::XmlContainerConfig pkg_config;
            DbXml::XmlContainerConfig int_config;
            pkg_config.setTransactional(true);
            int_config.setTransactional(true);
            std::cerr << "-- Writer creating containers" << std::endl;
            DbXml::XmlContainer packages       = mgr->createContainer(pkgname.c_str(), pkg_config);
            DbXml::XmlContainer integrations   = mgr->createContainer(intname.c_str(), int_config);
            std::cerr << "-- Writer instructing workers" << std::endl;
            std::vector<boost::mpi::request> reqs(mpi_world.size() - 1);
            for(unsigned int                 i = 1; i < mpi_world.size(); i++)
                reqs[i - 1] = mpi_world.isend(i, 0); // instruct workers to open the environment
            // wait for all messages to be received
            boost::mpi::wait_all(reqs.begin(), reqs.end());
            std::cerr << "-- Writer waiting for termination responses" << std::endl;
            // wait for workers to advise successful termination
            unsigned int outstanding_workers = mpi_world.size() - 1;
            while(outstanding_workers > 0)
                boost::mpi::status stat = mpi_world.probe();
                switch(stat.tag())
                    case 1:
                        mpi_world.recv(stat.source(), 1);
                        outstanding_workers--;
                        break;
            delete mgr; // exit, closing database and environment
        else
            mpi_world.recv(0, 0);
            std::cerr << "++ Reader " << mpi_world.rank() << " beginning work" << std::endl;
            DB_ENV *env;
            ::db_env_create(&env, 0);
            u_int32_t env_flags = DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_REGISTER | DB_RECOVER | DB_INIT_TXN | DB_CREATE;
            env->open(env, envname.c_str(), env_flags, 0);
            // set up XmlManager object
            DbXml::XmlManager *mgr = new DbXml::XmlManager(env, DbXml::DBXML_ADOPT_DBENV | DbXml::DBXML_ALLOW_EXTERNAL_ACCESS);
            // open containers which were set up by the master
            DbXml::XmlContainerConfig pkg_config;
            DbXml::XmlContainerConfig int_config;
            pkg_config.setTransactional(true);
            pkg_config.setReadOnly(true);
            int_config.setTransactional(true);
            int_config.setReadOnly(true);
            DbXml::XmlContainer packages     = mgr->openContainer(pkgname.c_str(), pkg_config);
            DbXml::XmlContainer integrations = mgr->openContainer(intname.c_str(), int_config);
            mpi_world.isend(0, 1);
            delete mgr; // exit, closing database and environment
        return (EXIT_SUCCESS);
    This repeatably causes the crash on OS X Mavericks 10.9.1. Also, I have checked that it repeatably causes the crash on a virtualized OS X Mountain Lion 10.8.5. But I do not see any crashes on a virtualized Ubuntu 13.10. My full code likewise works as expected with a large number of readers under the virtualized Ubuntu. I am compiling with clang and libc++ on OS X, and gcc 4.8.1 and libstdc++ on Ubuntu, but using openmpi in both cases. Edit: I have also compiled with clang and libc++ on Ubuntu, and it works equally well.
    Because the virtualized OS X experiences the crash, I hope the fact that it works on Ubuntu is not just an artefact of virtualization. (Unfortunately I don't currently have a physical Linux machine with which to check.) In that case the implication would seem to be that it's an OS X-specific problem. 2nd edit (14 Feb 2014): I have now managed to test on a physical Linux cluster, and it appears to work as expected. Therefore it does appear to be an OS X-specific issue.
    In either OS X 10.8 or 10.9, the crash produces this result:
    -- Writer creating environment
    **   creation response = 0
    -- Writer opening environment
    **   opening response = 0
    -- Writer creating containers
    ++ Reader 7 beginning work
    -- Writer instructing workers
    -- Writer waiting for termination responses
    ++ Reader 1 beginning work
    ++ Reader 2 beginning work
    ++ Reader 3 beginning work
    ++ Reader 4 beginning work
    ++ Reader 5 beginning work
    ++ Reader 6 beginning work
    pthread lock failed: Invalid argument
    PANIC: Invalid argument
    PANIC: fatal region error detected; run recovery
    PANIC: fatal region error detected; run recovery
    PANIC: fatal region error detected; run recovery
    PANIC: fatal region error detected; run recovery
    PANIC: fatal region error detected; run recovery
    PANIC: fatal region error detected; run recovery
    PANIC: fatal region error detected; run recovery
    libc++abi.dylib: terminate called throwing an exception
    [mountainlion-test-rig:00319] *** Process received signal ***
    [mountainlion-test-rig:00319] Signal: Abort trap: 6 (6)
    [mountainlion-test-rig:00319] Signal code:  (0)
    David
    Message was edited by: ds283

  • XML and DTD parsing

    How do I validate an xml file using a dtd in Java? Is there a parser that validates xml's against dtd's?
    I have parsed the xml file that contains the DOCTYPE necessary to define the dtd. However, the parser only seems to check whether or not the dtd exists but doesn't bother to check whether the xml file is valid given the specified dtd?
    I am using the jaxp parser.
    Kind Regards,
    Fadi

    Take a look at the xerces parser (http://xml.apache.org/).
    --Arnout                                                                                                                                                                                           

  • Difference between schema and DTD

    Difference between schema and DTD
    <author>
    <firstname></firstname>
    <lastname></lastname>
    </author>
    How will u write dtd and schema for above XML ?

    DTD:
    <!ELEMENT author(firstname, lastname)>
    <!ELEMENT firstname(#PCDATA)>
    <!ELEMENT lastname(#PCDATA)>
    Schema:
    <xs:element name="author">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="firstname" type="xs:string"/>
    <xs:element name="lastname" type="xs:string"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>

  • Berkeley DB XML as Message Store

    Hi,
    I need to build a 'Message Store' (as referred to in 'Enterprise Integration Patterns: Designing, Building, and Deploying Messaging Solutions') for our SOA. Components of the SOA are coupled by JMS / sockets and send XML messages to each other. The central message store would consume all messages and so provide a message history and allow comparison of messages for support, performance measurement, troubleshooting, etc.
    One approach which occured to me would be lightweight Java framework on top of Berkeley DB XML, which would handle connectivity to all integration points.
    All of our messages are small (< 5K) but some types are high frequency (say 2K/s).
    Can anyone comment on this approach pls or share experiences pls?
    Many thanks!
    Pete

    The short answer is that you need to shut down the FastCGI Perl script before you copy the files over, and then re-start it once the file copy is complete. Basically, what's happening is that FastCGI Perl script has cached data in file-system backed shared memory. When you replace the underlying files via an file system copy "under the covers" so to speak, the in-memory and on-disk data becomes out of sync. Subsequent access to the repository can fail in many ways, a core dump is often going to be the result.
    If you don't want to shut down the FastCGI Perl script during the copy, there are several other options that you could consider.
    1) Copy the new files into a new/alternate directory location, stop/re-start the FastCGI Perl script when the copy is complete, pointing to the new location. That minimizes the "downtime" or,
    2) Delete and insert documents one at a time through the API or,
    3) Update documents one at a time through the API or,
    4) Truncate the container and insert the documents.
    Options 2, 3 & 4 will allow the FastCGI Perl script to keep on running, but will probably take more time and may result in larger database files.
    Replication really won't help much if your goal is to completely replace the repository once every 24 hours. The same action would have to be applied to the master and replicated to the other repository locations. The same action of "replace everything" is still occurring.
    I hope that this helps.
    Regards,
    Dave

  • Berkeley DB XML Can't load 32-bit .dll on a 64-bit platform Netbeans

    Hi I am trying to use Berkely DB in netbeans java on 64-bit windows platform. I have downloaded and configured JDK 7 32 bit in project properties. It works well for a simple java project but when i do the same for a web application in netbeans for glassfish or Apache Tomcat Servers it gives this exception
    [Servlet execution threw an exception] with root cause
    java.lang.UnsatisfiedLinkError: C:\Program Files (x86)\Oracle\Berkeley DB XML 2.5.16\bin\libdb_java48.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform
         at java.lang.ClassLoader$NativeLibrary.load(Native Method)
         at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1803)
         at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1728)
         at java.lang.Runtime.loadLibrary0(Runtime.java:823)
         at java.lang.System.loadLibrary(System.java:1028)
         at com.sleepycat.db.internal.db_javaJNI.<clinit>(db_javaJNI.java:38)
         at com.sleepycat.db.internal.DbEnv.<init>(DbEnv.java:264)
         at com.sleepycat.dbxml.XmlManager.<init>(XmlManager.java:77)
         at com.sleepycat.dbxml.XmlManager.<init>(XmlManager.java:101)
    This problem was also coming before for simple java app but it resolved after configuring jdk in project properties but for web application its not working

    XML berkley db doesnt seem to support the java 64 bit model.
    In our Java application we get this error when using JRE7 but not JDK7 or JRE6
    The difference seemed to be that in JDK7 and JRE6 you can use java -D32, but thats not possible in JRE7 (you must use java -D64. So it seems to be a difference in JRE7 and JDK7 as well
    best regards,
    Tom-Erik

  • Creating an XML document from a DTD in Java

    Hi All,
    I need help on the following requirement very badly. Pls help me.
    I have a requirement to implement with java and XML. I am quit new to XML.Can any of you pls help me.
    I have a DTD file. I need to generate XML document from it using java code. I have to use DTD as a template to generate my XML document.
    After going through WEB sites, I understtod that, we have to user Java API JAXB for my requirement. But I could not find JAXB.jar anywhere.
    I need to know the following inforamtion ....
    1. Is my understanding of using JAXB for my requirement is correct?
    2. Where can I get JAXB.jar?
    3. What are the steps to create XML document from a DTD in Java?
    If can give me a sample code for this would help me a lot.
    Pls pls reply me. Your help is greatly appreciated.
    Thanks in Advance.
    Regards,
    Gayathri.

    hi Gayathri,
    iam currently working in the same field.
    firs download jaxb from this link:
    http://java.sun.com/xml/downloads/jaxb.html
    first u need to marshall it.
    cheers
    shashi

  • How to use Xerces to validate an XML file against a DTD

    Hi, can anybody tell me how to use Xerces to validate an XML file against a DTD. its urgent. post some sample code. it would be helpful for my project. isupposed to use SAX parser(Xerces)
    Thanx in advance

    Come on, I googled "xerces validate" and the first link is the Xerces FAQ:
    http://xerces.apache.org/xerces-j/faq-general.html
    And of course "how to validate" is a Xerces FAQ. Help yourself by doing a little research instead of waiting for other people.

  • How to run Berkeley DB XML on AMD 64-bit Windows XP platform?

    Hi,
    I have used Berkeley DB XML on a 32-bit Windows XP platform but now
    I have to run Berkeley DB XML on a 64-bit AMD platform with Windows XP.
    After reading a few posts about that, I started to build Berkeley DB XML in 64-bit mode.
    I am doing the building with Visual Studio 2005 on my 32-bit Windows XP platform.
    But the build process does not finish successful.
    I got errors saying:
    fatal error C1083:
    Cannot open include file: 'jni.h': No such file or directory     
    c:\berkeley_new\dbxml-2.4.16\dbxml\src\java\dbxml_java_wrap.cpp     149     
    fatal error LNK1112:
    module machine type 'x64' conflicts with target machine type 'X86'     
    c:\berkeley_new\dbxml-2.4.16\dbxml\build_windows\x64\Release_static\BaseInputStream.obj     1     Because of this only the DLL "libdb46.dll" has been created new.
    But there should be also some more DLLs. These DLLs are missing inside the dbxml/bin folder:
    libdb_java46.dll
    libdbxml24.dll
    libdbxml_java24.dllI go the old 32-bit compiled DLLs but when using them I got an exception saying:
    java.lang.UnsatisfiedLinkError: C:\berkeley_db_dll\libdb_java46.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform1) What can I do?
    2) Is there a chance to get all the related DLLs compiled for 64-bit from someone/somewhere?
    Thanks.

    soner wrote:
    I think you mean db_java cause this is the project which is building the missing DLL libdb_java46.dll
    cause dbxml_java is building libdbxml_java24.dll. I thought the latter would have a dependency on the former and hence build both. So I recommended to build the latter lest your next question be how to do just that. But that backfired :-)
    Question of mine: Why doesn't dbxml_java depend on db_java?
    But anyway I have tried to build both projects seperatly and in both cases I am getting an error like:
    Error     4     fatal error LNK1181: cannot open input file 'libdbxml24.lib' db_java
    Do the equivalent of the following on your system:
    dir C:\MILU\Quelltext\dbxml-2.4.16 /s /b /a-d | findstr /e .libThat searches the source tree for LIB files, so-called import libraries; I don't know more about it, but you can use Google to find out what they are.
    Did you build the DEBUG version or the straight one? Or a little bit of both?
    Can't remember if I had to configure the project any further than adding jni.h to the build path.
    Maybe try cleaning and rebuilding.
    Also, when receiving an error message, it is good standard practice to perform a simple web search of the relevant portions to find out about the issue - and be it only for practicing.
    Michael Ludwig

  • Validating XML documents against a DTD

    Guys I am new to XML and I have this requirement to validate a XML document against a DTD.This validation has to be done through my java application.In short , a user enters a XML data thru a JSP form ,and moment he presses the SAVE button my java program should validate the XML data against a DTD and then display any error or else save the data into an Oracle table.
    I was wondering lot of program/utitlities must be available out there which will do the validation for me ,rather than me re-inventing the wheel.
    Please advice.
    Thanks
    Manohar.

    You should go through this to learn more on XML with Java :
    http://www.onjava.com/pub/a/onjava/excerpt/learnjava_23/index1.html
    You can check following how to to parse XML doc against a schema
    http://otn.oracle.com/sample_code/tech/java/codesnippet/xdk/SchemaValidation/SchemaValidation.html
    You should also look at chapter 4 of following doc for parsing XML using java :
    http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96621/toc.htm
    Chandar

  • XSU Generated Schemas and DTDs are bad input for oracg

    Hi,
    I'm trying to write a utility that accepts a database schema name and writes XML Schemas and a DTDs for each table based on a:
    select * from table_name
    over each table in the schema. I would then like to use those files as input to the oracg utility to produce java files. There are some problems though. The DTD representation is not meant as a standalone DTD. In other words its of the form:
    <!DOCTYPE NAME [
    ...dtd defs here ...
    ]>
    which oracg doesn't like. Its not a big deal to do some post processing and delete the DOCTYPE defenition, but then oracg barfs with the following error:
    Error: DTD Class Generator failed to generate classes. oracle.xml.parser.v2.XMLParseException: Expected 'DOCTYPE'.
    Here is the DTD I was trying to generate a class from:
    <!ELEMENT STATION (ROW)*>
    <!ELEMENT ROW (STN_THTR_AREA_CODE, STN_ID_CD, STN_NM?, STN_ESTD_DATA?, STN_CTRY_CD?, STN_SW_TYPE_CD?, STN_AGNY_CD?, STN_
    MFR_CD?, STN_CURR_SFTWR?, STN_TIME_ZONE?, STN_LATD?, STN_LNGTD?, STN_NM_VLD_CALLS_1?, STN_NM_VLD_CALLS_2?, STN_NM_VLD_CA
    LLS_3?, STN_NM_VLD_CALLS_4?, STN_NM_CALLS_1?, STN_NM_CALLS_2?, STN_NM_CALLS_3?, STN_NM_CALLS_4?, STN_STDY_ID_1?, STN_STD
    Y_ID_2?, STN_STDY_ID_3?, STN_STDY_ID_4?, STN_CLASS_A_PHONES_ESTD_QTY?, STN_CLASS_B_PHONES_ESTD_QTY?, STN_POC_TTL?, STN_P
    OC_FIRST_NM?, STN_POC_LAST_NM?, STN_POC_OFC_SYM_NM?, STN_POC_APO_PPO?, STN_POC_PSTL_CD?, STN_POC_AUTVN_TLPHN_NBR?, STN_M
    ODIFIED_DT?, STN_TANDEM?, STN_MEMO?, STN_SW_TYPE_DESC?, STN_FREQ?, STN_THTR, STN_STDY_ID, STN_GEOLOC?, STN_SHIFT_FLG, ST
    N_SEQ?, STN_TMPLT_NM?)>
    <!ATTLIST ROW num CDATA #REQUIRED>
    <!ELEMENT STN_THTR_AREA_CODE (#PCDATA)>
    <!ELEMENT STN_ID_CD (#PCDATA)>
    <!ELEMENT STN_NM (#PCDATA)>
    <!ELEMENT STN_ESTD_DATA (#PCDATA)>
    <!ELEMENT STN_CTRY_CD (#PCDATA)>
    <!ELEMENT STN_SW_TYPE_CD (#PCDATA)>
    <!ELEMENT STN_AGNY_CD (#PCDATA)>
    <!ELEMENT STN_MFR_CD (#PCDATA)>
    <!ELEMENT STN_CURR_SFTWR (#PCDATA)>
    <!ELEMENT STN_TIME_ZONE (#PCDATA)>
    <!ELEMENT STN_LATD (#PCDATA)>
    <!ELEMENT STN_LNGTD (#PCDATA)>
    <!ELEMENT STN_NM_VLD_CALLS_1 (#PCDATA)>
    <!ELEMENT STN_NM_VLD_CALLS_2 (#PCDATA)>
    <!ELEMENT STN_NM_VLD_CALLS_3 (#PCDATA)>
    <!ELEMENT STN_NM_VLD_CALLS_4 (#PCDATA)>
    <!ELEMENT STN_NM_CALLS_1 (#PCDATA)>
    <!ELEMENT STN_NM_CALLS_2 (#PCDATA)>
    <!ELEMENT STN_NM_CALLS_3 (#PCDATA)>
    <!ELEMENT STN_NM_CALLS_4 (#PCDATA)>
    <!ELEMENT STN_STDY_ID_1 (#PCDATA)>
    <!ELEMENT STN_STDY_ID_2 (#PCDATA)>
    <!ELEMENT STN_STDY_ID_3 (#PCDATA)>
    <!ELEMENT STN_STDY_ID_4 (#PCDATA)>
    <!ELEMENT STN_CLASS_A_PHONES_ESTD_QTY (#PCDATA)>
    <!ELEMENT STN_CLASS_B_PHONES_ESTD_QTY (#PCDATA)>
    <!ELEMENT STN_POC_TTL (#PCDATA)>
    <!ELEMENT STN_POC_FIRST_NM (#PCDATA)>
    <!ELEMENT STN_POC_LAST_NM (#PCDATA)>
    <!ELEMENT STN_POC_OFC_SYM_NM (#PCDATA)>
    <!ELEMENT STN_POC_APO_PPO (#PCDATA)>
    <!ELEMENT STN_POC_PSTL_CD (#PCDATA)>
    <!ELEMENT STN_POC_AUTVN_TLPHN_NBR (#PCDATA)>
    <!ELEMENT STN_MODIFIED_DT (#PCDATA)>
    <!ELEMENT STN_TANDEM (#PCDATA)>
    <!ELEMENT STN_MEMO (#PCDATA)>
    <!ELEMENT STN_SW_TYPE_DESC (#PCDATA)>
    <!ELEMENT STN_FREQ (#PCDATA)>
    <!ELEMENT STN_THTR (#PCDATA)>
    <!ELEMENT STN_STDY_ID (#PCDATA)>
    <!ELEMENT STN_GEOLOC (#PCDATA)>
    <!ELEMENT STN_SHIFT_FLG (#PCDATA)>
    <!ELEMENT STN_SEQ (#PCDATA)>
    <!ELEMENT STN_TMPLT_NM (#PCDATA)>
    I'm also having problems dealing with schemas. The call to OracleXMLQuery.getXMLMetaData(OracleXMLQuery.SCHEMA, false) returns the following for this particular table:
    <DOCUMENT xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"<xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema">
    <xsd:element name="STATION">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="ROW" minOccurs="0" maxOccurs="unbounded">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="STN_THTR_AREA_CODE" type="xsd:string" minOc curs="0"/>
    <xsd:element name="STN_ID_CD" type="xsd:string" minOccurs="0"/>
    <xsd:element name="STN_NM" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_ESTD_DATA" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_CTRY_CD" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_SW_TYPE_CD" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_AGNY_CD" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_MFR_CD" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_CURR_SFTWR" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_TIME_ZONE" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_LATD" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_LNGTD" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_NM_VLD_CALLS_1" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_NM_VLD_CALLS_2" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_NM_VLD_CALLS_3" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_NM_VLD_CALLS_4" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_NM_CALLS_1" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_NM_CALLS_2" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_NM_CALLS_3" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_NM_CALLS_4" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_STDY_ID_1" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_STDY_ID_2" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_STDY_ID_3" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_STDY_ID_4" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_CLASS_A_PHONES_ESTD_QTY" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_CLASS_B_PHONES_ESTD_QTY" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_POC_TTL" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_POC_FIRST_NM" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_POC_LAST_NM" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_POC_OFC_SYM_NM" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_POC_APO_PPO" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_POC_PSTL_CD" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_POC_AUTVN_TLPHN_NBR" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_MODIFIED_DT" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_TANDEM" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_MEMO" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_SW_TYPE_DESC" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_FREQ" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_THTR" type="xsd:string" minOccurs="0"/>
    <xsd:element name="STN_STDY_ID" type="xsd:string" minOccurs="0"/>
    <xsd:element name="STN_GEOLOC" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_SHIFT_FLG" type="xsd:string" minOccurs="0"/>
    <xsd:element name="STN_SEQ" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_TMPLT_NM" type="xsd:string" nullable="true" minOccurs="0"/>
    </xsd:sequence>
    <xsd:attribute name="num" type="xsd:integer"/>
    </xsd:complexType&g t;
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>
    />
    The oracg utility gives the following errors with this as input:
    file:/export/home/kennedy/generatedSchemas/STATION.xsd<Line 1, Column 58>: XML-0190: (Fatal Error) Whitespace required.
    file:/export/home/kennedy/generatedSchemas/STATION.xsd<Line 1, Column 58>: XML-0201: (Fatal Error) Expected name instead of <.
    file:/export/home/kennedy/generatedSchemas/STATION.xsd<Line 1, Column 58>: XML-0122: (Fatal Error) '=' missing in attribute.
    file:/export/home/kennedy/generatedSchemas/STATION.xsd<Line 1, Column 59>: XML-0125: (Fatal Error) Attribute value should start with quote.
    Error: Schema Class Generator failed to generate classes. oracle.xml.parser.v2.XMLParseException: Whitespace required.
    which clearly points to the fact that the XSD:SCHEMA element is enclosed in the Document Element. Removing the document tag completely and leaving XSD:SCHEMA as the root element works. But thats a lot of post processing to be doing and I was wondering if there was a way to generate XML Schemas and DTDs using the standalone representations.
    If there is no way to do that, could somebody help me fix the error generated by oracg with my DTD?
    Thanks,
    Matt

    Hi,
    I'm trying to write a utility that accepts a database schema name and writes XML Schemas and a DTDs for each table based on a:
    select * from table_name
    over each table in the schema. I would then like to use those files as input to the oracg utility to produce java files. There are some problems though. The DTD representation is not meant as a standalone DTD. In other words its of the form:
    <!DOCTYPE NAME [
    ...dtd defs here ...
    ]>
    which oracg doesn't like. Its not a big deal to do some post processing and delete the DOCTYPE defenition, but then oracg barfs with the following error:
    Error: DTD Class Generator failed to generate classes. oracle.xml.parser.v2.XMLParseException: Expected 'DOCTYPE'.
    Here is the DTD I was trying to generate a class from:
    <!ELEMENT STATION (ROW)*>
    <!ELEMENT ROW (STN_THTR_AREA_CODE, STN_ID_CD, STN_NM?, STN_ESTD_DATA?, STN_CTRY_CD?, STN_SW_TYPE_CD?, STN_AGNY_CD?, STN_
    MFR_CD?, STN_CURR_SFTWR?, STN_TIME_ZONE?, STN_LATD?, STN_LNGTD?, STN_NM_VLD_CALLS_1?, STN_NM_VLD_CALLS_2?, STN_NM_VLD_CA
    LLS_3?, STN_NM_VLD_CALLS_4?, STN_NM_CALLS_1?, STN_NM_CALLS_2?, STN_NM_CALLS_3?, STN_NM_CALLS_4?, STN_STDY_ID_1?, STN_STD
    Y_ID_2?, STN_STDY_ID_3?, STN_STDY_ID_4?, STN_CLASS_A_PHONES_ESTD_QTY?, STN_CLASS_B_PHONES_ESTD_QTY?, STN_POC_TTL?, STN_P
    OC_FIRST_NM?, STN_POC_LAST_NM?, STN_POC_OFC_SYM_NM?, STN_POC_APO_PPO?, STN_POC_PSTL_CD?, STN_POC_AUTVN_TLPHN_NBR?, STN_M
    ODIFIED_DT?, STN_TANDEM?, STN_MEMO?, STN_SW_TYPE_DESC?, STN_FREQ?, STN_THTR, STN_STDY_ID, STN_GEOLOC?, STN_SHIFT_FLG, ST
    N_SEQ?, STN_TMPLT_NM?)>
    <!ATTLIST ROW num CDATA #REQUIRED>
    <!ELEMENT STN_THTR_AREA_CODE (#PCDATA)>
    <!ELEMENT STN_ID_CD (#PCDATA)>
    <!ELEMENT STN_NM (#PCDATA)>
    <!ELEMENT STN_ESTD_DATA (#PCDATA)>
    <!ELEMENT STN_CTRY_CD (#PCDATA)>
    <!ELEMENT STN_SW_TYPE_CD (#PCDATA)>
    <!ELEMENT STN_AGNY_CD (#PCDATA)>
    <!ELEMENT STN_MFR_CD (#PCDATA)>
    <!ELEMENT STN_CURR_SFTWR (#PCDATA)>
    <!ELEMENT STN_TIME_ZONE (#PCDATA)>
    <!ELEMENT STN_LATD (#PCDATA)>
    <!ELEMENT STN_LNGTD (#PCDATA)>
    <!ELEMENT STN_NM_VLD_CALLS_1 (#PCDATA)>
    <!ELEMENT STN_NM_VLD_CALLS_2 (#PCDATA)>
    <!ELEMENT STN_NM_VLD_CALLS_3 (#PCDATA)>
    <!ELEMENT STN_NM_VLD_CALLS_4 (#PCDATA)>
    <!ELEMENT STN_NM_CALLS_1 (#PCDATA)>
    <!ELEMENT STN_NM_CALLS_2 (#PCDATA)>
    <!ELEMENT STN_NM_CALLS_3 (#PCDATA)>
    <!ELEMENT STN_NM_CALLS_4 (#PCDATA)>
    <!ELEMENT STN_STDY_ID_1 (#PCDATA)>
    <!ELEMENT STN_STDY_ID_2 (#PCDATA)>
    <!ELEMENT STN_STDY_ID_3 (#PCDATA)>
    <!ELEMENT STN_STDY_ID_4 (#PCDATA)>
    <!ELEMENT STN_CLASS_A_PHONES_ESTD_QTY (#PCDATA)>
    <!ELEMENT STN_CLASS_B_PHONES_ESTD_QTY (#PCDATA)>
    <!ELEMENT STN_POC_TTL (#PCDATA)>
    <!ELEMENT STN_POC_FIRST_NM (#PCDATA)>
    <!ELEMENT STN_POC_LAST_NM (#PCDATA)>
    <!ELEMENT STN_POC_OFC_SYM_NM (#PCDATA)>
    <!ELEMENT STN_POC_APO_PPO (#PCDATA)>
    <!ELEMENT STN_POC_PSTL_CD (#PCDATA)>
    <!ELEMENT STN_POC_AUTVN_TLPHN_NBR (#PCDATA)>
    <!ELEMENT STN_MODIFIED_DT (#PCDATA)>
    <!ELEMENT STN_TANDEM (#PCDATA)>
    <!ELEMENT STN_MEMO (#PCDATA)>
    <!ELEMENT STN_SW_TYPE_DESC (#PCDATA)>
    <!ELEMENT STN_FREQ (#PCDATA)>
    <!ELEMENT STN_THTR (#PCDATA)>
    <!ELEMENT STN_STDY_ID (#PCDATA)>
    <!ELEMENT STN_GEOLOC (#PCDATA)>
    <!ELEMENT STN_SHIFT_FLG (#PCDATA)>
    <!ELEMENT STN_SEQ (#PCDATA)>
    <!ELEMENT STN_TMPLT_NM (#PCDATA)>
    I'm also having problems dealing with schemas. The call to OracleXMLQuery.getXMLMetaData(OracleXMLQuery.SCHEMA, false) returns the following for this particular table:
    <DOCUMENT xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"<xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema">
    <xsd:element name="STATION">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="ROW" minOccurs="0" maxOccurs="unbounded">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="STN_THTR_AREA_CODE" type="xsd:string" minOc curs="0"/>
    <xsd:element name="STN_ID_CD" type="xsd:string" minOccurs="0"/>
    <xsd:element name="STN_NM" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_ESTD_DATA" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_CTRY_CD" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_SW_TYPE_CD" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_AGNY_CD" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_MFR_CD" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_CURR_SFTWR" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_TIME_ZONE" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_LATD" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_LNGTD" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_NM_VLD_CALLS_1" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_NM_VLD_CALLS_2" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_NM_VLD_CALLS_3" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_NM_VLD_CALLS_4" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_NM_CALLS_1" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_NM_CALLS_2" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_NM_CALLS_3" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_NM_CALLS_4" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_STDY_ID_1" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_STDY_ID_2" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_STDY_ID_3" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_STDY_ID_4" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_CLASS_A_PHONES_ESTD_QTY" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_CLASS_B_PHONES_ESTD_QTY" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_POC_TTL" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_POC_FIRST_NM" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_POC_LAST_NM" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_POC_OFC_SYM_NM" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_POC_APO_PPO" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_POC_PSTL_CD" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_POC_AUTVN_TLPHN_NBR" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_MODIFIED_DT" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_TANDEM" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_MEMO" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_SW_TYPE_DESC" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_FREQ" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_THTR" type="xsd:string" minOccurs="0"/>
    <xsd:element name="STN_STDY_ID" type="xsd:string" minOccurs="0"/>
    <xsd:element name="STN_GEOLOC" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_SHIFT_FLG" type="xsd:string" minOccurs="0"/>
    <xsd:element name="STN_SEQ" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_TMPLT_NM" type="xsd:string" nullable="true" minOccurs="0"/>
    </xsd:sequence>
    <xsd:attribute name="num" type="xsd:integer"/>
    </xsd:complexType&g t;
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>
    />
    The oracg utility gives the following errors with this as input:
    file:/export/home/kennedy/generatedSchemas/STATION.xsd<Line 1, Column 58>: XML-0190: (Fatal Error) Whitespace required.
    file:/export/home/kennedy/generatedSchemas/STATION.xsd<Line 1, Column 58>: XML-0201: (Fatal Error) Expected name instead of <.
    file:/export/home/kennedy/generatedSchemas/STATION.xsd<Line 1, Column 58>: XML-0122: (Fatal Error) '=' missing in attribute.
    file:/export/home/kennedy/generatedSchemas/STATION.xsd<Line 1, Column 59>: XML-0125: (Fatal Error) Attribute value should start with quote.
    Error: Schema Class Generator failed to generate classes. oracle.xml.parser.v2.XMLParseException: Whitespace required.
    which clearly points to the fact that the XSD:SCHEMA element is enclosed in the Document Element. Removing the document tag completely and leaving XSD:SCHEMA as the root element works. But thats a lot of post processing to be doing and I was wondering if there was a way to generate XML Schemas and DTDs using the standalone representations.
    If there is no way to do that, could somebody help me fix the error generated by oracg with my DTD?
    Thanks,
    Matt

  • Help: How to Validate XML using SAXParser and return the entire error list

    Hi,
    I have a problem, I'm trying to validate a xml document against the DTD. Here Im using SAXParser and having the ErrorHandler object passed when setting the error Handler, like parser.setErrorHandler(errorHandlerObj).
    I need an output like where the entire XML document is read and all the errors have to be reported with the line number.
    like example:
    <b>Line 6: <promp>
    [Error]:Element type "promp" must be declared.
    Line 8: </prompt>
    [Fatal Error]:The end-tag for element type "promp" must end with a '>' delimiter.
    who can i achieve this.</b>
    what happens with the present code is that it throws the first error it encountered and comes out.
    how can i solve this problem

    You can try to set the following feature to 'true' for your SAXParser:
    http://apache.org/xml/features/continue-after-fatal-error
    At least Xerces supports this feature.

  • Query container only relative to the Berkeley DB XML Enviroment location.

    I have been having a great deal of trouble getting any queries to work using the Berkeley DB XML API. I am using Java 7 as my language and Netbeans 7.0.1 as my platform. After lots of experimentation with the Shell and observing its behavior, I seem to have isolated it to my not being able to specify a full absolute path name for my containers. Apparently to use XmlManager.query() or XmlManager.prepare().execute(), I must root the query with either a collection() or doc() entry at the beginning. The problem seems to be that both collection() and doc() only will take a simple filename+extension form for the name of my container. The XmlManager then resolves this name relative to the location of my XmlManager environment. If I specify anything else, I get "Error 6: Invalid URI format [err:FODC0002]" as an XmlException. I have tried various formats of absolute paths for my containers and none of them will work. For my application, the user needs to be able to put his containers anywhere on a local drive. It appears that the only way that I can operate is to put all my containers in that one Environment directory, or possibly one below it. This is a super-serious problem for me if this is true.
    I could find no call in the API to override this behavior. I had hoped that XmlQueryContext.setBaseURI() would do that since it said it was for specifying a URI against which local things would be resolved against. But, any call to it with a directory path also raised the same XmlExpection. Being new with this produce, I am hoping that I am missing something obvious. Can anyone help?
    Edward Fairchild
    [email protected]

    I have more information about this problem. It appears to be caused by spaces in the filename or path of the container in forming the collection() prefix in my xQuery. For the following test, I was using a container named "EEF-PGL10GenAncestors Only.gcdb" in my Environment folder. Here is the code that fails.
    XmlQueryContext context = xmlmanGCDB.createQueryContext();
    context.setEvaluationType(XmlQueryContext.Lazy);
    String sContainerName = xmlcontGCDB.getName();
    FileObject foContainer = FileUtil.toFileObject(new File(sContainerName));
    sContainerName = foContainer.getNameExt();
    sContainerName = Util.convertFilepathToURI(sContainerName);
    String sQuery = "collection(\"" + sContainerName + "\")/" + GCDBTAG_INDI;
    if(bDebug) DebugOut.println("sQuery: " + sQuery);
    XmlQueryExpression xmlquery = xmlmanGCDB.prepare(sQuery, context);
    XmlResults xmlresults = xmlquery.execute(context);
    XmlDocument xmldoc = xmlmanGCDB.createDocument();
    boolean bRet = xmlresults.next(xmldoc);
    1. When I run it with the container named above with space and with the Util.convertFilepathToURI() call commented out, I get an XmlException executing the XmlManager.prepare() call. Based on this, I thought that you must be requiring percent encoding of spaces. The exception had Error Code 6: Invalid URI format [err:FODC0002], errcode = QUERY_PARSER_ERROR. The debug line displayed as
    sQuery: collection("EEF-PGL10GenAncestors Only.gcdb")/INDI
    2. So, if you uncomment that Util.convertFilepathToURI() call line and run it again, the debug line displays
    sQuery: collection("EEF-PGL10GenAncestors%20Only.gcdb")/INDI
    but that also caused an XmlException with Error Code 17: EEF-PGL10GenAncestors%20Only.gcdb: container file not found, or not a container, errcode = CONTAINER_NOT_FOUND. So, it is not interpreting the space as a %20 correctly.
    3. Finally, if I take the space out of the filename and rerun, the debug line displays
    sQuery: collection("EEF-PGL10GenAncestorsOnly.gcdb")/INDI
    and everything works just fine. Are you using some other way to encode this space in a container name besides what I have tried? I need some help here folks.
    Edward Fairchild
    [email protected]

  • Undigesting XML with Schema and Rules

    We currently use a Digester with schema and rules files to digest an input XML and automatically build our Java objects. What I'd like to know is if there is a REVERSE process? Is there any class or utility that can take those Java objects and build an XML file?
    Thanks,
    Rich

    Ask Microsoft why IE6 does not validate. Normally server-side developers do
    not rely on a browser to validate XML against schema or DTD but validate XML
    on the server. The same is true for XSLT transformations...
    "Benoit Degreve" <[email protected]> wrote in message
    news:aqnihv$l75$[email protected]..
    Hi everybody,
    I'm trying to validate an XML file with a schema but it doesn't seem to
    work.
    I open the XML file (that doesn't match the rules that are in the schema)
    with a IE6, and there is no errors...
    I have the same problem with a DTD (its reference is in the XML file like
    shown in my book)...
    Does the validation process have to be done by a specific application ?For
    the schema ? For the DTD ? In other words, does IE6 make the validation
    process automatically ?
    Could someone help me ?

Maybe you are looking for

  • Confused if i need the enterprise DPS along with enterprise license from Apple

    Do I need to buy the Enterprise DPS if I already have a Enterprise developers license with Apple? I want to develope in-house apps with indesign but everywhere i read no body gives a straight answer. I have "creative cloud membership" which includes

  • Rendering of an 8Bit-tiff with java.awt produces crap

    Hi Folks, i do a downsampling of tiff images. The source tiffs are colored 8 Bit greyscale with a 256 color-table. Now i have 2 possibilities to resample with java.awt: 1. the target-tiff is of 24Bit true color: BufferedImage objDownsample = new Buff

  • Screen Sharing Suddenly Not working?

    I've been using Screen Sharing for months now to control my Mac Pro Desktop that is connected to my Plasma TV with my Macbook Pro laptop with no issues. Suddenly now a message pops up everytime I try to connect telling me that the connection doesnt s

  • Quick List of Quick Fixes???

    Does anyone have a resource for quick hardware fixes? My G5 is having problems starting and waking (go figure). It's getting a little worse, and I'm looking for options. Not necessairily the right options, but just things to try. Such as cracking her

  • MF4700n having IP address issues

    I have been using the Image Class MF4700n for 3 months and yesterday it decided to stop communicating with the networked computers. It continues to work as a fax machine, but it won't automatically reassign the IP address, or allow us to manually ass