none
Getting XPath of Rich text content control RRS feed

  • Question

  • Hello All,

    I understand it is not possible to get the content control XML mapping of a Rich text content control. But is there some way to get atleast the XPath of the element in the Custom XML part that corresponds to a rich text content control in the document?

    I have attached the following custom XML part to the document:

    <List>
    <Item>First item in the list</Item>
    <Item>Second item in the list</Item>
    </List>
    

    In the document, the content controls are inserted as follows:

    The "List" is a rich text CC that contains "Item" plain text CC's. The "Item" plain text CC's are bound to the <Item> elements in the attached XML, and I can get the mapping as follows:

    string itemControlXPath = ItemContentControl.XMLMapping.XPath;
    
    
    

    My questions are as follows:

    1. From this itemControlXPath, how do we get the XPath for the "List" element? 
    2. What if there are no plain text "Item" CC's inside the "List" rich text CC. Is it still possible to get the XPath of the "List" element?

    The situation is this: I am trying to append an attribute to the "List" element in the custom XML part and so need the XPath to the "List" element. When the user enters the "List" content control (event triggered), the XPath is obtained and attribute is appended. Sometimes the "List" element may be empty.

    Please let me know if you require further information...

    Greets


     

    Thursday, November 17, 2011 12:25 PM

Answers