Link to home
Start Free TrialLog in
Avatar of Tony Pearce
Tony PearceFlag for United Kingdom of Great Britain and Northern Ireland

asked on

XML CreateElement

Hi,

I have an existing script that outputs an XML file, I need to alter the header and add some elements, I need some pointers please, examples below:

This is the header code:
$dom = new DOMDocument('1.0', 'utf-8');
 $element = $dom->createElement('DTD_ORDER');

This outputs:
<?xml version="1.0" encoding="utf-8"?>
<DTD_ORDER>*******************</DTD_ORDER>

What I need to do is add in some elements so result looks like:

<SyncSalesOrder xmlns:v2="http://xmlns.oracle.com/EnterpriseObjects/Core/Common/V2" xmlns:v1="http://xmlns.oracle.com/EnterpriseObjects/Core/EBO/PickList/V1" releaseID="9.0" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns="http://www.openapplications.org/oagis/9"><ApplicationArea><Sender><LogicalID>5029125000000</LogicalID><ComponentID></ComponentID><TaskID>SalesOrder</TaskID><ReferenceID>1</ReferenceID></Sender><CreationDateTime>2014-11-04T18:53:51+10:30</CreationDateTime></ApplicationArea><DataArea><Sync><ActionCriteria><ActionExpression actionCode="Sync"/></ActionCriteria></Sync><DTD_ORDER>*************</DTD_ORDER></DataArea></SyncSalesOrder>


Where
The ReferenceId should be the transmission number(date/hour as 0711201408)
The CreationDateTime should be the transmission date and time

Getting bogged down in this, any help appreciated

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Robert Schutt
Robert Schutt
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Tony Pearce

ASKER

Hi,
Thanks very much, learnt a lot by seeing the code in place, php.net is good, but sometimes needs 'real world' examples, very good solution.
Tony