SimpleXMLElement, adding nodes that are SimpleXMLElement.
| From: | Richard Quadling | Date: | Mon, 25 Jul 2011 12:47:50 +0000 |
| Subject: | SimpleXMLElement, adding nodes that are SimpleXMLElement. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-314196@lists.php.net to get a copy of this message | ||
Hello all.
I've got 2 XML documents (one from a URL and another via MS SQL Server).
The structure of these documents is the same, with just a difference
in attribute to identify things (the 'data' is different but the
variable's name attribute is the key here).
<data>
<variable name="var_name_x">
<row>
<column>data</column>
...
</row.
...
</variable>
</data>
I need to merge both documents so that the variable node of each
document exists in a new document ...
<data>
<variable name="var_name_x">
...
</variable>
<variable name="var_name_y">
...
</variable>
</data>
I know I can do this with string manipulation (and that's what I've
done), but I'd like to use a more appropriate mechanism (part learning
and part keeping the code tidy).
I suspect SimpleXMLElement may not be the right tool.
Richard.
--
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea