Strange encoding behavior when adding a value to a xelement

4 weeks ago 32
ARTICLE AD BOX

I have the following payload, in which I need to parse a value in the format of an HTML link at a specific location. However, the HTML link must appear between “<” and “>”.

<?xml version="1.0"?> <rdf:RDF mlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:jfs="http://jazz.net/xmlns/foundation/1.0/" xmlns:rrm="http://www.ibm.com/xmlns/rrm/1.0/" xmlns:rrmNav="http://com.ibm.rdm/navigation#" xmlns:pref="http://jazz.net/xmlns/alm/rm/Preference/" xmlns:rmTypes="http://www.ibm.com/xmlns/rdm/types/" xmlns:rmWorkflow="http://www.ibm.com/xmlns/rdm/workflow/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:h="http://www.w3.org/TR/REC-html40" xmlns:rmReqIF="http://www.ibm.com/xmlns/rdm/reqif/" xmlns:rql="http://www.ibm.com/xmlns/rdm/rql/" xmlns:xs="http://schema.w3.org/xs/" xmlns:rrmMulti="http://com.ibm.rdm/multi-request#" xmlns:rm="http://www.ibm.com/xmlns/rdm/rdf/" xmlns:rrmViewdata="http://com.ibm.rdm/viewdata#"> <rm:View rdf:about=""> <rm:rowquery rdf:parseType="Resource"> <rql:select rdf:parseType="Resource"> <rdf:_1 rdf:parseType="Resource"> <rql:object>R1</rql:object> </rdf:_1> </rql:select> <rql:where rdf:parseType="Resource"> <rdf:_1 rdf:parseType="Resource"> <rql:op>=</rql:op> <rql:e1 rdf:parseType="Resource"> <rql:field rdf:resource="http://www.ibm.com/xmlns/rdm/rdf/module"/> <rql:object>R1</rql:object> </rql:e1> <rql:e2></rql:e2> </rdf:_1> </rql:where> <rql:sort rdf:parseType="Resource"> <rdf:_1 rdf:parseType="Resource"> <rql:objField rdf:parseType="Resource"> <rql:field rdf:resource="http://www.ibm.com/xmlns/rdm/rdf/bookOrder"/> <rql:object>R1</rql:object> </rql:objField> <rql:order>asc</rql:order> </rdf:_1> </rql:sort> </rm:rowquery> <rrmNav:scope>public</rrmNav:scope> <rm:ofType>GridView</rm:ofType> <dcterms:description></dcterms:description> <dcterms:title>Grid View 1</dcterms:title> </rm:View> </rdf:RDF>

Now I want to write the link after <rql:e2> in the WHERE element.

To do this, I parse the element as follows:

Dim ModNode = _PayloadModContent.Descendants(_DsxKeyContainer.MyNamespace("rql") + "where").Elements(_DsxKeyContainer.MyNamespace("rdf") + "_1").Elements(_DsxKeyContainer.MyNamespace("rql") + "e2").FirstOrDefault

Now I set the value:

ModNode.Add(System.Web.HttpUtility.HtmlEncode("<") + "https://my.server.com.io:9444/rm/resources/MD_vZJaEH4sEe6q_p0A0jNIEQ" + System.Web.HttpUtility.HtmlEncode(">"))

I need the following line for beeing accepted on my server:

<rql:e2>&lt;https://my.server.com.io:9444/rm/resources/MD_vZJaEH4sEe6q_p0A0jNIEQ&gt;</rql:e2>

But I got this:

<rql:e2>&amp;lt;https://my.server.com.io:9443/rm/resources/MD_vZJaEH4sEe6q_p0A0jNIEQ&amp;gt;</rql:e2>

What I am doing wrong?

Read Entire Article