Transform xml structure to another xml structure

ALUnsotsemololf

New Member
Im working with PHP5, and I need to transform XML in the following form:\[code\]<item> <string isNewLine="1" lineNumber="32">some text in new line</string> <string>, more text</string> <item> <string isNewLine="1" lineNumber="33">some text in new line</string> <string isNewLine="1" lineNumber="34">some text</string> <string> in the same line</string> <string isNewLine="1" lineNumber="35">some text in new line</string> </item></item>\[/code\]into something like this:\[code\]<item> <line lineNumber="32">some text in new line, more text</string> <item> <line lineNumber="33">some text in new line</string> <line lineNumber="34">some text in the same line</string> <line lineNumber="35">some text in new line</string> </item></item>\[/code\]As you can see, it has joined the text contained in across multiple 'string' nodes.Also note that the 'string' nodes can be nested within other nodes at any level.What are possible solutions for transforming source xml to the target xml?Thanks,
 
Back
Top