You are here

private function HttpClientXMLFormatter::sanitizeNodeName in Http Client 6.2

Same name and namespace in other branches
  1. 7.2 includes/formatter/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/HttpClientXMLFormatter.inc
Serializes arbitrary data to the implemented format. Directly stolen from http_server by Hugo Wetterberg
HttpClientXMLFormatter::xml_recurse in includes/HttpClientXMLFormatter.inc
Directly stolen from http_server by Hugo Wetterberg

File

includes/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);
}