2 Replies Latest reply: Jan 18, 2011 8:23 PM by 761557 RSS

    Berkeley DB XML, Python, TEI and DTDs

    537206
      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
        • 1. Re: Berkeley DB XML, Python, TEI and DTDs
          655560
          Hi AL,

          Please find information about BDB XML in <dbxml_package>/dbxml/src/python

          Best regards,
          Rucong
          • 2. Re: Berkeley DB XML, Python, TEI and DTDs
            761557
            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)