Loading ...
Sorry, an error occurred while loading the content.

Doubt on XML-DBMS retrieve

Expand Messages
  • bhuvaneswari thirumoorthy
    hi, This is Bhuvaneswari from India. I have started working on XML-DBMS from the last week and I found it is very useful for retrieving things from the
    Message 1 of 1 , Apr 6, 2004
    • 0 Attachment
      hi,
      This is Bhuvaneswari from India. I have started
      working on XML-DBMS from the last week and I found it
      is very useful for retrieving things from the existing
      databases.

      I am now in need of some clarifications and will be
      very happy if I get the answers from you.

      1. I am using XML-DBMS Version 2.0 on Windows 2000 and
      JDK1.4 and SQL Server RDBMS.

      2. I have a database 'bsc' which consists of many
      tables. I want to access only one table
      'dir_organisation' and only one column of it, called
      'org_name'.

      3. I tried setting .map, .ftr, .act file like the
      below.

      .act
      ----

      <Actions Version="2.0"
      xmlns="http://www.xmlmiddleware.org/xmldbms/actions/v2">
      <DefaultAction>
      <!--Insert /-->
      <Retrieve/>
      </DefaultAction>
      <Action>
      <ElementType Name="org" />
      <ToColumn Name=object.name/>
      <!--Insert /-->
      <Retrieve/>
      </Action>
      </Actions>

      .ftr
      ----
      <?xml version='1.0' ?>
      <!--
      This sample filters uses a result set built over
      the dir_Organization
      table. It filters the Items table to return only
      the Org
      -->

      <FilterSet Version="2.0"
      xmlns="http://www.xmlmiddleware.org/xmldbms/filters/v2">
      <Options>
      <!--Namespace Prefix="sales" URI =
      "http://www.sales.org/" /-->
      <Wrapper Name="Project" />
      </Options>
      <Filters>
      <Filter>
      <!--ResultSetInfo Table="dir_organization"
      /-->
      <RootFilter>
      <Table Name="dir_organisation" />
      <Where Condition="1 = 1" />
      </RootFilter>
      </Filter>
      </Filters>
      </FilterSet>

      .map
      ----
      <?xml version='1.0' ?>
      <!--
      This sample is roughly equivalent to the version
      1.0 sample
      sales.map. The only real differences are a few
      name changes.
      -->

      <XMLToDBMS Version="2.0"
      xmlns="http://www.xmlmiddleware.org/xmldbms/v2">
      <Options>
      <SimpleDateFormat Pattern="MM.dd.yy"
      DefaultForTypes="DATE" />
      </Options>
      <Databases>
      <Database Name="Default">
      <Catalog>
      <Schema>
      <Table Name="dir_organisation">
      <Column Name="ORG_ID" DataType="FLOAT"
      Nullable="No"/>
      <Column Name="ORG_NAME"
      DataType="VARCHAR" Length="255" Nullable="No"/>
      <Column Name="PARENT_ORG_ID"
      DataType="FLOAT" Nullable="Yes"/>
      <Column Name="ORG_MISSION"
      DataType="VARCHAR" Length="3000" Nullable="Yes"/>
      <Column Name="ORG_VISION"
      DataType="VARCHAR" Length="3000" Nullable="Yes"/>
      <Column Name="ORG_DESC"
      DataType="VARCHAR" Length="3000" Nullable="Yes"/>
      <Column Name="TOPBAR" DataType="VARCHAR"
      Length="100" Nullable="Yes"/>
      <Column Name="ORG_TICKER"
      DataType="VARCHAR" Length="3000" Nullable="Yes"/>
      <Column Name="ORG_INDEX"
      DataType="FLOAT" Nullable="No"/>
      <PrimaryKey KeyGenerator="Database">
      <UseColumn Name="ORG_ID"/>
      </PrimaryKey>
      </Table>
      </Schema>
      </Catalog>
      </Database>
      </Databases>


      <Maps>
      <ClassMap>
      <ElementType Name="org"/>
      <ToClassTable Name="dir_organisation"/>
      <PropertyMap>
      <Attribute Name="UniqueID"/>
      <ToColumn Name="ORG_ID"/>
      </PropertyMap>
      <PropertyMap>
      <Attribute Name="ParentID"/>
      <ToColumn Name="PARENT_ORG_ID"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="object.name"/>
      <ToColumn Name="ORG_NAME"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="notes"/>
      <ToColumn Name="ORG_DESC"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="mission"/>
      <ToColumn Name="ORG_MISSION"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="vision"/>
      <ToColumn Name="ORG_VISION"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="ticker"/>
      <ToColumn Name="ORG_TICKER"/>
      </PropertyMap>
      <PropertyMap>
      <ElementType Name="index"/>
      <ToColumn Name="ORG_INDEX"/>
      </PropertyMap>
      </ClassMap>
      </Maps>
      </XMLToDBMS>

      And, after giving these, I found that I have to
      manually set the actions in 'actions.dtd', and I added
      the things there.

      <!ENTITY % actions "%p;None |
      %p;Insert |
      %p;SoftInsert |
      %p;Update |
      %p;UpdateOrInsert |
      %p;Delete |
      %p;Retrieve |
      %p;SoftDelete">
      <!ELEMENT %p;DefaultAction (%actions;)>
      <!ELEMENT %p;Action (%p;ElementType, (%actions;))>

      <!ELEMENT %p;None EMPTY>
      <!ELEMENT %p;Insert EMPTY>
      <!ELEMENT %p;SoftInsert EMPTY>
      <!ELEMENT %p;Update (%p;All |
      (%p;PCDATA?, (%p;ElementType |
      %p;Attribute)*))>
      <!ELEMENT %p;UpdateOrInsert EMPTY>
      <!ELEMENT %p;Delete EMPTY>
      <!ELEMENT %p;Retrieve EMPTY>
      <!ELEMENT %p;SoftDelete EMPTY>

      And, I changed the coding in retrieveDocument method
      of DBMSToDOM class so as to use the 'Select' statement
      for getting the org_name from dir_organisation. I am
      getting the resultset correctly, and I have given this
      line:

      resultSets.put("object.name",rs1);

      and I have called this method,

      return retrieveDocument(transferInfo, resultSets,
      filterSet, params, rootNode);

      But, when I am using the 'Select' statement, it gives
      the resultset correctly. But after calling
      retrieveDocument, 'doc' is returned as null.

      Can you guide me where I am wrong. Thanks in advance.

      Regds,
      Bhuvaneswari.T.

      =====
      ------------------------------------------
      "Vote;Pay Your Tax;Blame the Nation,Then."
      ------------------------------------------

      __________________________________
      Do you Yahoo!?
      Yahoo! Small Business $15K Web Design Giveaway
      http://promotions.yahoo.com/design_giveaway/
    Your message has been successfully submitted and would be delivered to recipients shortly.