You are here: PHP & DOM XML : Formating the output file « PHP Programming Language « IT news, forums, messages
PHP & DOM XML : Formating the output file

Posted by fragmonster on 03/01/06 10:43

Hi,
I need to manipulate XML files with PHP. So i need to extract and
insert nodes in my files.

For the extraction : no problem with XPath, it works fine.

But, for inserting new nodes, it's more complicated. It's works but I'm
experiencing some XML code formating problems

Lets take an example of XML source file, in which I have to insert data
:

<A>
<Objects>
<Obj>foo</Obj>
<Obj>bar</Obj>
</Objects>
</A>


In this file I must insert a new group of tags (DTD complient tags) in
order to obtain this output file

<A>
<New>
<Data1></Data1>
<Data1></Data1>
</New>
<Objects>
<Obj>foo</Obj>
<Obj>bar</Obj>
</Objects>
</A>


But, instead I obtain this output :

<A>
<Objects>
<Obj>foo</Obj>
<Obj>bar</Obj>
</Objects>
<New><Data1></Data1><Data1></Data1></New></A>

My new group of tags has been inserted at the and of my file, and my
XML code is not correctly indented.

What can I do to fix this?

Thanks

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация