| @@ 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. |
|
| @@ 774-795 (lines=22) @@ | ||
| 771 | * |
|
| 772 | * @return string |
|
| 773 | */ |
|
| 774 | public function xml( |
|
| 775 | bool $multiDecodeNewHtmlEntity = false, |
|
| 776 | bool $htmlToXml = true, |
|
| 777 | bool $removeXmlHeader = true, |
|
| 778 | int $options = \LIBXML_NOEMPTYTAG |
|
| 779 | ): string { |
|
| 780 | $xml = $this->document->saveXML(null, $options); |
|
| 781 | ||
| 782 | if ($removeXmlHeader) { |
|
| 783 | $xml = \ltrim((string) \preg_replace('/<\?xml.*\?>/', '', $xml)); |
|
| 784 | } |
|
| 785 | ||
| 786 | if ($htmlToXml) { |
|
| 787 | $return = $this->fixHtmlOutput($xml, $multiDecodeNewHtmlEntity); |
|
| 788 | } else { |
|
| 789 | $xml = $this->decodeHtmlEntity($xml, $multiDecodeNewHtmlEntity); |
|
| 790 | ||
| 791 | $return = self::putReplacedBackToPreserveHtmlEntities($xml); |
|
| 792 | } |
|
| 793 | ||
| 794 | return $return; |
|
| 795 | } |
|
| 796 | ||
| 797 | /** |
|
| 798 | * @param string $selector |
|