@@ 352-373 (lines=22) @@ | ||
349 | * |
|
350 | * @return string |
|
351 | */ |
|
352 | public function xml( |
|
353 | bool $multiDecodeNewHtmlEntity = false, |
|
354 | bool $htmlToXml = true, |
|
355 | bool $removeXmlHeader = true, |
|
356 | int $options = \LIBXML_NOEMPTYTAG |
|
357 | ): string { |
|
358 | $xml = $this->document->saveXML(null, $options); |
|
359 | ||
360 | if ($removeXmlHeader) { |
|
361 | $xml = \ltrim((string) \preg_replace('/<\?xml.*\?>/', '', $xml)); |
|
362 | } |
|
363 | ||
364 | if ($htmlToXml) { |
|
365 | $return = $this->fixHtmlOutput($xml, $multiDecodeNewHtmlEntity); |
|
366 | } else { |
|
367 | $xml = $this->decodeHtmlEntity($xml, $multiDecodeNewHtmlEntity); |
|
368 | ||
369 | $return = self::putReplacedBackToPreserveHtmlEntities($xml); |
|
370 | } |
|
371 | ||
372 | return $return; |
|
373 | } |
|
374 | ||
375 | /** |
|
376 | * Get the encoding to use. |
@@ 752-773 (lines=22) @@ | ||
749 | * |
|
750 | * @return string |
|
751 | */ |
|
752 | public function xml( |
|
753 | bool $multiDecodeNewHtmlEntity = false, |
|
754 | bool $htmlToXml = true, |
|
755 | bool $removeXmlHeader = true, |
|
756 | int $options = \LIBXML_NOEMPTYTAG |
|
757 | ): string { |
|
758 | $xml = $this->document->saveXML(null, $options); |
|
759 | ||
760 | if ($removeXmlHeader) { |
|
761 | $xml = \ltrim((string) \preg_replace('/<\?xml.*\?>/', '', $xml)); |
|
762 | } |
|
763 | ||
764 | if ($htmlToXml) { |
|
765 | $return = $this->fixHtmlOutput($xml, $multiDecodeNewHtmlEntity); |
|
766 | } else { |
|
767 | $xml = $this->decodeHtmlEntity($xml, $multiDecodeNewHtmlEntity); |
|
768 | ||
769 | $return = self::putReplacedBackToPreserveHtmlEntities($xml); |
|
770 | } |
|
771 | ||
772 | return $return; |
|
773 | } |
|
774 | ||
775 | /** |
|
776 | * @param string $selector |