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

Re: [xml-dbms] Re: Empty XML Elements

Expand Messages
  • Ronald Bourret
    Actually, InlineMap elements are what you want: 1) In the ClassMap for testxml, add an InlineMap element for indentOne. 2) In the InlineMap element for
    Message 1 of 7 , Jul 27, 2005
      Actually, InlineMap elements are what you want:

      1) In the ClassMap for testxml, add an InlineMap element for indentOne.

      2) In the InlineMap element for indentOne, add a RelatedClass element
      for groupTwo.

      3) Add a ClassMap for groupTwo.

      Empty elements are those that have no content, such as <foo/>. There is
      an option that you can treat these as empty strings or as nulls.

      -- Ron

      sctt_bainbridge wrote:
      > I had a look at the inLineMap element which seems to be close but no
      > cigar... the problem is that I want the following items to go into
      > each table:
      >
      > Table One:
      > - itemOne
      > - itemTwo
      >
      > Table Two:
      > - itemThree
      > - itemFour
      >
      > Table Three:
      > - itemFive
      > - itemSix
      >
      > there will be many to one relationships here, that is Table Two and
      > Table Three can have a number of records for one entry in Table One
      > (and this works fine with all the primary and forign keys).
      >
      > So if I flatten the structure it works, put not if I encase elemnts
      > within others. The InlineMap element seems not to be what I want...
      >
      > Again I am using V2.
      >
      >
      > Thanks,
      >
      >
      >
      > Scott.
      >
      > --- In xml-dbms@yahoogroups.com, "sctt_bainbridge"
      > <s.bainbridge@a...> wrote:
      >
      >>Hi,
      >>
      >>I think this is a known thing but hope you can help. I am getting
      >>pretty good at the map files and so on but find that if I try and
      >
      > do
      >
      >>the following:
      >>
      >><testxml>
      >> <itemOne>One</itemOne>
      >> <itemTwo>Two</itemTwo>
      >> <groupOne>
      >> <itemThree>Three</itemThree>
      >> <itemFour>Four</itemFour>
      >> </groupOne>
      >> <indentOne>
      >> <groupTwo>
      >> <itemFive>Five</itemFive>
      >> <itemSix>Six</itemSix>
      >> </groupTwo>
      >> </indentOne>
      >></testxml>
      >>
      >>I can't 'see' the <groupTwo> object (using V2), if I remove
      >>the 'empty' XML object <indentOne> and use the scheme below it
      >
      > works.
      >
      >>
      >><testxml>
      >> <itemOne>One</itemOne>
      >> <itemTwo>Two</itemTwo>
      >> <groupOne>
      >> <itemThree>Three</itemThree>
      >> <itemFour>Four</itemFour>
      >> </groupOne>
      >> <groupTwo>
      >> <itemFive>Five</itemFive>
      >> <itemSix>Six</itemSix>
      >> </groupTwo>
      >></testxml>
      >>
      >>So this works and it 'sees' the <groupTwo> object. I have seen a
      >
      > few
      >
      >>references to 'empty' objects so am hoping that it is an easy fix.
      >
      > I
      >
      >>can send you all the details if you want but am hoping that it is
      >
      > an
      >
      >>easy one!
      >>
      >>
      >>Thanks,
      >>
      >>
      >>Scott.
      >
      >
      >
      >
      >
      >
      > To post a message, send it to: xml-dbms@yahoogroups.com
      > To unsubscribe, send a blank message to: xml-dbms-unsubscribe@yahoogroups.com
      > Yahoo! Groups Links
      >
      >
      >
      >
      >
      >
      >
      >
    • sctt_bainbridge
      Thanks, I will try this tonight (my time). SCott. ... indentOne. ... element ... There is ... but no ... into ... and ... One ... elemnts ... want... ...
      Message 2 of 7 , Jul 27, 2005
        Thanks, I will try this tonight (my time).

        SCott.
        --- In xml-dbms@yahoogroups.com, Ronald Bourret <rpbourret@r...>
        wrote:
        > Actually, InlineMap elements are what you want:
        >
        > 1) In the ClassMap for testxml, add an InlineMap element for
        indentOne.
        >
        > 2) In the InlineMap element for indentOne, add a RelatedClass
        element
        > for groupTwo.
        >
        > 3) Add a ClassMap for groupTwo.
        >
        > Empty elements are those that have no content, such as <foo/>.
        There is
        > an option that you can treat these as empty strings or as nulls.
        >
        > -- Ron
        >
        > sctt_bainbridge wrote:
        > > I had a look at the inLineMap element which seems to be close
        but no
        > > cigar... the problem is that I want the following items to go
        into
        > > each table:
        > >
        > > Table One:
        > > - itemOne
        > > - itemTwo
        > >
        > > Table Two:
        > > - itemThree
        > > - itemFour
        > >
        > > Table Three:
        > > - itemFive
        > > - itemSix
        > >
        > > there will be many to one relationships here, that is Table Two
        and
        > > Table Three can have a number of records for one entry in Table
        One
        > > (and this works fine with all the primary and forign keys).
        > >
        > > So if I flatten the structure it works, put not if I encase
        elemnts
        > > within others. The InlineMap element seems not to be what I
        want...
        > >
        > > Again I am using V2.
        > >
        > >
        > > Thanks,
        > >
        > >
        > >
        > > Scott.
        > >
        > > --- In xml-dbms@yahoogroups.com, "sctt_bainbridge"
        > > <s.bainbridge@a...> wrote:
        > >
        > >>Hi,
        > >>
        > >>I think this is a known thing but hope you can help. I am
        getting
        > >>pretty good at the map files and so on but find that if I try
        and
        > >
        > > do
        > >
        > >>the following:
        > >>
        > >><testxml>
        > >> <itemOne>One</itemOne>
        > >> <itemTwo>Two</itemTwo>
        > >> <groupOne>
        > >> <itemThree>Three</itemThree>
        > >> <itemFour>Four</itemFour>
        > >> </groupOne>
        > >> <indentOne>
        > >> <groupTwo>
        > >> <itemFive>Five</itemFive>
        > >> <itemSix>Six</itemSix>
        > >> </groupTwo>
        > >> </indentOne>
        > >></testxml>
        > >>
        > >>I can't 'see' the <groupTwo> object (using V2), if I remove
        > >>the 'empty' XML object <indentOne> and use the scheme below it
        > >
        > > works.
        > >
        > >>
        > >><testxml>
        > >> <itemOne>One</itemOne>
        > >> <itemTwo>Two</itemTwo>
        > >> <groupOne>
        > >> <itemThree>Three</itemThree>
        > >> <itemFour>Four</itemFour>
        > >> </groupOne>
        > >> <groupTwo>
        > >> <itemFive>Five</itemFive>
        > >> <itemSix>Six</itemSix>
        > >> </groupTwo>
        > >></testxml>
        > >>
        > >>So this works and it 'sees' the <groupTwo> object. I have seen a
        > >
        > > few
        > >
        > >>references to 'empty' objects so am hoping that it is an easy
        fix.
        > >
        > > I
        > >
        > >>can send you all the details if you want but am hoping that it
        is
        > >
        > > an
        > >
        > >>easy one!
        > >>
        > >>
        > >>Thanks,
        > >>
        > >>
        > >>Scott.
        > >
        > >
        > >
        > >
        > >
        > >
        > > To post a message, send it to: xml-dbms@yahoogroups.com
        > > To unsubscribe, send a blank message to: xml-dbms-
        unsubscribe@yahoogroups.com
        > > Yahoo! Groups Links
        > >
        > >
        > >
        > >
        > >
        > >
        > >
        > >
      • sctt_bainbridge
        Hi, I tried this but I am a bit confused as to where to put the InlineMap element... using the example xml structure my map file ...
        Message 3 of 7 , Jul 28, 2005
          Hi,

          I tried this but I am a bit confused as to where to put the
          InlineMap element... using the example xml structure my map file
          would be like:
          -------------------
          <?xml version='1.0' ?>

          <!DOCTYPE XMLToDBMS SYSTEM "xmldbms2.dtd" >

          <XMLToDBMS Version="2.0"
          xmlns="http://www.xmlmiddleware.org/xmldbms/v2">
          <Options>
          <SimpleDateFormat Pattern="yyyy-MM-dd"
          DefaultForTypes="DATE" />
          </Options>
          <Databases>
          <Database>
          <Catalog>
          <Schema>
          <Table Name="TABLE_ONE">
          <Column Name="ITEM_ONE" DataType="VARCHAR"
          Length="50" Nullable="Yes"/>
          <Column Name="ITEM_TWO" DataType="VARCHAR"
          Length="50" Nullable="Yes"/>
          </Table>
          <Table Name="TABLE_TWO">
          <Column Name="ITEM_THREE" DataType="VARCHAR"
          Length="50" Nullable="Yes"/>
          <Column Name="ITEM_FOUR" DataType="VARCHAR"
          Length="50" Nullable="Yes"/>
          </Table>
          <Table Name="TABLE_THREE">
          <Column Name="ITEM_FIVE" DataType="VARCHAR"
          Length="50" Nullable="Yes"/>
          <Column Name="ITEM_SIX" DataType="VARCHAR"
          Length="50" Nullable="Yes"/>
          </Table>
          </Schema>
          </Catalog>
          </Database>
          </Databases>
          <Maps>
          <ClassMap>
          <ElementType Name="testxml"/>
          <ToClassTable Name="TABLE_ONE"/>
          <PropertyMap>
          <ElementType Name="itemOne"/>
          <ToColumn Name="ITEM_ONE"/>
          </PropertyMap>
          <PropertyMap>
          <ElementType Name="itemTwo"/>
          <ToColumn Name="ITEM_TWO"/>
          </PropertyMap>
          <RelatedClass KeyInParentTable="Unique">
          <ElementType Name="groupOne"/>
          <UseUniqueKey Name="whatever"/>
          <UseForeignKey Name="whatever"/>
          </RelatedClass>
          </ClassMap>
          <ClassMap>
          <ElementType Name="groupOne"/>
          <ToClassTable Name="TABLE_TWO"/>
          <PropertyMap>
          <ElementType Name="itemThree"/>
          <ToColumn Name="ITEM_THREE"/>
          </PropertyMap>
          <PropertyMap>
          <ElementType Name="itemFour"/>
          <ToColumn Name="ITEM_FOUR"/>
          </PropertyMap>
          </ClassMap>
          <ClassMap>
          <ElementType Name="groupTwo"/>
          <ToClassTable Name="TABLE_THREE"/>
          <PropertyMap>
          <ElementType Name="itemFive"/>
          <ToColumn Name="ITEM_FIVE"/>
          </PropertyMap>
          <PropertyMap>
          <ElementType Name="itemSix"/>
          <ToColumn Name="ITEM_SIX"/>
          </PropertyMap>
          </ClassMap>
          </Maps>
          </XMLToDBMS>

          -------------------

          As <indentOne> maps to nothing how do I include this in the
          ClassMap's?? Can you show me where the InLineMap elements would go??

          Again many thanks,


          Scott.

          --- In xml-dbms@yahoogroups.com, "sctt_bainbridge"
          <s.bainbridge@a...> wrote:
          > Thanks, I will try this tonight (my time).
          >
          > SCott.
          > --- In xml-dbms@yahoogroups.com, Ronald Bourret <rpbourret@r...>
          > wrote:
          > > Actually, InlineMap elements are what you want:
          > >
          > > 1) In the ClassMap for testxml, add an InlineMap element for
          > indentOne.
          > >
          > > 2) In the InlineMap element for indentOne, add a RelatedClass
          > element
          > > for groupTwo.
          > >
          > > 3) Add a ClassMap for groupTwo.
          > >
          > > Empty elements are those that have no content, such as <foo/>.
          > There is
          > > an option that you can treat these as empty strings or as nulls.
          > >
          > > -- Ron
          > >
          > > sctt_bainbridge wrote:
          > > > I had a look at the inLineMap element which seems to be close
          > but no
          > > > cigar... the problem is that I want the following items to go
          > into
          > > > each table:
          > > >
          > > > Table One:
          > > > - itemOne
          > > > - itemTwo
          > > >
          > > > Table Two:
          > > > - itemThree
          > > > - itemFour
          > > >
          > > > Table Three:
          > > > - itemFive
          > > > - itemSix
          > > >
          > > > there will be many to one relationships here, that is Table
          Two
          > and
          > > > Table Three can have a number of records for one entry in
          Table
          > One
          > > > (and this works fine with all the primary and forign keys).
          > > >
          > > > So if I flatten the structure it works, put not if I encase
          > elemnts
          > > > within others. The InlineMap element seems not to be what I
          > want...
          > > >
          > > > Again I am using V2.
          > > >
          > > >
          > > > Thanks,
          > > >
          > > >
          > > >
          > > > Scott.
          > > >
          > > > --- In xml-dbms@yahoogroups.com, "sctt_bainbridge"
          > > > <s.bainbridge@a...> wrote:
          > > >
          > > >>Hi,
          > > >>
          > > >>I think this is a known thing but hope you can help. I am
          > getting
          > > >>pretty good at the map files and so on but find that if I try
          > and
          > > >
          > > > do
          > > >
          > > >>the following:
          > > >>
          > > >><testxml>
          > > >> <itemOne>One</itemOne>
          > > >> <itemTwo>Two</itemTwo>
          > > >> <groupOne>
          > > >> <itemThree>Three</itemThree>
          > > >> <itemFour>Four</itemFour>
          > > >> </groupOne>
          > > >> <indentOne>
          > > >> <groupTwo>
          > > >> <itemFive>Five</itemFive>
          > > >> <itemSix>Six</itemSix>
          > > >> </groupTwo>
          > > >> </indentOne>
          > > >></testxml>
          > > >>
          > > >>I can't 'see' the <groupTwo> object (using V2), if I remove
          > > >>the 'empty' XML object <indentOne> and use the scheme below it
          > > >
          > > > works.
          > > >
          > > >>
          > > >><testxml>
          > > >> <itemOne>One</itemOne>
          > > >> <itemTwo>Two</itemTwo>
          > > >> <groupOne>
          > > >> <itemThree>Three</itemThree>
          > > >> <itemFour>Four</itemFour>
          > > >> </groupOne>
          > > >> <groupTwo>
          > > >> <itemFive>Five</itemFive>
          > > >> <itemSix>Six</itemSix>
          > > >> </groupTwo>
          > > >></testxml>
          > > >>
          > > >>So this works and it 'sees' the <groupTwo> object. I have seen
          a
          > > >
          > > > few
          > > >
          > > >>references to 'empty' objects so am hoping that it is an easy
          > fix.
          > > >
          > > > I
          > > >
          > > >>can send you all the details if you want but am hoping that it
          > is
          > > >
          > > > an
          > > >
          > > >>easy one!
          > > >>
          > > >>
          > > >>Thanks,
          > > >>
          > > >>
          > > >>Scott.
          > > >
          > > >
          > > >
          > > >
          > > >
          > > >
          > > > To post a message, send it to: xml-dbms@yahoogroups.com
          > > > To unsubscribe, send a blank message to: xml-dbms-
          > unsubscribe@yahoogroups.com
          > > > Yahoo! Groups Links
          > > >
          > > >
          > > >
          > > >
          > > >
          > > >
          > > >
          > > >
        • Ronald Bourret
          After the PropertyMap elements and before the RelatedClass element in the ClassMap for testxml:
          Message 4 of 7 , Jul 28, 2005
            After the PropertyMap elements and before the RelatedClass element in
            the ClassMap for testxml:

            <ClassMap>
            <ElementType Name="testxml"/>
            <ToClassTable Name="TABLE_ONE"/>
            <PropertyMap>
            <ElementType Name="itemOne"/>
            <ToColumn Name="ITEM_ONE"/>
            </PropertyMap>
            <PropertyMap>
            <ElementType Name="itemTwo"/>
            <ToColumn Name="ITEM_TWO"/>
            </PropertyMap>
            <InlineMap>
            <ElementType Name="indentOne" />
            ...
            </InlineMap>
            <RelatedClass KeyInParentTable="Unique">
            <ElementType Name="groupOne"/>
            <UseUniqueKey Name="whatever"/>
            <UseForeignKey Name="whatever"/>
            </RelatedClass>
            </ClassMap>

            For more information, see xmldbms2.dtd in the dtds subdirectory and:

            http://groups.yahoo.com/group/xml-dbms/message/3345

            On the conceptual level, it's worth noting that the InlineMap element is
            a cross between a PropertyMap (it has order children) and a ClassMap (it
            has property map, inline map, and related class children). The
            commonality with property maps makes sense because an inlined element
            may occur in a particular position in a content model, just like a
            property element. The commonality with class maps makes sense because an
            inlined element can have children / attributes that are treated in the
            same way as children / attributes of a class element (i.e. as
            properties, related classes, or inlined elements).

            -- Ron

            sctt_bainbridge wrote:
            > Hi,
            >
            > I tried this but I am a bit confused as to where to put the
            > InlineMap element... using the example xml structure my map file
            > would be like:
          • sctt_bainbridge
            Hi, I worked it out and it works a treat, again many thanks! Scott. ... in ... element is ... ClassMap (it ... element ... because an ... the
            Message 5 of 7 , Jul 30, 2005
              Hi,

              I worked it out and it works a treat, again many thanks!


              Scott.

              --- In xml-dbms@yahoogroups.com, Ronald Bourret <rpbourret@r...>
              wrote:
              > After the PropertyMap elements and before the RelatedClass element
              in
              > the ClassMap for testxml:
              >
              > <ClassMap>
              > <ElementType Name="testxml"/>
              > <ToClassTable Name="TABLE_ONE"/>
              > <PropertyMap>
              > <ElementType Name="itemOne"/>
              > <ToColumn Name="ITEM_ONE"/>
              > </PropertyMap>
              > <PropertyMap>
              > <ElementType Name="itemTwo"/>
              > <ToColumn Name="ITEM_TWO"/>
              > </PropertyMap>
              > <InlineMap>
              > <ElementType Name="indentOne" />
              > ...
              > </InlineMap>
              > <RelatedClass KeyInParentTable="Unique">
              > <ElementType Name="groupOne"/>
              > <UseUniqueKey Name="whatever"/>
              > <UseForeignKey Name="whatever"/>
              > </RelatedClass>
              > </ClassMap>
              >
              > For more information, see xmldbms2.dtd in the dtds subdirectory
              and:
              >
              > http://groups.yahoo.com/group/xml-dbms/message/3345
              >
              > On the conceptual level, it's worth noting that the InlineMap
              element is
              > a cross between a PropertyMap (it has order children) and a
              ClassMap (it
              > has property map, inline map, and related class children). The
              > commonality with property maps makes sense because an inlined
              element
              > may occur in a particular position in a content model, just like a
              > property element. The commonality with class maps makes sense
              because an
              > inlined element can have children / attributes that are treated in
              the
              > same way as children / attributes of a class element (i.e. as
              > properties, related classes, or inlined elements).
              >
              > -- Ron
              >
              > sctt_bainbridge wrote:
              > > Hi,
              > >
              > > I tried this but I am a bit confused as to where to put the
              > > InlineMap element... using the example xml structure my map file
              > > would be like:
            Your message has been successfully submitted and would be delivered to recipients shortly.