Re: lr_xml_set_values (The prefix 'm0' has not been mapped to any URI) (1187 Views)
Reply
Occasional Visitor
muthumann
Posts: 2
Registered: ‎08-29-2011
Message 1 of 6 (1,246 Views)

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?

Frequent Advisor
ArJ3N
Posts: 62
Registered: ‎05-09-2013
Message 2 of 6 (1,223 Views)

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
muthumann
Posts: 2
Registered: ‎08-29-2011
Message 3 of 6 (1,221 Views)

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.

 

HP Expert
_Buzzy
Posts: 105
Registered: ‎08-10-2011
Message 4 of 6 (1,213 Views)

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
ArJ3N
Posts: 62
Registered: ‎05-09-2013
Message 5 of 6 (1,212 Views)

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
Sudarshan007
Posts: 6
Registered: ‎06-11-2013
Message 6 of 6 (1,187 Views)

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.

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.