Hallo zusammen,
Da ich bis dato mit XML noch nix zu tun hatte, hab ich da mal ein kleines Problem:
Ich möchte gern die Daten aus einer BMEcat XML- Katalogdatei mittels PHP in eine Datenbank Importieren, weis aber nicht wie ich das am besten Anstelle?
Hier mal der Inhalt der catalog.xml zur Veranschaulichung:
<?xml version="1.0" encoding="iso-8859-1"?>
<BMECAT version="1.2" xmlns="http://www.bmecat.org/bmecat/1.2/bmecat_new_catalog">
<HEADER>
<GENERATOR_INFO>Created by LxBMECAT 1.0</GENERATOR_INFO>
<CATALOG>
<LANGUAGE>DEU</LANGUAGE>
<CATALOG_ID></CATALOG_ID>
<CATALOG_VERSION>1.0</CATALOG_VERSION>
<CURRENCY>EUR</CURRENCY>
<DATETIME type="generation_date">
<TIME>18:33:56</TIME>
<DATE>2007-12-19</DATE>
</DATETIME>
</CATALOG>
<SUPPLIER>
<SUPPLIER_NAME>Lexware faktura+auftrag</SUPPLIER_NAME>
</SUPPLIER>
</HEADER>
<T_NEW_CATALOG>
<CATALOG_GROUP_SYSTEM>
<CATALOG_STRUCTURE type="root">
<GROUP_ID>1</GROUP_ID>
<GROUP_NAME>Produktgruppen</GROUP_NAME>
<PARENT_ID>0</PARENT_ID>
<GROUP_DESCRIPTION> </GROUP_DESCRIPTION>
<USER_DEFINED_EXTENSIONS>
<UDX.ARTICLE_SORT_ORDER>0</UDX.ARTICLE_SORT_ORDER>
</USER_DEFINED_EXTENSIONS>
</CATALOG_STRUCTURE>
<CATALOG_STRUCTURE type="leaf">
<GROUP_ID>2</GROUP_ID>
<GROUP_NAME>Bücher</GROUP_NAME>
<PARENT_ID>1</PARENT_ID>
<USER_DEFINED_EXTENSIONS>
<UDX.ARTICLE_SORT_ORDER>0</UDX.ARTICLE_SORT_ORDER>
</USER_DEFINED_EXTENSIONS>
</CATALOG_STRUCTURE>
<CATALOG_STRUCTURE type="leaf">
<GROUP_ID>3</GROUP_ID>
<GROUP_NAME>Lexware Pro</GROUP_NAME>
<PARENT_ID>1</PARENT_ID>
<USER_DEFINED_EXTENSIONS>
<UDX.ARTICLE_SORT_ORDER>0</UDX.ARTICLE_SORT_ORDER>
</USER_DEFINED_EXTENSIONS>
</CATALOG_STRUCTURE>
<CATALOG_STRUCTURE type="leaf">
<GROUP_ID>4</GROUP_ID>
<GROUP_NAME>Software Lexware</GROUP_NAME>
<PARENT_ID>1</PARENT_ID>
<USER_DEFINED_EXTENSIONS>
<UDX.ARTICLE_SORT_ORDER>0</UDX.ARTICLE_SORT_ORDER>
</USER_DEFINED_EXTENSIONS>
</CATALOG_STRUCTURE>
<CATALOG_STRUCTURE type="leaf">
<GROUP_ID>5</GROUP_ID>
<GROUP_NAME>Software/Stückliste</GROUP_NAME>
<PARENT_ID>1</PARENT_ID>
<USER_DEFINED_EXTENSIONS>
<UDX.ARTICLE_SORT_ORDER>0</UDX.ARTICLE_SORT_ORDER>
</USER_DEFINED_EXTENSIONS>
</CATALOG_STRUCTURE>
</CATALOG_GROUP_SYSTEM>
<ARTICLE>
<SUPPLIER_AID>5</SUPPLIER_AID>
<MIME_INFO>
<MIME>
<MIME_TYPE>image/jpeg</MIME_TYPE>
<MIME_SOURCE>/article_images/lexware.jpg</MIME_SOURCE>
<MIME_PURPOSE>normal</MIME_PURPOSE>
</MIME>
</MIME_INFO>
<ARTICLE_ORDER_DETAILS>
<ORDER_UNIT>C62</ORDER_UNIT>
</ARTICLE_ORDER_DETAILS>
<ARTICLE_DETAILS>
<DESCRIPTION_SHORT>Lexware financial office 2005</DESCRIPTION_SHORT>
<DESCRIPTION_LONG>Die ideale Komplettlösung - Buchhaltung, Faktura und Lohnabrechnung in einem Paket.</DESCRIPTION_LONG>
</ARTICLE_DETAILS>
<ARTICLE_FEATURES>
<FEATURE>
<FNAME>Gewicht</FNAME>
<FVALUE>0.800000</FVALUE>
</FEATURE>
<FEATURE>
<FNAME>artikelnr</FNAME>
<FVALUE>109017</FVALUE>
</FEATURE>
<FEATURE>
<FNAME>beschreibung</FNAME>
</FEATURE>
</ARTICLE_FEATURES>
<ARTICLE_PRICE_DETAILS>
<ARTICLE_PRICE type="net_list">
<PRICE_AMOUNT>249.9000</PRICE_AMOUNT>
<TAX>0.1600</TAX>
</ARTICLE_PRICE>
</ARTICLE_PRICE_DETAILS>
<USER_DEFINED_EXTENSIONS>
<UDX.ARBITRARY_DATA>3;249.9000</UDX.ARBITRARY_DATA>
</USER_DEFINED_EXTENSIONS>
</ARTICLE>
<ARTICLE>
<SUPPLIER_AID>6</SUPPLIER_AID>
<MIME_INFO/>
<ARTICLE_ORDER_DETAILS>
<ORDER_UNIT>C62</ORDER_UNIT>
</ARTICLE_ORDER_DETAILS>
<ARTICLE_DETAILS>
<DESCRIPTION_SHORT>Lexware financial office pro</DESCRIPTION_SHORT>
<DESCRIPTION_LONG>Das neue Lexware financial office pro ist die Traumkombination für ihre Buchhaltung.</DESCRIPTION_LONG>
</ARTICLE_DETAILS>
<ARTICLE_FEATURES>
<FEATURE>
<FNAME>Gewicht</FNAME>
<FVALUE>0.400000</FVALUE>
</FEATURE>
<FEATURE>
<FNAME>artikelnr</FNAME>
<FVALUE>109018</FVALUE>
</FEATURE>
<FEATURE>
<FNAME>beschreibung</FNAME>
</FEATURE>
</ARTICLE_FEATURES>
<ARTICLE_PRICE_DETAILS>
<ARTICLE_PRICE type="net_list">
<PRICE_AMOUNT>688.7900</PRICE_AMOUNT>
<TAX>0.1600</TAX>
</ARTICLE_PRICE>
</ARTICLE_PRICE_DETAILS>
<USER_DEFINED_EXTENSIONS>
<UDX.ARBITRARY_DATA>3;688.7900</UDX.ARBITRARY_DATA>
</USER_DEFINED_EXTENSIONS>
</ARTICLE>
<ARTICLE_TO_CATALOGGROUP_MAP>
<ART_ID>5</ART_ID>
<CATALOG_GROUP_ID>5</CATALOG_GROUP_ID>
</ARTICLE_TO_CATALOGGROUP_MAP>
<ARTICLE_TO_CATALOGGROUP_MAP>
<ART_ID>6</ART_ID>
<CATALOG_GROUP_ID>3</CATALOG_GROUP_ID>
</ARTICLE_TO_CATALOGGROUP_MAP>
</T_NEW_CATALOG>
</BMECAT>
Meine Datenbank enthält folgende Tabellen und Felder, welche mit dem Inhalt aus der Datei gefüllt werden sollen:
Tabellen Felder
Katalog Catalog_ID Catalog_Version Currency Date Time Supplier Language Generator
Gruppen Group_ID Parent_ID Group_Name Structure_Type Sort_Order
Artikel Article_ID Group_ID Description_Short Description_Long Feature_Gewicht Feature_ArtikelNr Feature_Varianten Order_Unit Price_Amount Price_Type Tax Arbitary_Data Mime_Type_1 Mime_Source_1 Mime_Purpose_2 Mime_Source_2 Mime_Purpose_2
Wäre sehr Dankbar, wenn mir als Laie das jemand Verständlich erklären könnte (am besten mit einem Code- Beispiel)
LastBoyScout
Da ich bis dato mit XML noch nix zu tun hatte, hab ich da mal ein kleines Problem:
Ich möchte gern die Daten aus einer BMEcat XML- Katalogdatei mittels PHP in eine Datenbank Importieren, weis aber nicht wie ich das am besten Anstelle?
Hier mal der Inhalt der catalog.xml zur Veranschaulichung:
<?xml version="1.0" encoding="iso-8859-1"?>
<BMECAT version="1.2" xmlns="http://www.bmecat.org/bmecat/1.2/bmecat_new_catalog">
<HEADER>
<GENERATOR_INFO>Created by LxBMECAT 1.0</GENERATOR_INFO>
<CATALOG>
<LANGUAGE>DEU</LANGUAGE>
<CATALOG_ID></CATALOG_ID>
<CATALOG_VERSION>1.0</CATALOG_VERSION>
<CURRENCY>EUR</CURRENCY>
<DATETIME type="generation_date">
<TIME>18:33:56</TIME>
<DATE>2007-12-19</DATE>
</DATETIME>
</CATALOG>
<SUPPLIER>
<SUPPLIER_NAME>Lexware faktura+auftrag</SUPPLIER_NAME>
</SUPPLIER>
</HEADER>
<T_NEW_CATALOG>
<CATALOG_GROUP_SYSTEM>
<CATALOG_STRUCTURE type="root">
<GROUP_ID>1</GROUP_ID>
<GROUP_NAME>Produktgruppen</GROUP_NAME>
<PARENT_ID>0</PARENT_ID>
<GROUP_DESCRIPTION> </GROUP_DESCRIPTION>
<USER_DEFINED_EXTENSIONS>
<UDX.ARTICLE_SORT_ORDER>0</UDX.ARTICLE_SORT_ORDER>
</USER_DEFINED_EXTENSIONS>
</CATALOG_STRUCTURE>
<CATALOG_STRUCTURE type="leaf">
<GROUP_ID>2</GROUP_ID>
<GROUP_NAME>Bücher</GROUP_NAME>
<PARENT_ID>1</PARENT_ID>
<USER_DEFINED_EXTENSIONS>
<UDX.ARTICLE_SORT_ORDER>0</UDX.ARTICLE_SORT_ORDER>
</USER_DEFINED_EXTENSIONS>
</CATALOG_STRUCTURE>
<CATALOG_STRUCTURE type="leaf">
<GROUP_ID>3</GROUP_ID>
<GROUP_NAME>Lexware Pro</GROUP_NAME>
<PARENT_ID>1</PARENT_ID>
<USER_DEFINED_EXTENSIONS>
<UDX.ARTICLE_SORT_ORDER>0</UDX.ARTICLE_SORT_ORDER>
</USER_DEFINED_EXTENSIONS>
</CATALOG_STRUCTURE>
<CATALOG_STRUCTURE type="leaf">
<GROUP_ID>4</GROUP_ID>
<GROUP_NAME>Software Lexware</GROUP_NAME>
<PARENT_ID>1</PARENT_ID>
<USER_DEFINED_EXTENSIONS>
<UDX.ARTICLE_SORT_ORDER>0</UDX.ARTICLE_SORT_ORDER>
</USER_DEFINED_EXTENSIONS>
</CATALOG_STRUCTURE>
<CATALOG_STRUCTURE type="leaf">
<GROUP_ID>5</GROUP_ID>
<GROUP_NAME>Software/Stückliste</GROUP_NAME>
<PARENT_ID>1</PARENT_ID>
<USER_DEFINED_EXTENSIONS>
<UDX.ARTICLE_SORT_ORDER>0</UDX.ARTICLE_SORT_ORDER>
</USER_DEFINED_EXTENSIONS>
</CATALOG_STRUCTURE>
</CATALOG_GROUP_SYSTEM>
<ARTICLE>
<SUPPLIER_AID>5</SUPPLIER_AID>
<MIME_INFO>
<MIME>
<MIME_TYPE>image/jpeg</MIME_TYPE>
<MIME_SOURCE>/article_images/lexware.jpg</MIME_SOURCE>
<MIME_PURPOSE>normal</MIME_PURPOSE>
</MIME>
</MIME_INFO>
<ARTICLE_ORDER_DETAILS>
<ORDER_UNIT>C62</ORDER_UNIT>
</ARTICLE_ORDER_DETAILS>
<ARTICLE_DETAILS>
<DESCRIPTION_SHORT>Lexware financial office 2005</DESCRIPTION_SHORT>
<DESCRIPTION_LONG>Die ideale Komplettlösung - Buchhaltung, Faktura und Lohnabrechnung in einem Paket.</DESCRIPTION_LONG>
</ARTICLE_DETAILS>
<ARTICLE_FEATURES>
<FEATURE>
<FNAME>Gewicht</FNAME>
<FVALUE>0.800000</FVALUE>
</FEATURE>
<FEATURE>
<FNAME>artikelnr</FNAME>
<FVALUE>109017</FVALUE>
</FEATURE>
<FEATURE>
<FNAME>beschreibung</FNAME>
</FEATURE>
</ARTICLE_FEATURES>
<ARTICLE_PRICE_DETAILS>
<ARTICLE_PRICE type="net_list">
<PRICE_AMOUNT>249.9000</PRICE_AMOUNT>
<TAX>0.1600</TAX>
</ARTICLE_PRICE>
</ARTICLE_PRICE_DETAILS>
<USER_DEFINED_EXTENSIONS>
<UDX.ARBITRARY_DATA>3;249.9000</UDX.ARBITRARY_DATA>
</USER_DEFINED_EXTENSIONS>
</ARTICLE>
<ARTICLE>
<SUPPLIER_AID>6</SUPPLIER_AID>
<MIME_INFO/>
<ARTICLE_ORDER_DETAILS>
<ORDER_UNIT>C62</ORDER_UNIT>
</ARTICLE_ORDER_DETAILS>
<ARTICLE_DETAILS>
<DESCRIPTION_SHORT>Lexware financial office pro</DESCRIPTION_SHORT>
<DESCRIPTION_LONG>Das neue Lexware financial office pro ist die Traumkombination für ihre Buchhaltung.</DESCRIPTION_LONG>
</ARTICLE_DETAILS>
<ARTICLE_FEATURES>
<FEATURE>
<FNAME>Gewicht</FNAME>
<FVALUE>0.400000</FVALUE>
</FEATURE>
<FEATURE>
<FNAME>artikelnr</FNAME>
<FVALUE>109018</FVALUE>
</FEATURE>
<FEATURE>
<FNAME>beschreibung</FNAME>
</FEATURE>
</ARTICLE_FEATURES>
<ARTICLE_PRICE_DETAILS>
<ARTICLE_PRICE type="net_list">
<PRICE_AMOUNT>688.7900</PRICE_AMOUNT>
<TAX>0.1600</TAX>
</ARTICLE_PRICE>
</ARTICLE_PRICE_DETAILS>
<USER_DEFINED_EXTENSIONS>
<UDX.ARBITRARY_DATA>3;688.7900</UDX.ARBITRARY_DATA>
</USER_DEFINED_EXTENSIONS>
</ARTICLE>
<ARTICLE_TO_CATALOGGROUP_MAP>
<ART_ID>5</ART_ID>
<CATALOG_GROUP_ID>5</CATALOG_GROUP_ID>
</ARTICLE_TO_CATALOGGROUP_MAP>
<ARTICLE_TO_CATALOGGROUP_MAP>
<ART_ID>6</ART_ID>
<CATALOG_GROUP_ID>3</CATALOG_GROUP_ID>
</ARTICLE_TO_CATALOGGROUP_MAP>
</T_NEW_CATALOG>
</BMECAT>
Meine Datenbank enthält folgende Tabellen und Felder, welche mit dem Inhalt aus der Datei gefüllt werden sollen:
Tabellen Felder
Katalog Catalog_ID Catalog_Version Currency Date Time Supplier Language Generator
Gruppen Group_ID Parent_ID Group_Name Structure_Type Sort_Order
Artikel Article_ID Group_ID Description_Short Description_Long Feature_Gewicht Feature_ArtikelNr Feature_Varianten Order_Unit Price_Amount Price_Type Tax Arbitary_Data Mime_Type_1 Mime_Source_1 Mime_Purpose_2 Mime_Source_2 Mime_Purpose_2
Wäre sehr Dankbar, wenn mir als Laie das jemand Verständlich erklären könnte (am besten mit einem Code- Beispiel)
LastBoyScout
Kommentar