given the following XML structure (i have this in an XML-file, with lots of other content - the <p>
tags are just there to indicate that other tags may follow):
<TITEL1>...</TITEL1>
<p>..</p>
<TITEL2>...</TITEL2>
<TITEL3>...</TITEL3>
<TITEL3>...</TITEL3>
<P>...<P>
is there a way to get to this using PHP (write it to a new file):
<TITEL1>
<TITEL>...</TITEL>
<p>...</p>
<TITEL2>
<TITEL>...</TITEL>
<TITEL3>
<TITEL>...</TITEL>
<P>...</P>
</TITEL3>
<TITEL3>
<TITEL>...</TITEL>
<P>...</P>
</TITEL3>
</TITEL2>
</TITEL1>
or in other words,is there a way to have higher level titels inclose lower level titels and all content that follows them, thus creating a nested structure. The content of each TITEL1,2 and 3 tag should go into a new <TITEL>
-element
I already asked the same question on the XSLT-side of the forum but got the advise to try with c# or java. Since I don't know those languages and know somewhat more than the basics of PHP i thought of trying it that way. Can anyone set me on my way?