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">"
Did you know?Explore Trending and Topic pages for more stories like this.

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

Need help with a mail notify function
I was tasked with setting up a site that's been prewritten. The site is basically a form that captur

AJAX form submit
I recently built a form that submits data to my database with an ajax function that is called throug

Protecting forms
Alright, I want to protect some forms of mine from SQL Injections, because I had someone earlier spa

How to show a complete textarea ??
I enter Client Case Notes notes in a textarea field on a PHP form. The field is 5 rows deep and 70 c

mod_rewrite.c on windows ??
why it's not working on windows while it's working on other hosts???

this is the code i got

Parse error: syntax error, unexpected T_ELSEIF in /home/......html/item.php on l
I do not know what is wrong with this. Hope some one can help. I do nto want to post the entire site

Extra fields in main body and php required.
I'm new to PHP so please be gentle. I have a little php script below that works well.
The &quo

how to remove in php string display
My code is $message="We're looking at developing our website."; $body= "My mess

user data not transferring to new page
I'm a PHP learner. After an index.php page, the user goes to a login.php page. Both pages seem to

Help with search.php
Hello All

I need the search engine on a site I am building at the moment to display the searc

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