Need help with XML structure change
Posted: Sat Aug 13, 2005 10:22 am
Hi,
I am a self-confessed XML newbie, and I suspect my question is probably very simple, but I don't even know what to search for, as I don't know the right terms and such. So I'm hoping someone here can help me.
I recently downloaded oXygen and am trying to figure out how to perform a specific function with it. What I need to do is quite simple. This is the current structure of my XML document:
I need to make it so that the "thread ID" number appears on EVERY comment, not just at the beginning of each comment thread. So for example, it could look like this:
Or something along those lines. Bottom line, I just need to find an automated way of sticking that thread id number inside the "comment" attribute. If someone can show me the basics, I can probably figure out the specifics... I just need a starting point.
In case you're wondering, this conversion is necessary because I am exporting to a MySQL database and I need the ID number in every comment in order to sychronise with the existing entries in the database.
Any help would be much appreciated! Thanks!
--Brendan Loy
I am a self-confessed XML newbie, and I suspect my question is probably very simple, but I don't even know what to search for, as I don't know the right terms and such. So I'm hoping someone here can help me.
I recently downloaded oXygen and am trying to figure out how to perform a specific function with it. What I need to do is quite simple. This is the current structure of my XML document:
Code: Select all
<thread id="90815878">
<comment>
<datetime>2003-03-17T01:48:14-05:00</datetime>
<name>Andrew</name>
<email>uscrepublican@hotmail.com</email>
<uri></uri>
<ip>24.24.241.28</ip>
<text><![CDATA[Man, the West is tough. What were they thinking?!? Arizona, Kansas, Duke, and Illinois--any other year and that could be your Final Four. Illinois and Duke both won their conference tourneys, and Arizona is ranked #1. Duke is always tough. Sheesh.]]></text>
</comment>
<comment>
<datetime>2003-03-17T01:54:36-05:00</datetime>
<name>Andrew</name>
<email>uscrepublican@hotmail.com</email>
<uri></uri>
<ip>24.24.241.28</ip>
<text><![CDATA[Wow, picking the semifinal matchups in the East is turning out to be quite difficult. Each matchup I show could go either way.]]></text>
</comment>
</thread>
Code: Select all
<thread id="90815878">
<comment>
<threadid>90815878</threadid>
<datetime>2003-03-17T01:48:14-05:00</datetime>
<name>Andrew</name>
<email>uscrepublican@hotmail.com</email>
<uri></uri>
<ip>24.24.241.28</ip>
<text><![CDATA[Man, the West is tough. What were they thinking?!? Arizona, Kansas, Duke, and Illinois--any other year and that could be your Final Four. Illinois and Duke both won their conference tourneys, and Arizona is ranked #1. Duke is always tough. Sheesh.]]></text>
</comment>
<comment>
<threadid>90815878</threadid>
<datetime>2003-03-17T01:54:36-05:00</datetime>
<name>Andrew</name>
<email>uscrepublican@hotmail.com</email>
<uri></uri>
<ip>24.24.241.28</ip>
<text><![CDATA[Wow, picking the semifinal matchups in the East is turning out to be quite difficult. Each matchup I show could go either way.]]></text>
</comment>
</thread>
In case you're wondering, this conversion is necessary because I am exporting to a MySQL database and I need the ID number in every comment in order to sychronise with the existing entries in the database.
Any help would be much appreciated! Thanks!
--Brendan Loy