Hawkansson
01-09-2017, 07:15 AM
Hi again,
I have written some macros to add or delete a table row. Each cell in the row contains a content control of some sort which automatically gets mapped to my custom xml. For example the structure could look like this in the example of a two row table:
<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
<Protocol xmlns='My_Xml'>"
<TableRow>
<Cell1></Cell1>
<Cell2></Cell2>
<Cell3></Cell3>
</TableRow>
<TableRow>
<Cell1></Cell1>
<Cell2></Cell2>
<Cell3></Cell3>
</TableRow>
</Protocol>
The resulting Xpaths of the CCs in above mentioned cells becomes like this:
/ns0:Protocol/ns0:TableRow[1]/ns0:Cell1[1]
/ns0:Protocol/ns0:TableRow[1]/ns0:Cell2[1]
/ns0:Protocol/ns0:TableRow[1]/ns0:Cell3[1]
/ns0:Protocol/ns0:TableRow[2]/ns0:Cell1[1]
/ns0:Protocol/ns0:TableRow[2]/ns0:Cell2[1]
/ns0:Protocol/ns0:TableRow[2]/ns0:Cell3[1]
Further on I have copied the mapped CCs to several occurances through out the document. Now let's say that I delete table row 1 and also the corresponding node /ns0:Protocol/ns0:TableRow[1] . Then the node which was previously /ns0:Protocol/ns0:TableRow[2] now automatically gets renumbered as /ns0:Protocol/ns0:TableRow[1] .
This messes up my document. The CCs mapped to /ns0:Protocol/ns0:TableRow[2] still points at that node, but it doesn't exist in the xml. The content controls mapped to /ns0:Protocol/ns0:TableRow[1] keeps that Xpath, but now points at the values that was originally in the second row.
I thought that if I deleted the node /ns0:Protocol/ns0:TableRow[1] , the CCs mapped to that node would loose its mapping, and all CCs mapped to /ns0:Protocol/ns0:TableRow[2] would get renumbered to /ns0:Protocol/ns0:TableRow[1] .
Do you have any suggestions on how I could solve this? Is there a better way in implementing my xml? Is there any procedures to remap the content controls in case of a node deletion?
Best regards,
David
I have written some macros to add or delete a table row. Each cell in the row contains a content control of some sort which automatically gets mapped to my custom xml. For example the structure could look like this in the example of a two row table:
<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
<Protocol xmlns='My_Xml'>"
<TableRow>
<Cell1></Cell1>
<Cell2></Cell2>
<Cell3></Cell3>
</TableRow>
<TableRow>
<Cell1></Cell1>
<Cell2></Cell2>
<Cell3></Cell3>
</TableRow>
</Protocol>
The resulting Xpaths of the CCs in above mentioned cells becomes like this:
/ns0:Protocol/ns0:TableRow[1]/ns0:Cell1[1]
/ns0:Protocol/ns0:TableRow[1]/ns0:Cell2[1]
/ns0:Protocol/ns0:TableRow[1]/ns0:Cell3[1]
/ns0:Protocol/ns0:TableRow[2]/ns0:Cell1[1]
/ns0:Protocol/ns0:TableRow[2]/ns0:Cell2[1]
/ns0:Protocol/ns0:TableRow[2]/ns0:Cell3[1]
Further on I have copied the mapped CCs to several occurances through out the document. Now let's say that I delete table row 1 and also the corresponding node /ns0:Protocol/ns0:TableRow[1] . Then the node which was previously /ns0:Protocol/ns0:TableRow[2] now automatically gets renumbered as /ns0:Protocol/ns0:TableRow[1] .
This messes up my document. The CCs mapped to /ns0:Protocol/ns0:TableRow[2] still points at that node, but it doesn't exist in the xml. The content controls mapped to /ns0:Protocol/ns0:TableRow[1] keeps that Xpath, but now points at the values that was originally in the second row.
I thought that if I deleted the node /ns0:Protocol/ns0:TableRow[1] , the CCs mapped to that node would loose its mapping, and all CCs mapped to /ns0:Protocol/ns0:TableRow[2] would get renumbered to /ns0:Protocol/ns0:TableRow[1] .
Do you have any suggestions on how I could solve this? Is there a better way in implementing my xml? Is there any procedures to remap the content controls in case of a node deletion?
Best regards,
David