12 namespace fpoirotte\XRL\Types;
28 return $this->value->asXML();
35 throw new \InvalidArgumentException(
'Expected an object');
38 if (
$value instanceof \DOMNode) {
42 if (
$value instanceof \XMLWriter) {
43 $value = new \SimpleXMLElement(
$value->outputMemory(), LIBXML_NONET);
46 if (!(
$value instanceof \SimpleXMLElement)) {
47 throw new \InvalidArgumentException(
'Expected a SimpleXMLElement object');
54 public function write(\XMLWriter $writer, \DateTimeZone $timezone, $stringTag)
56 $xml = $this->value->asXML();
60 if (strlen($xml) >= 6 && !strncmp($xml,
'<?xml', 5) &&
61 strpos(
" \t\r\n", $xml[5]) !==
false) {
62 $xml = (string) substr($xml, strpos($xml,
'?>') + 2);
65 $writer->startElementNS(
68 'http://ws.apache.org/xmlrpc/namespaces/extensions'
70 $writer->writeRaw($xml);
71 $writer->fullEndElement();
75 protected static function parse(
$value, \DateTimeZone $timezone = null)
77 return simplexml_load_string(
$value,
'\\SimpleXMLElement', LIBXML_NONET);
write(\XMLWriter $writer,\DateTimeZone $timezone, $stringTag)
$value
Current value associated with this object.
A class representing an abstract XML-RPC type.
static parse($value,\DateTimeZone $timezone=null)