Highlighted
PulkitSharva Absent Member.
Absent Member.
498 views

Getting extra symbol while inserting multiple attributes in XML

Hi All,

 

I am trying to update a xml by inserting multiple attribute in an element. It all works fine if only 1 attribute is inserted

 

char *input="<a><b value1=\"45\"><c></c></b></a>";
    lr_save_string(input,"Input");
    lr_xml_insert("XML={Input}", "ResultParam=Result", 
               "Query=/a/b",
                "Position=attribute",               
               "XmlFragmentParam=extension=\"4444\""",

               LAST );

 

Output: <a><b extension="4444" value1="45"><c/></b></a>

 

But when I try to insert multiple attribute it is giving me unwanted symbols

 

char *input="<a><b value1=\"45\"><c></c></b></a>";
    lr_save_string(input,"Input");
    lr_xml_insert("XML={Input}", "ResultParam=Result", 
               "Query=/a/b",
                "Position=attribute",               
               "XmlFragmentParam=extension=\"4444\"  extension1="23"",

 

               LAST );

 

 

 

Output: <a><b extension="4444&quot; extension1=&quot;23" value1="45"><c/></b></a>

 

 

 

Can anyone help me out in this one?

 

 

P.S. This thread has been moved from Community Feedback & Suggestions to LoadRunner Support Forum. - HP Forum Moderator

 

Tags (1)
0 Likes
1 Reply
Established Member.. espavankumar
Established Member..

Re: Getting extra symbol while inserting multiple attributes in XML

char *input="<a><b value1=\"45\"><c></c></b></a>";
    lr_save_string(input,"Input");
    
    lr_xml_insert("XML={Input}""ResultParam=Input"
               "Query=/a/b",
               "Position=attribute",               
               "XmlFragment=extension=\"4444\""
               LAST );
    
    lr_xml_insert("XML={Input}""ResultParam=Result"
               "Query=/a/b",
               "Position=attribute",               
               "XmlFragment=extension1=\"23\""
               LAST );
    lr_output_message(lr_eval_string("{Result}"));

Pavankumar
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.