Creating XML with php


Posted on 16th Feb 2014 07:03 pm by admin

I need to creat an XML with php and have successfully produced a valid output.
The problem I have is that the XML requirements of the application that will import the XML requires that the XML file includes the line:

"<OpenShipments xmlns="x-schema:D:/Documents and Settings/VBN5CGC/My Documents/Trainings/xml autoimport WS/pruebas/OpenShipments.xdr">"

How do I include this line in my output XML file???

here is what I have so far

Code:

$doc = new DOMDocument('1.0');
$doc->formatOutput = true;

$root = $doc->createElement('OpenShipments');
$root = $doc->appendChild($root);

$occ = $doc->createElement('OpenShipment');
$occ = $root->appendChild($occ);

$oc2 = $doc->createElement('ShipTo');
$oc2 = $occ->appendChild($oc2);

Output:

<OpenShipments>
<OpenShipment>
<ShipTo>
</ShipTo>
</OpenShipment>
</OpenShipments>

The requied output is:

<OpenShipments xmlns="x-schema:D:/Documents and Settings/VBN5CGC/My Documents/Trainings/xml autoimport WS/pruebas/OpenShipments.xdr">
<OpenShipment>
<ShipTo>
</ShipTo>
</OpenShipment>
</OpenShipments>

No comments posted yet

Your Answer:

Login to answer
158 Like 16 Dislike
Previous forums Next forums
Other forums

php sessions,logouts & the bloomin back button!
Hi All,

I've got a cms that members can log into. When they logout, the session is destroyed,

RTF fomatting to email content
Im trying to sen an email with content is picked up from a rtf-file (file_get_contents('*.rtf'). Mai

passthru() help
Hi everyone,
I'm new to the forum and to PHP. I have some pretty good experience writing shell sc

why isn't this PHP code working ???
it's suppose to find a name on the database.

<?php

$s = $_POST["lname&

Calling strings from other php class
I have test1.php{
$string1;
$string2;
....
... //10 strings in this class <

close site for maintenance
i get a tutorial, saying the following code can put our site offline, and only the developer can vie

Custom list order
Hi there,

I have checked this tutorial and it's great till the point where I want to display

php web service error
hey guys,
I'm working on a project requires the use of web services. I've been trying a few tutor

IMAGE - SERVER SIDE scripting help...
How to receive pixel data of an image and buid a bitmap file on the server using the HTTP POST metho

default SAP userid
hi,, I just like to know if it is ok to use the default SAP user id (SAP*)?

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash