You can use annotations in the mapping file to extract data. The annotations are typically used in query or value tags. You can derive any field in the input XML using direct values or annotated values.
You can group annotations into a relative annotation path and an absolute annotation path.
Example: Use a Relative Annotation Path
In this example, when the annotation is processed, the XML assigns the value of the ProcCount column to No. of Processors. The column value is derived using the query in the group name System tag. The generated XML will have the No. of Processors value derived by querying the database using the query attribute of the Group Name System tag. The value is directly relative to the parent tag query.
<asset query="select AssetID from Computer" translator="ACBsFmt" version="1_0">
<general> ... </general> <hardware> <group name="GeneralInventory">
<group name="System" query="select p.ProcCount from Computer c where c.AssetID = {asset.AssetID}">
<attribute name="No. of Processors" type="string" value="{group(name='System').ProcCount}"/>
</group> </group> </hardware> ...
</asset>
Example: Use an Absolute Annotation Path
<asset query="select AssetID from Computer" translator="ACBsFmt" version="1_0">
<general> ... </general> <hardware>
<group name="GeneralInventory">
<group name="System" query="select p.ProcCount from Computer c where c.AssetID = {asset.AssetID}">
<attribute name="No. of Processors" type="string" value="{asset:hardware:group(name='GeneralInventory'):group(name='System').ProcCount}"/>
</group>
</group> </hardware> ...
</asset>
|
Copyright © 2013 CA.
All rights reserved.
|
|