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

lr_xml_set_values (The prefix 'm0' has not been mapped to any URI)

Occasional Visitor

lr_xml_set_values (The prefix 'm0' has not been mapped to any URI)

I have come across a situation where i am trying to set values (lr_xml_set_values) in the xml. In xml i see tags as 

<m0:address1>691 KNOX ROAD 100 E</m0:address1>
<m0:city>Abingdon</m0:city>
<m0:countyName/>
<m0:state>IL</m0:state><m0:zipCode>61410</m0:zipCode>

Code:
lr_xml_set_values("XML={XMLrequest}","ResultParam= XMLrequest",
"Query=//m0:address1",
"ValueParam=Address1", LAST);
Returning error is : The prefix 'm0' has not been mapped to any URI

I tried to subout the colon ":" but still it throws the same error.

lr_xml_set_values("XML={XMLrequest}","ResultParam= XMLrequest",
"Query=//m0\:address1",
"ValueParam=Address1", LAST);

I appreciate any suggestions/workarounds?

5 REPLIES
Frequent Advisor

Re: lr_xml_set_values (The prefix 'm0' has not been mapped to any URI)

Is this because of the :?

if so do you want to try the escape parameter / before the : and try?

Occasional Visitor

Re: lr_xml_set_values (The prefix 'm0' has not been mapped to any URI)

 

Already tried with escape sequence and mentioned in my thread, its not working.

 

Highlighted
HPE Expert

Re: lr_xml_set_values (The prefix 'm0' has not been mapped to any URI)

Hi,

 

The "m0" prefix is the Namespace of this Xml (specifically of the elements it appears on). You cannot just ignore it and infact it makes the Xml in your example not well formed and therefore invalid.

 

Please read about Xml namespaces here:

http://www.w3schools.com/xml/xml_namespaces.asp

 

Thanks,

Boris.

 

Frequent Advisor

Re: lr_xml_set_values (The prefix 'm0' has not been mapped to any URI)

OK ... here is your problem.

its because the naming format m0:xyz is for namespaces in xml.

and you need to intiate your namespace in the Input XML.

Your query will work as in the original try Query =//m0:address1.

 

All you got to do is change the input XML to below:

<root>
<m0:myxml xmlns:m0="http://www.w3.org/TR/html4/">
<m0:address1>691 KNOX ROAD 100 E</m0:address1>
<m0:city>Abingdon</m0:city>
<m0:countyName/>
<m0:state>IL</m0:state><m0:zipCode>61410</m0:zipCode>
</m0:myxml>
</root>

 

Regards,

AJ

Occasional Contributor

Re: lr_xml_set_values (The prefix 'm0' has not been mapped to any URI)

Are you trying to set the value in the output response. If so, click on TREE view button, next click on web service call function in the left panel. On right hand side you will see snapshot tab, click on that to view snapshots of request and output response. Right click on the child node for which you want to set the value. A popup window appears, click on insert xml check. XML check properties window appears there you can find XPath Query value. Use that value in your lr_xml_set_values function.

 

If the above does not work, try like this "Query=/address1",

 

Does this helps you.