Parsing XML files and saving in a database: Difference between revisions
Jump to navigation
Jump to search
Kaplanerkan (talk | contribs) |
Kaplanerkan (talk | contribs) |
||
Line 5: | Line 5: | ||
* a php File (xmlparser.php) | * a php File (xmlparser.php) | ||
* a XML-File (xml-File saved with your data) | * a XML-File (xml-File saved with your data) | ||
* A Button in your AppStduio ( | * A Button in your AppStduio (btnSave) | ||
* | * | ||
= My Datas = | |||
* my XML-File : http://erkankaplan.de/ipadSpeisekarte.xml | |||
* my xmlparser.php : http://erkankaplan.de/xmlparser.php | |||
==xmlparser.php== | |||
<pre> | |||
<?php | |||
header('Access-Control-Allow-Origin: *'); | |||
echo file_get_contents($_GET['urlToGet']); | |||
?> | |||
</pre> | |||
==XML-File== | |||
<pre> | |||
<?xml version="1.0" encoding="utf-8" standalone="yes"?> | |||
<menu.xml> | |||
<row> | |||
<Menue>1</Menue> | |||
<Scout></Scout> | |||
<Text_D>Shake</Text_D> | |||
<Text_C>Shake</Text_C> | |||
<Beschreibung_D></Beschreibung_D> | |||
<Beschreibung_C></Beschreibung_C> | |||
<Sort>31</Sort> | |||
<Gruppe>H</Gruppe> | |||
<Preis3>0</Preis3> | |||
<WarenGruppe>41</WarenGruppe> | |||
<SabuSabu>1</SabuSabu> | |||
<IpadZeitZone>0</IpadZeitZone> | |||
</row> | |||
<row> | |||
<Menue>2</Menue> | |||
<Scout></Scout> | |||
<Text_D>Maguro</Text_D> | |||
<Text_C>Maguro</Text_C> | |||
<Beschreibung_D></Beschreibung_D> | |||
<Beschreibung_C></Beschreibung_C> | |||
<Sort>31</Sort> | |||
<Gruppe>H</Gruppe> | |||
<Preis3>0</Preis3> | |||
<WarenGruppe>41</WarenGruppe> | |||
<SabuSabu>1</SabuSabu> | |||
<IpadZeitZone>2</IpadZeitZone> | |||
</row> | |||
<row> | |||
<Menue>3</Menue> | |||
<Scout></Scout> | |||
<Text_D>Ika Nigiri Lachs</Text_D> | |||
<Text_C>Ika Nigiri Lachs</Text_C> | |||
<Beschreibung_D></Beschreibung_D> | |||
<Beschreibung_C></Beschreibung_C> | |||
<Sort>31</Sort> | |||
<Gruppe>H</Gruppe> | |||
<Preis3>0</Preis3> | |||
<WarenGruppe>41</WarenGruppe> | |||
<SabuSabu>1</SabuSabu> | |||
<IpadZeitZone>0</IpadZeitZone> | |||
</row> | |||
</pre> | |||
= AppStudio Code = | = AppStudio Code = |
Revision as of 12:39, 21 February 2013
In this sample you can parse an XML-File with AJAX and save the Data in storage
What you need?
- a php File (xmlparser.php)
- a XML-File (xml-File saved with your data)
- A Button in your AppStduio (btnSave)
My Datas
- my XML-File : http://erkankaplan.de/ipadSpeisekarte.xml
- my xmlparser.php : http://erkankaplan.de/xmlparser.php
xmlparser.php
<?php header('Access-Control-Allow-Origin: *'); echo file_get_contents($_GET['urlToGet']); ?>
XML-File
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <menu.xml> <row> <Menue>1</Menue> <Scout></Scout> <Text_D>Shake</Text_D> <Text_C>Shake</Text_C> <Beschreibung_D></Beschreibung_D> <Beschreibung_C></Beschreibung_C> <Sort>31</Sort> <Gruppe>H</Gruppe> <Preis3>0</Preis3> <WarenGruppe>41</WarenGruppe> <SabuSabu>1</SabuSabu> <IpadZeitZone>0</IpadZeitZone> </row> <row> <Menue>2</Menue> <Scout></Scout> <Text_D>Maguro</Text_D> <Text_C>Maguro</Text_C> <Beschreibung_D></Beschreibung_D> <Beschreibung_C></Beschreibung_C> <Sort>31</Sort> <Gruppe>H</Gruppe> <Preis3>0</Preis3> <WarenGruppe>41</WarenGruppe> <SabuSabu>1</SabuSabu> <IpadZeitZone>2</IpadZeitZone> </row> <row> <Menue>3</Menue> <Scout></Scout> <Text_D>Ika Nigiri Lachs</Text_D> <Text_C>Ika Nigiri Lachs</Text_C> <Beschreibung_D></Beschreibung_D> <Beschreibung_C></Beschreibung_C> <Sort>31</Sort> <Gruppe>H</Gruppe> <Preis3>0</Preis3> <WarenGruppe>41</WarenGruppe> <SabuSabu>1</SabuSabu> <IpadZeitZone>0</IpadZeitZone> </row>