XML elements with “-” trouble

A person should avoid using the subtraction symbol in an XML element name. http://www.w3schools.com/xml/xml_elements.asp says: Avoid “-” characters. If you name something “first-name,” some software may think you want to subtract name from first. 

We have a vendor that is on using them anyhow. Maybe I don’t know what I am talking about but couldn’t they just use an underscore or camelCase? So far they have ignored my request. The show must go on.

The XML we get from the soap request:

<?xml version=”1.0″ encoding=”UTF_8″?><PurchaseTokensResponse xmlns=”https://www.vendornamehidden.com/MsServices”><s-gensym3 xmlns:xsi=”http://www.w3.org/2001/XMLSchema_instance” xsi:type=”xsd:string”>SUCCESS</s-gensym3></PurchaseTokensResponse>

My work around in ColdFusion:

<cfif find( “200”, httpResponse.statusCode )>

<!— Parse the XML SOAP response. —>
<cfset soapResponse = xmlParse( httpResponse.fileContent ) />
<cfset msResponseNodes = xmlSearch(
“//*[ local-name() = ‘PurchaseTokensResponse’ ]”
) />
<cfset respon = msResponseNodes[1]>

<!— Convert the XML to a string so we can do a replace —>
<cfset xmlString = toString(respon)>
<cfset replaceddashXML = replace(xmlString,”-“,”_”,”ALL”)>
<!— Convert the string back  to XML  —>
<cfxml variable=”backToXML”>
<!—Now we can carry on as if nothing happened —>
<cfset msResponse = backToXML[1].PurchaseTokensResponse.s_gensym3.xmlText>
Purchase token response:<cfoutput>#msResponse#</cfoutput>
<cfset msResponse = “fail”>

There is probably an easier way.