I am dealing with the following XML:
<Paragraph>This is a test. This is a test.
<Italic>This is an italicized test</Italic>
This is more tests
</Paragraph>
I'm trying to pull in the XML, modify it as a text string or HTML code, and spit it back out. I'm running into the issue that I see no way of keeping all this text in its correct order. This is my code:
$xml = "<Paragraph>This is a test. This is a test.
<Italic>This is an italicized test</Italic>
This is more tests
</Paragraph>";
$itterator = new SimpleXmlIterator($xml);
$non_italicized = $itterator->__toString();
for ($itterator->rewind(); $itterator->valid(); $itterator->next()) {
$italicized = $itterator->current()->__toString();
}
The output of $non_italicized:
This is a test. This is a test.
This is more tests
The output of $italicized:
This is an italisized test
This leaves me no real of way of combinging them together in a regular paragraph with italicized text in the middle. How can I achieve this?