You are here

private function HttpClientXMLFormatter::sanitizeNodeName in Http Client 7.2

Same name and namespace in other branches
  1. 6.2 includes/HttpClientXMLFormatter.inc \HttpClientXMLFormatter::sanitizeNodeName()

Sanitizes a string so that it's suitable for use as a element or attribute name.

Parameters

string $name:

Return value

string The sanitized name.

2 calls to HttpClientXMLFormatter::sanitizeNodeName()
HttpClientXMLFormatter::serialize in includes/formatter/HttpClientXMLFormatter.inc
Serializes arbitrary data to the implemented format. Directly stolen from http_server by Hugo Wetterberg
HttpClientXMLFormatter::xml_recurse in includes/formatter/HttpClientXMLFormatter.inc
Directly stolen from http_server by Hugo Wetterberg

File

includes/formatter/HttpClientXMLFormatter.inc, line 69

Class

HttpClientXMLFormatter
Class for handling xml-responses. Returns a SimpleXML object

Code

private function sanitizeNodeName($name) {
  $name = preg_replace('/[^A-Za-z0-9_]/', '_', $name);
  return preg_replace('/^([0-9]+)/', '_$1', $name);
}