Escapes invalid xml characters
public static escapeInvalidXmlCharsRegex ( $textContent ) : string | ||
$textContent | = xml data to be escaped | |
return | string |
/** * @param string $property * @param PPXmlMessage|string $value * @param string $namespace * @return string */ private function buildProperty($property, $value, $namespace = 'ebl') { $annotations = PPUtils::propertyAnnotations($this, $property); if (!empty($annotations['namespace'])) { $namespace = $annotations['namespace']; } if (!empty($annotations['name'])) { $property = $annotations['name']; } if ($namespace === true) { $el = '<' . $property; } else { $el = '<' . $namespace . ':' . $property; } if (!is_object($value)) { $el .= '>' . PPUtils::escapeInvalidXmlCharsRegex($value); } else { if (substr($value = $value->toXMLString(), 0, 1) === '<' || $value == '') { $el .= '>' . $value; } else { $el .= ' ' . $value; } } if ($namespace === true) { return $el . '</' . $property . '>'; } else { return $el . '</' . $namespace . ':' . $property . '>'; } }