@@ 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. |
@@ 732-753 (lines=22) @@ | ||
729 | * |
|
730 | * @return string |
|
731 | */ |
|
732 | public function xml( |
|
733 | bool $multiDecodeNewHtmlEntity = false, |
|
734 | bool $htmlToXml = true, |
|
735 | bool $removeXmlHeader = true, |
|
736 | int $options = \LIBXML_NOEMPTYTAG |
|
737 | ): string { |
|
738 | $xml = $this->document->saveXML(null, $options); |
|
739 | ||
740 | if ($removeXmlHeader) { |
|
741 | $xml = \ltrim((string) \preg_replace('/<\?xml.*\?>/', '', $xml)); |
|
742 | } |
|
743 | ||
744 | if ($htmlToXml) { |
|
745 | $return = $this->fixHtmlOutput($xml, $multiDecodeNewHtmlEntity); |
|
746 | } else { |
|
747 | $xml = $this->decodeHtmlEntity($xml, $multiDecodeNewHtmlEntity); |
|
748 | ||
749 | $return = self::putReplacedBackToPreserveHtmlEntities($xml); |
|
750 | } |
|
751 | ||
752 | return $return; |
|
753 | } |
|
754 | ||
755 | /** |
|
756 | * @param string $selector |