Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Deploying XML fragments into DB
rpchris
I am trying to use DataDeploy to deploy XMLfragments into DB2. I am able to deploy attribute data and element data only if it is a leaf node. If the element node contains children, then the column in the database is null.
For example this works, and I get "John Smith" in the database
<person>
John Smith
</person>
But this puts null into the database
<person>
<firstname>
John
</firstname>
<lastname>
Smith
</lastname>
</person>
What I want to deploy is the XML fragment for the node. So I would need the following in the DB column:
<firstname>John</firstname><lastname>Smith</lastname>
Here is the dbschema file
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<dbschema>
<group name="MyContent" root-group="yes">
<attrmap>
<column name="ID" data-type="VARCHAR(30)" value-from-element="MyContent/0/Identifier/0" allows-null="no"/>
<column name="OWNER" data-type="VARCHAR(300)" value-from-element="MyContent/0/person/0" allows-null="yes"/>
</attrmap>
<keys>
<primary-key>
<key-column name="ID"/>
</primary-key>
</keys>
</group>
</dbschema>
Any ideas what I am missing here?
Find more posts tagged with
Comments
Migrateduser
You would need to add the appropriate elements, something like:
<column name="OWNER" data-type="VARCHAR(300)" value-from-element="MyContent/0/person/0/firstname" allows-null="yes"/>
etc...
Use the DDUI and map the DTD to a dbschema for error free mapping
or use the CLT iwsyncdb.ipl -dbschemagen -dtdfile .. option (available only since DD5.6)
rpchris
It seems to me that your suggestion would put the firstname data into the database column "OWNER". This isn't really what I am looking for. I am wanting the text "<firstname>John</firstname><lastname>Smith</lastname>" to be put in the database column "OWNER"
Due to the size and complexity of our DTDs, I do not want to create columns in the database for every attribute and element created by the templating. I want DataDeploy to store most of the data as XML fragments within the database.
Migrateduser
DD does not support deploying XML fragments.
Adam Stoller
Would it be possible for you to have your data transformed so that it looked more like (assuming that this doesn't get rendered here):
<owner><firstname>John</firstname><lastname>Smith</lastname></owner>
Then you could just map owner to owner and, if needed, re-decode the data when you extract it.
Just a thought.
--fish
(Interwoven Senior Technical Consultant)