Re: Getting extra symbol while inserting multiple attributes in XML (113 Views)
Reply
Occasional Visitor
PulkitSharva
Posts: 1
Registered: ‎11-18-2013
Message 1 of 2 (135 Views)

Getting extra symbol while inserting multiple attributes in XML

[ Edited ]

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

 

Valued Contributor
espavankumar
Posts: 57
Registered: ‎08-17-2011
Message 2 of 2 (113 Views)

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
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.