@@ 333-354 (lines=22) @@ | ||
330 | * |
|
331 | * @return string |
|
332 | */ |
|
333 | public function xml( |
|
334 | bool $multiDecodeNewHtmlEntity = false, |
|
335 | bool $htmlToXml = true, |
|
336 | bool $removeXmlHeader = true, |
|
337 | int $options = \LIBXML_NOEMPTYTAG |
|
338 | ): string { |
|
339 | $xml = $this->document->saveXML(null, $options); |
|
340 | ||
341 | if ($removeXmlHeader) { |
|
342 | $xml = \ltrim((string) \preg_replace('/<\?xml.*\?>/', '', $xml)); |
|
343 | } |
|
344 | ||
345 | if ($htmlToXml) { |
|
346 | $return = $this->fixHtmlOutput($xml, $multiDecodeNewHtmlEntity); |
|
347 | } else { |
|
348 | $xml = $this->decodeHtmlEntity($xml, $multiDecodeNewHtmlEntity); |
|
349 | ||
350 | $return = self::putReplacedBackToPreserveHtmlEntities($xml); |
|
351 | } |
|
352 | ||
353 | return $return; |
|
354 | } |
|
355 | ||
356 | /** |
|
357 | * Get the encoding to use. |
@@ 757-778 (lines=22) @@ | ||
754 | * |
|
755 | * @return string |
|
756 | */ |
|
757 | public function xml( |
|
758 | bool $multiDecodeNewHtmlEntity = false, |
|
759 | bool $htmlToXml = true, |
|
760 | bool $removeXmlHeader = true, |
|
761 | int $options = \LIBXML_NOEMPTYTAG |
|
762 | ): string { |
|
763 | $xml = $this->document->saveXML(null, $options); |
|
764 | ||
765 | if ($removeXmlHeader) { |
|
766 | $xml = \ltrim((string) \preg_replace('/<\?xml.*\?>/', '', $xml)); |
|
767 | } |
|
768 | ||
769 | if ($htmlToXml) { |
|
770 | $return = $this->fixHtmlOutput($xml, $multiDecodeNewHtmlEntity); |
|
771 | } else { |
|
772 | $xml = $this->decodeHtmlEntity($xml, $multiDecodeNewHtmlEntity); |
|
773 | ||
774 | $return = self::putReplacedBackToPreserveHtmlEntities($xml); |
|
775 | } |
|
776 | ||
777 | return $return; |
|
778 | } |
|
779 | ||
780 | /** |
|
781 | * @param string $selector |