Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FluentDOM\Text::replaceWholeText() removed entity #57

Closed
ThomasWeinert opened this issue Dec 24, 2016 · 1 comment
Closed

FluentDOM\Text::replaceWholeText() removed entity #57

ThomasWeinert opened this issue Dec 24, 2016 · 1 comment
Labels
Milestone

Comments

@ThomasWeinert
Copy link
Owner

Removing an entity reference during replaceWholeText() seems to remove the entity definition, too.

Hopefully here is a workaround for that.

@ThomasWeinert ThomasWeinert added this to the 6.0.1 milestone Dec 24, 2016
@ThomasWeinert
Copy link
Owner Author

Example:

$document = new FluentDOM\Document();
$document->loadXML(
  '<!DOCTYPE p ['."\n".
  '  <!ENTITY t "world">'."\n".
  ']>'."\n".
  '<p>Hello &t;<br/>, nice to see you &t;</p>'
);
/** @var \FluentDOM\Text $text */
$text = $document->documentElement->firstChild;
$text->replaceWholeText('Hi universe');
echo $document->saveXML();

Output:

<?xml version="1.0"?>
<!DOCTYPE p [
]>
<p>Hi universe<br/>, nice to see you &t;</p>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant