LoadRunner Support Forum
Showing results for 
Search instead for 
Do you mean 

Getting extra symbol while inserting multiple attributes in XML

Highlighted
Occasional Visitor

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

 

1 REPLIES
Valued Contributor

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