Hi I am wanting to parse an xml file and then some validation and processing. I have used clsParseXML from
XML Parser Class by Eric Rosebrock @ http://www.phpfreaks.com
I have that working (i didnt really do anything haha)
my xml file is as below:
<?xml version="1.0"?>
<eCert>
<Chamber>AIG</Chamber>
<Status>CREATE</Status>
<!-- CREATE/UPDATE/PASSWORD -->
<Exporter>
<ExporterPrefix>EXP</ExporterPrefix>
<ExporterName>Exporter One</ExporterName>
<ExporterAddress1>Address Line 1</ExporterAddress1>
<ExporterAddress2>Address Line 2</ExporterAddress2>
<ExporterAddress3>Address Line 3</ExporterAddress3>
<ExporterAddress4>Address Line 4</ExporterAddress4>
<Signatory>
<FullName>Signatory Name</FullName>
<EmailAddress>chris@orbitservices.net</EmailAddress>
</Signatory>
<Signatory>
<FullName>Signatory Name 2</FullName>
<EmailAddress>chris@orbitservices.net 2</EmailAddress>
</Signatory>
</Exporter>
</eCert>
and the output is as follows:
Array
(
[ECERT] => Array
(
[0] => Array
(
[CHAMBER] => Array
(
[0] => Array
(
[VALUE] => AIG
)
)
[STATUS] => Array
(
[0] => Array
(
[VALUE] => CREATE
)
)
[EXPORTER] => Array
(
[0] => Array
(
[EXPORTERPREFIX] => Array
(
[0] => Array
(
[VALUE] => EXP
)
)
[EXPORTERNAME] => Array
(
[0] => Array
(
[VALUE] => Exporter One
)
)
[EXPORTERADDRESS1] => Array
(
[0] => Array
(
[VALUE] => Address Line 1
)
)
[EXPORTERADDRESS2] => Array
(
[0] => Array
(
[VALUE] => Address Line 2
)
)
[EXPORTERADDRESS3] => Array
(
[0] => Array
(
[VALUE] => Address Line 3
)
)
[EXPORTERADDRESS4] => Array
(
[0] => Array
(
[VALUE] => Address Line 4
)
)
[SIGNATORY] => Array
(
[0] => Array
(
[FULLNAME] => Array
(
[0] => Array
(
[VALUE] => Signatory Name
)
)
[EMAILADDRESS] => Array
(
[0] => Array
(
[VALUE] => chris@orbitservices.net
)
)
)
[1] => Array
(
[FULLNAME] => Array
(
[0] => Array
(
[VALUE] => Signatory Name 2
)
)
[EMAILADDRESS] => Array
(
[0] => Array
(
[VALUE] => chris@orbitservices.net 2
)
)
)
)
)
)
)
)
)
What I would like from here is to firstly identify that the XML structure is correct (e.g. it has an ecert tag) and then process the data and insert into a MySQL Database.
How do I achieve that with the Array and SubArrays that is created by this script.