03-23-2009, 09:18 AM
|
#1 (permalink)
|
|
The Wanderer
Join Date: Jan 2008
Posts: 13
Thanks: 0
|
Add xml elements to existing xml file
Normally this shouldn't be a big problem, to add more xml elements in the middle of an already existing xml file. But the problem is that it's an Word xml file which uses Office Open Xml. The problem is that I can't use the normal methods with DOMDocument cause it uses namespaces. So I tried simplexml, but then I couldn't add it in the middle of the text where I needed it but only at the end of the file.
This is a small part of the xml file
Code:
<w:p w:rsidR="000D7961" w:rsidRPr="000D7961" w:rsidRDefault="000D7961" w:rsidP="000D7961">
<w:pPr>
<w:pStyle w:val="plattekst2"/>
<w:spacing w:line="336" w:lineRule="auto"/>
<w:rPr>
<w:rFonts w:ascii="HelveticaNeueLT Std" w:hAnsi="HelveticaNeueLT Std"/>
<w:sz w:val="18"/>
<w:lang w:val="nl-NL"/>
</w:rPr>
</w:pPr>
<w:bookmarkStart w:id="1" w:name="sponsor"/>
<w:bookmarkEnd w:id="1"/>
</w:p>
And now I have to replace everything between <w:p> and </w:p> with this, but I have no glue how to do this.
Code:
<w:pPr>
<w:jc w:val="center"/>
<w:rPr>
<w:rFonts w:ascii="Arial" w:hAnsi="Arial"/>
<w:color w:val="000000"/>
<w:sz w:val="34"/>
<w:szCs w:val="34"/>
</w:rPr>
</w:pPr>
<w:r>
<w:t xml:space="preserve">Test sponsor</w:t>
</w:r>
Anybody can help me out with this problem?
Last edited by Ultimatum : 03-23-2009 at 09:57 AM.
|
|
|
|