Export query to xml (1 Viewer)

R

Rhaja

Guest
When I export a query to xml (MS Access) then the name of the query equals
the tagname in xml. Example: when the queryname is ‘qryRegions’, the xml
result is:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<dataroot xmlns:od="urn:schemas-microsoft-com:officedata"
generated="2006-03-04T14:32:33">
<qryRegions>
<City>Woonplaats</City>
<ContactName>Naam</ContactName>
<Profession>Beroep</Profession>
<Phone>012-3456789</Phone>
<Province>Flevoland</Province>
</qryRegions>
</dataroot>

What I want to do is selecting one of the childNodes as firstChild e.g.:

Code:
<dataroot>
<Province>
<City>Woonplaats</City>
<ContactName>Naam</ContactName>
<Profession>Beroep</Profession>
<Phone>012-3456789</Phone>
</Province>
</dataroot>
I can’t find a way to manage this. Any suggestions??
 

reclusivemonkey

Registered User.
Local time
Today, 14:39
Joined
Oct 5, 2004
Messages
749
I'm not sure what you are asking here. The XML you have will give you all you need to make any other XML file, you can use XSLT to take an XML file and change the format easily. However, in the example you give you are losing the Province name, which I am sure you don't want to do? Top XML should be able to give you examples of XML to XML conversions;

http://www.topxml.com/xsltStylesheets/xslt_XML_to_XML.asp
 
R

Rhaja

Guest
reclusivemonkey said:
I'm not sure what you are asking here. .. However, in the example you give you are losing the Province name, which I am sure you don't want to do?

You're right, sorry. What I meant was: selecting the content of one of the childNodes. In this case:
Code:
<dataroot>
<Flevoland>
<City>Woonplaats</City>
<ContactName>Naam</ContactName>
<Profession>Beroep</Profession>
<Phone>012-3456789</Phone>
</Flevoland>
</dataroot>

Then I'll parse the xml-file with PHP 5 DOM. So the contents of <Province> becomes the main tagname.
Thanks for the link!
 

reclusivemonkey

Registered User.
Local time
Today, 14:39
Joined
Oct 5, 2004
Messages
749
Why would you want to do this? What is the end result that you want? You can group on the province simply using keys in XSLT, or if you really to put the province name in the XML, you should use an attibute, like;

Code:
<dataroot>
<Province Attribute="Flevoland">
<City>Woonplaats</City>
<ContactName>Naam</ContactName>
<Profession>Beroep</Profession>
<Phone>012-3456789</Phone>
</Province>
</dataroot>
 

hoychep

New member
Local time
Today, 06:39
Joined
Jun 11, 2014
Messages
7
Hi,

I would like to know how was this solved?

Thanks!
 

Users who are viewing this thread

Top Bottom