2 Replies Latest reply: Sep 20, 2012 9:17 AM by mdrake-Oracle RSS

    Where is xdbconfig.xsd file stored. How to access and modify it

    961018
      Can some one tell me where to find the xdbconfig.xsd file in oracle11gr2.

      Regards
      Milash
        • 1. Re: Where is xdbconfig.xsd file stored. How to access and modify it
          odie_63
          select schema
          from dba_xml_schemas 
          where schema_url = 'http://xmlns.oracle.com/xdb/xdbconfig.xsd';
          You can also view it from the XML DB repository @ /sys/schemas/PUBLIC/xmlns.oracle.com/xdb/xdbconfig.xsd
          select xdburitype('/sys/schemas/PUBLIC/xmlns.oracle.com/xdb/xdbconfig.xsd').getClob() from dual;
          • 2. Re: Where is xdbconfig.xsd file stored. How to access and modify it
            mdrake-Oracle
            Are you referring to xdbconfig.xsd or xdbConfig.xml

            xdbConfig.xsd is the XMLSchema that defines the structure for the xdb configuarion file xdbconfig.xml

            You can view the structure of the XML Schema it but you CANNOT modify it.

            It can be found in the reposiitory under the following path
            select * from xmltable('fn:doc("/sys/schemas/PUBLIC/xmlns.oracle.com/xdb/xdbconfig.xsd")')
            or accessed via the ALL_XML_SCHEMAS view
            select schema
              from ALL_XML_SCHEMAS
             where SCHEMA_URL = 'http://xmlns.oracle.com/xdb/xdbconfig.xsd'
            xdbconfig.xml is the configuration document, it is an instance of the type defined by xdbconfig.xsd

            You can modify this document a number of ways..

            The document can be found in the repository
            select * from xmltable('fn:doc("/xdbconfig.xml")')
            or
            select object_value
              from XDB.XDB$CONFIG
            or
             
            select DBMS_XDB.CFG_GET() 
             from DUAL
            This document can be updated...

            The preferred way of updating it is to use the specific helper functions provided on DBMS_XDB (Note that these functions will start to be migrated to a new package DBMS_XDB_CONFIG in the near future).

            It is also possible to update it using the following methods

            In PL/SQL by using DBMS_XDB.CFG_GET() to read the document into a PL/SQL variable, updateXML etc or XMLQUery or DBMS_XMLDOM to update the in-memory copy and then DBMS_XDB.CFG_UPDATE() to update the configuration file
             procedure setAnonymousAccess(P_STATE VARCHAR2)
            is
              V_XDB_CONFIG XMLType;
            begin
              V_XDB_CONFIG := dbms_xdb.cfg_get();
              if (V_XDB_CONFIG.existsNode('/xdbconfig/sysconfig/protocolconfig/httpconfig/allow-repository-anonymous-access') = 0) then
                select insertChildXML
                       (
                             V_XDB_CONFIG,
                             '/xdbconfig/sysconfig/protocolconfig/httpconfig',
                             'allow-repository-anonymous-access',
                             XMLType('<allow-repository-anonymous-access xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">' || lower(P_STATE) || '</allow-repository-anonymous-access>'),
                             'xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"'
                           )
                  into V_XDB_CONFIG
                  from dual;
              else
                select updateXML
                       (
                         V_XDB_CONFIG,
                         '/xdbconfig/sysconfig/protocolconfig/httpconfig/allow-repository-anonymous-access/text()',
                         lower(P_STATE),
                         'xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"'
                       )
                  into V_XDB_CONFIG
                  from dual;
              end if;
            
              dbms_xdb.cfg_update(V_XDB_CONFIG);
            end;
            --
            In theory you can also perform SQL operations on XDB.XDB$CONFIG, use WebDav to open and edit the document in an DAV enabled XML Editor, or use FTP to unload the document from the repository, edit it by hand and then upload the new copy.

            In general if a helper function exists on DBMS_XDB (or DBMS_XDB_CONFIG) then this is the preferred mechansim.

            WHat are you trying to do