Tony Pearce
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_O RDER');
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><L ogicalID>5 0291250000 00</Logica lID><Compo nentID></C omponentID ><TaskID>S alesOrder< /TaskID><R eferenceID >1</Refere nceID></Se nder><Crea tionDateTi me>2014-11 -04T18:53: 51+10:30</ CreationDa teTime></A pplication Area><Data Area><Sync ><ActionCr iteria><Ac tionExpres sion actionCode="Sync"/></Actio nCriteria> </Sync><DT D_ORDER>** ********** *</DTD_ORD ER></DataA rea></Sync SalesOrder >
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
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_O
This outputs:
<?xml version="1.0" encoding="utf-8"?>
<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>
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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