Note that there are some explanatory texts on larger screens.

plurals
  1. POPattern based merge help
    primarykey
    data
    text
    <p>Is there a generic approach to data merge an xml file content (a template) with embedded XPath expression to an XmlDocument?</p> <p>As an example, (please note this is just a simple example, i am looking for a generic approach)</p> <p>File:</p> <pre><code>&lt;root xmlns:dt="urn:schemas-microsoft-com:datatypes"&gt; &lt;session email='' alias=''&gt; &lt;state&gt; &lt;action&gt; &lt;attribute in_var="" out_var="" entity_name="entity" query_name="query1"/&gt; &lt;attribute dtype="string" in_var="" name="entity_id" value="$/data/row/entity_id$"/&gt; &lt;/action&gt; &lt;/state&gt; &lt;/session&gt; </code></pre> <p></p> <p>XmlDocument:</p> <pre><code>&lt;data&gt; &lt;row&gt; &lt;entity_id&gt;1&lt;/entity_id&gt; &lt;entity_name&gt;Entity 1&lt;/entity_name&gt; &lt;/row&gt; &lt;row&gt; &lt;entity_id&gt;2&lt;/entity_id&gt; &lt;entity_name&gt;Entity 2&lt;/entity_name&gt; &lt;/row&gt; &lt;/data&gt; </code></pre> <p>After Merge:</p> <pre><code> &lt;root xmlns:dt="urn:schemas-microsoft-com:datatypes"&gt; &lt;session email='' alias=''&gt; &lt;state&gt; &lt;action&gt; &lt;attribute in_var="" out_var="" entity_name="entity" query_name="query1"/&gt; &lt;attribute dtype="string" in_var="" name="entity_id" value="1"/&gt; &lt;/action&gt; &lt;/state&gt; &lt;/session&gt; </code></pre> <p></p> <pre><code> &lt;root xmlns:dt="urn:schemas-microsoft-com:datatypes"&gt; &lt;session email='' alias=''&gt; &lt;state&gt; &lt;action&gt; &lt;attribute in_var="" out_var="" entity_name="entity" query_name="query1"/&gt; &lt;attribute dtype="string" in_var="" name="entity_id" value="2"/&gt; &lt;/action&gt; &lt;/state&gt; &lt;/session&gt; </code></pre> <p></p> <p>I was under the impression that regular expression backreferences can assist in this scenario but I have hit a dead end.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload