I am a situation where I'd like to add the same content in several locations in an XML file. FYI - first time tackling DOMDocument. Say the xml looks like
<rrd>
<rra>
<cdp_prep>
<ds>
<value>nan</value>
</ds>
<ds>
<value>nan</value>
</ds>
<ds>
<value>nan</value>
<ds>
</cdp_prep>
<database>
...
</database>
</rra>
<rra>
<cdp_prep>
<ds>
<value>nan</value>
<ds>
</ds>
<value>nan</value>
<ds>
<ds>
<value>nan</value>
</ds>
</cdp_prep>
<database>
...
</database>
</rra>
</rrd>
If i use something like $rrdCDPds = $xRRD->query("/rrd/rra/cdp_prep/ds"); then i would get all the <ds> elements. In this case i would have a length of 6. However, I'm trying to insertBefore on the second <ds> of each <cdp_prep> element. My issue is if i query on "/rrd/rra/cdp_prep", how do i target the insertBefore on the 2nd <ds> element for every <cdp_prep> element?
dselements?