Hi all -

I have a xml file that I am trying to extract data from and create variables to use in a PHP / html form.

I am new to extracting information from xml and creating variables

The XML file is show below and what I would like to learn and understand is how to get the information from each section of the file.

If i can be shown how to create a variable for "enquiry_number" from Section_07 I will complete the rest of the extraction myself as a learning curve to help me understand how this is completed

This is how the xml file looks when called using "view source"

<HPICheck_Query VRM="YP51PVJ" VIN="WF0AXXGCDA1D40899">
<Transmission>5 Speed Manual Petrol</Transmission>
<Model>FOCUS LX</Model>
<DVLA_Body_Plan_Description>5 Door Hatchback</DVLA_Body_Plan_Description>
<SMMT_Door_Plan_Description>5 Door Hatchback</SMMT_Door_Plan_Description>
<Door_Plan>5 Door Hatchback</Door_Plan>
<Wheelplan>2 Axle Rigid Body</Wheelplan>
<Prev_Colour_Date> </Prev_Colour_Date>
<Plate_Xfr>Not Recorded</Plate_Xfr>
<VIN_Match>Not Matched</VIN_Match>
<Date>Thu Apr 7 2011  18:32:45</Date>

I have attempted to get the data from the xml using the code below, but this just brings back VRM="YP51PVJ" VIN="WF0AXXGCDA1D40899 from the top of the file.

foreach($HpiCheck_Query->attributes () as $attributes)
	echo " ".$attributes->getName()." => ".$attributes." ";

any help would be appreciated

Recommended Answers

All 2 Replies

Please consult the xml the desired result
to generate hand

it is possible to create xsl to xml with this
Always remember to think here are xml user and no php programmer

I usually make only pure xsl xml xquery
and not a programming language
this should not mean the program I can not
just me missing the intricacies of php

Hi thanks for your reply, but I have it working how I thought it should work

<?php foreach ($HpiCheck_Query->Basic->Engine_Size as $Engine_Size) { echo "$Engine_Size "; } ?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.