cesarcesar Posted January 21, 2008 Share Posted January 21, 2008 Hi, XML novice here with another question. I need to add a XML node like, <child01> <child02> <text></text> <image>image 1</image> <image>image 2</image> </child02> </child01> into this node between the ending </child01> and beginning <child01> of the <child01> <child02> <text></text> <image>image 1</image> <image>image 2</image> </child02> </child01> <child01> <child02> <text></text> <image>image 1</image> <image>image 2</image> </child02> </child01> Does this make sense? I guess im looking for a way to say/do... make a new node with the following values and place it between these other two nodes. I still am learning XML but i think this can be done. Quote Link to comment Share on other sites More sharing options...
priti Posted January 21, 2008 Share Posted January 21, 2008 Hi, Referring you code . what is the need of <child02> how it differe if the <text><image> falls in <child01> ???? this won't be considered as proper XML.what you can do is <child01> <child02> <text></text> <image>image 1</image> <image>image 2</image> </child02> <child02> <text></text> <image>image 1</image> <image>image 2</image> </child02> </child01> This make some sense i suppose.As i am not aware what you are trying to do this may not be the best XML format but this will be lighter and faster to parse compare to the previous. Regards Quote Link to comment Share on other sites More sharing options...
cesarcesar Posted January 21, 2008 Author Share Posted January 21, 2008 woops sorry, my 2nd XML is wrong. here is the correct. <child01> <child02> <text></text> <image>image 1</image> <image>image 2</image> </child02> <child02> <text></text> <image>image 1</image> <image>image 2</image> </child02> </child01> <child01> <child02> <text></text> <image>image 1</image> <image>image 2</image> </child02> <child02> <text></text> <image>image 1</image> <image>image 2</image> </child02> </child01> Quote Link to comment Share on other sites More sharing options...
cesarcesar Posted January 21, 2008 Author Share Posted January 21, 2008 one other thing... i want to do this in PHP if possible, but other languages are ok. Quote Link to comment Share on other sites More sharing options...
priti Posted January 22, 2008 Share Posted January 22, 2008 one other thing... i want to do this in PHP if possible, but other languages are ok. Dear, you can to XML creation and parsing of it in PHP.This language has potential to do it faster and better.But again i would like to check your second XML if <child01> is not similar with second occurance of <child01> then its okie but if it is similart then create only one xml <tag> for it take example hild01> <child02> <text></text> <image>image 1</image> <image>image 2</image> </child02> <child02> <text></text> <image>image 1</image> <image>image 2</image> </child02> </child01> <child02> it sud not be child01 <child022> <text></text> <image>image 1</image> <image>image 2</image> </child022> <child022> <text></text> <image>image 1</image> <image>image 2</image> </child022> </child02> Regards Quote Link to comment Share on other sites More sharing options...
pdkv2 Posted January 22, 2008 Share Posted January 22, 2008 i just wanted to remind well formed xml should contain the root element which is not present in all above sample xml. Rgds. Quote Link to comment Share on other sites More sharing options...
priti Posted January 23, 2008 Share Posted January 23, 2008 I think he is showing the chunk of XML where he is not comfortable .... not the complete . if not say then cesarcesar needs to check the complete xml format. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.