Hello,
Yes, you can use the InlineMap element for this.
For example, the ClassMap element for storedHU would look something like
this:
<ClassMap>
<ElementType Name="storedHU" />
<ToClassTable Name="STOREDHUTABLE" />
... PropertyMap elements for lastSaved, creator, method, version ...
<InlineMap>
<ElementType Name="dataSources" />
<RelatedClass KeyInParentTable="Unique">
<ElementType Name="dataSource" />
<UseUniqueKey Name="..." />
<UseForeignKey Name="..." />
</RelatedClass>
</InlineMap>
<RelatedClass KeyInParentTable="Unique">
<ElementType Name="hermUnit" />
<UseUniqueKey Name="..." />
<UseForeignKey Name="..." />
</RelatedClass>
</ClassMap>
The InlineMap element tells XML-DBMS to ignore the dataSources element
and treat its children and attributes as if they were part of the
storedHU element. This would be the same as mapping the following XML:
<storedHU ...other attributes... size="2" >
<hermUnit ...other attributes... />
<coAuthors>
<coAuthor name="coAuthor1"></coAuthor>
</coAuthors>
<dataSource id="1" loc="..." mime="..." />
<dataSource id="2" loc="..." mime="..." />
...
Notes:
1) The dataSources/@size attribute is treated as if it were an attribute
of storedHU. If you wanted to map it to a column in the STOREDHUTABLE,
you would do this with a PropertyMap element inside the InlineMap element.
2) You can also use the InlineMap element to ignore the coAuthors element.
3) You will need a ClassMap element for the dataSource element.
Hope this helps,
-- Ron
Ruchika Israni wrote:
> Hi Ron,
>
> I want to skip certain elements in my xml because they do not correspond to
any structure in the database and map the child to a table in the database. I am
not sure whether or not that can be done with the InlineMap tag. Here is the
partial structure of my xml :
> ************************************************************
> <?xml version="1.0" encoding="utf-8" ?>
> <storedHU xmlns:aml="http://www.atlasti.com/hu/ns2003"
> lastSaved="2008-09-15T14:28:34" creator="ATLAS.ti" method="AML (ATLAS Markup
Language)" version="WIN 5.2 (Build 0)">
>
> <hermUnit name="masterFLOSSFireandGaimHU09072008" au="Super"
cdate="2007-06-18T20:20:52" mdate="2008-09-08T22:36:17" lastPD="816"
prot="private" />
> <coAuthors>
> <coAuthor name="coAuthor1">
> </coAuthor>
> </coAuthors>
>
> <dataSources size="2" >
> <dataSource id="1"
loc="<HUPATH>\FLOSS\Docs\gaim-sample\gaim-2004-06-23-18-10-00-37-3216.txt"
mime="text/plain" />
> <dataSource id="2"
loc="<HUPATH>\FLOSS\Docs\gaim-sample\gaim-2006-01-26-04-30-00-37-7064.txt"
mime="text/plain" />
> </dataSources>
> **************************************************************
>
> In the above xml, storedHU and hermUnit correspond to their respective tables.
There is no table corresponding to the dataSources element however, I want to
insert data into the datasource table in the database. Is there any way by which
this can be done? I went through the FAQs and related posts in the group and
accordingly tried to play around with the <InlineMap> tag. However, no avail.
>
> Any help in this regard would be appreciated.
>
> Many thanks in anticipation.
>
> Ruchika Israni
>
>
>
> ------------------------------------
>
> To post a message, send it to: xml-dbms@yahoogroups.com
> To unsubscribe, send a blank message to:
xml-dbms-unsubscribe@...! Groups Links
>
>
>
>
>
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.339 / Virus Database: 270.12.40/2135 - Release Date: 05/26/09
08:53:00
>