xmlentities($value); } parent::addAttribute($name, $value, $namespace); } /** * Adds a child element to the XML node * * @param string $name The name of the child element to add. * @param string $value If specified, the value of the child element. * @param string $namespace If specified, the namespace to which the child element belongs. * @return \Magento\Shipping\Model\Simplexml\Element */ public function addChild($name, $value = null, $namespace = null) { if (!is_null($value)) { $value = $this->xmlentities($value); } return parent::addChild($name, $value, $namespace); } /** * Converts meaningful xml characters to xml entities * * @param string|null $value * @return string */ public function xmlentities($value = null) { $value = str_replace('&', '&', $value); $value = str_replace('&', '&', $value); return $value; } }