XML-Datei importieren
Moderator: Moderatoren
-
- ****
- Beiträge: 119
- Registriert: Di, 28.11.2006 19:44
- Wohnort: Meppen
XML-Datei importieren
Hallo
Zum ersten Mal in meinem Leben stehe ich vor der Aufgabe, eine XML-Datei in Open-Office zu importieren. Der Inhalt wird mir immer als Text und nicht als Tabelle (wie es sein müsste) angezeigt. Wer kann mir helfen??
Die XML-Datei hat (um viele Datensätze gekürzt) folgenden Inhalt:
<?xml version="1.0" encoding="iso-8859-2" ?>
<DS>
<LFI>
<MID>49</MID>
<MAGS>100010</MAGS>
<FN>2006490</FN>
<Fdat>15.11.2006</Fdat>
<BZ>Tür</BZ>
<HS>Vernanda</HS>
<IDNR>030040088</IDNR>
<ST>0</ST>
<VerS></VerS>
<VerW></VerW>
</LFI>
<LFI>
<MID>49</MID>
<MAGS>100010</MAGS>
<FN>2006486</FN>
<Fdat>15.11.2006</Fdat>
<BZ>Fenster</BZ>
<HS>Dachschräge</HS>
<IDNR>nicht auffindbar</IDNR>
<ST>0</ST>
<VerS></VerS>
<VerW></VerW>
</LFI>
</DS>
Danke schon jetzt..
Friedhelm
Zum ersten Mal in meinem Leben stehe ich vor der Aufgabe, eine XML-Datei in Open-Office zu importieren. Der Inhalt wird mir immer als Text und nicht als Tabelle (wie es sein müsste) angezeigt. Wer kann mir helfen??
Die XML-Datei hat (um viele Datensätze gekürzt) folgenden Inhalt:
<?xml version="1.0" encoding="iso-8859-2" ?>
<DS>
<LFI>
<MID>49</MID>
<MAGS>100010</MAGS>
<FN>2006490</FN>
<Fdat>15.11.2006</Fdat>
<BZ>Tür</BZ>
<HS>Vernanda</HS>
<IDNR>030040088</IDNR>
<ST>0</ST>
<VerS></VerS>
<VerW></VerW>
</LFI>
<LFI>
<MID>49</MID>
<MAGS>100010</MAGS>
<FN>2006486</FN>
<Fdat>15.11.2006</Fdat>
<BZ>Fenster</BZ>
<HS>Dachschräge</HS>
<IDNR>nicht auffindbar</IDNR>
<ST>0</ST>
<VerS></VerS>
<VerW></VerW>
</LFI>
</DS>
Danke schon jetzt..
Friedhelm
Re: XML-Datei importieren
Woher soll OOo Calc wissen, wie die Tabelle aufzubauen ist?Hömmelmann hat geschrieben:Zum ersten Mal in meinem Leben stehe ich vor der Aufgabe, eine XML-Datei in Open-Office zu importieren. Der Inhalt wird mir immer als Text und nicht als Tabelle (wie es sein müsste) angezeigt.
Du musst einen XSLT-Filter schreiben. Im englischsprachigen OOo Forum gab es vor kurzer Zeit einen Thread zu dem Thema: http://www.oooforum.org/forum/viewtopic ... hlight=xmlHömmelmann hat geschrieben:Wer kann mir helfen??
Da die dort eingelesene XML-Datei ein anderes Format hat, musst du den dort geposteten XSLT-Filter natürlich an deine XML-Datei anpassen.
In OOo bindest du den XSLT-Filter über "Extras" > "XML-Filtereinstellungen..." ein.
Und wenn du den XSLT-Filter eingebunden hast, kannst du deine XML-Datei öffnen, wenn du deinen XSLT-Filter als Dateityp auswählst.
Regards
hol.sten
Hallo Friedhelm
Du möchtest vermutlich die <Tags> als Spaltenüberschriften und die Inhalte der Datensätze
zeilenweise ensprechend unter den Tags eingeordnet ?
ist die Reihenfolge der Tags und die Anzahl der Zeilen pro Datensatz gleich ?
Ich hab sowas mal 'halbautomatisiert' mit diversen Tabellenfunktionen gelöst, ist aber etwas kompliziert das allgemein zu erklären.
Gruß Karo
Du möchtest vermutlich die <Tags> als Spaltenüberschriften und die Inhalte der Datensätze
zeilenweise ensprechend unter den Tags eingeordnet ?
ist die Reihenfolge der Tags und die Anzahl der Zeilen pro Datensatz gleich ?
Ich hab sowas mal 'halbautomatisiert' mit diversen Tabellenfunktionen gelöst, ist aber etwas kompliziert das allgemein zu erklären.
Gruß Karo
-
- ****
- Beiträge: 119
- Registriert: Di, 28.11.2006 19:44
- Wohnort: Meppen
Hallo,
danke erstmal für die schnelle Antwort. den XSL-Filter muß ich gleich noch anpassen. Aber ich habe schon wieder eine Frage:
Bedeutet der Filtereintrag: xsl="http://www.w3.org/1999/XSL/Transform" dass eine Internetverbindung vorhanden sein muß?
Für Karo:
Ja, deine Vermutung trifft den Kern der Sache und natürlich hätte ich Interresse an eine (wenn auch nur halb-) automatischen Lösung.
Gruß, Friedhelm
danke erstmal für die schnelle Antwort. den XSL-Filter muß ich gleich noch anpassen. Aber ich habe schon wieder eine Frage:
Bedeutet der Filtereintrag: xsl="http://www.w3.org/1999/XSL/Transform" dass eine Internetverbindung vorhanden sein muß?
Für Karo:
Ja, deine Vermutung trifft den Kern der Sache und natürlich hätte ich Interresse an eine (wenn auch nur halb-) automatischen Lösung.
Gruß, Friedhelm
-
- ****
- Beiträge: 119
- Registriert: Di, 28.11.2006 19:44
- Wohnort: Meppen
Hallo Freidhelm
Gruß Karo
Um das herauszufinden, postest du am besten mal den umgeschriebenen Filter , evtl. ist da ein Fehler, wie groß ist die xml-Datei ?Beim Öffnen der Datei geht der blaue Ladebalken bis zur Mitte, dann rührt sich nichts mehr (Hier wäre jetzt ein Smili mit einem Strick um den Hals angebracht).
Woran kann das liegen??
Gruß Karo
-
- ****
- Beiträge: 119
- Registriert: Di, 28.11.2006 19:44
- Wohnort: Meppen
Hallo Karolus,
die Anzahl der Datensätze in der XML-Datei ist mir nicht genau bekannt, geschätzte 70-100.
hier der XSL-Filter:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns
1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns
1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.0">
<office:body>
<office:spreadsheet>
<table:table>
<table:table-row>
<table:table-cell><text:p></text:p>MID</table:table-cell>
<table:table-cell><text:p></text:p>MAGS</table:table-cell>
<table:table-cell><text:p></text:p>FN</table:table-cell>
<table:table-cell><text:p></text:p>Fdat</table:table-cell>
<table:table-cell><text:p></text:p>BZ</table:table-cell>
<table:table-cell><text:p></text:p>HS</table:table-cell>
<table:table-cell><text:p></text:p>IDNR</table:table-cell>
<table:table-cell><text:p></text:p>ST</table:table-cell>
<table:table-cell><text:p></text:p>VerS</table:table-cell>
<table:table-cell><text:p></text:p>VerW</table:table-cell>
</table:table-row>
<xsl:for-each select="DS/LFI">
<table:table-row>
<table:table-cell><text:p><xsl:value-of select="MID"/></text:p></table:table-cell>
<table:table-cell><text:p><xsl:value-of select="MAGS"/></text:p></table:table-cell>
<table:table-cell><text:p><xsl:value-of select="FN"/></text:p></table:table-cell>
<table:table-cell><text:p><xsl:value-of select="Fdat"/></text:p></table:table-cell>
<table:table-cell><text:p><xsl:value-of select="BZ"/></text:p></table:table-cell>
<table:table-cell><text:p><xsl:value-of select="HS"/></text:p></table:table-cell>
<table:table-cell><text:p><xsl:value-of select="IDNR"/></text:p></table:table-cell>
<table:table-cell><text:p><xsl:value-of select="ST"/></text:p></table:table-cell>
<table:table-cell><text:p><xsl:value-of select="VerS"/></text:p></table:table-cell>
<table:table-cell><text:p><xsl:value-of select="VerW"/></text:p></table:table-cell>
</table:table-row>
</xsl:for-each>
</table:table>
</office:spreadsheet>
</office:body>
</office:document-content>
</xsl:template>
</xsl:stylesheet>
Friedhelm
die Anzahl der Datensätze in der XML-Datei ist mir nicht genau bekannt, geschätzte 70-100.
hier der XSL-Filter:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns
<office:body>
<office:spreadsheet>
<table:table>
<table:table-row>
<table:table-cell><text:p></text:p>MID</table:table-cell>
<table:table-cell><text:p></text:p>MAGS</table:table-cell>
<table:table-cell><text:p></text:p>FN</table:table-cell>
<table:table-cell><text:p></text:p>Fdat</table:table-cell>
<table:table-cell><text:p></text:p>BZ</table:table-cell>
<table:table-cell><text:p></text:p>HS</table:table-cell>
<table:table-cell><text:p></text:p>IDNR</table:table-cell>
<table:table-cell><text:p></text:p>ST</table:table-cell>
<table:table-cell><text:p></text:p>VerS</table:table-cell>
<table:table-cell><text:p></text:p>VerW</table:table-cell>
</table:table-row>
<xsl:for-each select="DS/LFI">
<table:table-row>
<table:table-cell><text:p><xsl:value-of select="MID"/></text:p></table:table-cell>
<table:table-cell><text:p><xsl:value-of select="MAGS"/></text:p></table:table-cell>
<table:table-cell><text:p><xsl:value-of select="FN"/></text:p></table:table-cell>
<table:table-cell><text:p><xsl:value-of select="Fdat"/></text:p></table:table-cell>
<table:table-cell><text:p><xsl:value-of select="BZ"/></text:p></table:table-cell>
<table:table-cell><text:p><xsl:value-of select="HS"/></text:p></table:table-cell>
<table:table-cell><text:p><xsl:value-of select="IDNR"/></text:p></table:table-cell>
<table:table-cell><text:p><xsl:value-of select="ST"/></text:p></table:table-cell>
<table:table-cell><text:p><xsl:value-of select="VerS"/></text:p></table:table-cell>
<table:table-cell><text:p><xsl:value-of select="VerW"/></text:p></table:table-cell>
</table:table-row>
</xsl:for-each>
</table:table>
</office:spreadsheet>
</office:body>
</office:document-content>
</xsl:template>
</xsl:stylesheet>
Friedhelm
Hallo Friedhelm
An dieser Stelle :
Berichtige das mal, hier funktionierts (mit einer mini-Test.xml aus deinen 2 Datensätzen)
ansonsten sind 70 bis 100 Datensätze nicht wirklich viel.
Gruß Karo
An dieser Stelle :
sind dir zwei kleine Zeilen abhanden gekommen; richtig wäre :
Code: Alles auswählen
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.0">
<xsl:template match="/">
<office:document>
<office:body>
ansonsten sind 70 bis 100 Datensätze nicht wirklich viel.
Gruß Karo
Hallo nochmal
Mir sind da noch Fehler ? aufgefallen, ich poste mal den ganzen "friedhelm.xsl"-filter :
Gruß Karo
Mir sind da noch Fehler ? aufgefallen, ich poste mal den ganzen "friedhelm.xsl"-filter :
Code: Alles auswählen
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.0">
<xsl:template match="/">
<office:document>
<office:body>
<office:spreadsheet>
<table:table>
<table:table-row>
<table:table-cell><text:p>MID</text:p></table:table-cell>
<table:table-cell><text:p>MAGS</text:p></table:table-cell>
<table:table-cell><text:p>FN</text:p></table:table-cell>
<table:table-cell><text:p>Fdat</text:p></table:table-cell>
<table:table-cell><text:p>BZ</text:p></table:table-cell>
<table:table-cell><text:p>HS</text:p></table:table-cell>
<table:table-cell><text:p>IDNR</text:p></table:table-cell>
<table:table-cell><text:p>ST</text:p></table:table-cell>
<table:table-cell><text:p>VerS</text:p></table:table-cell>
<table:table-cell><text:p>VerW</text:p></table:table-cell>
</table:table-row>
<xsl:for-each select="DS/LFI">
<table:table-row>
<table:table-cell><text:p><xsl:value-of select="MID"/></text:p></table:table-cell>
<table:table-cell><text:p><xsl:value-of select="MAGS"/></text:p></table:table-cell>
<table:table-cell><text:p><xsl:value-of select="FN"/></text:p></table:table-cell>
<table:table-cell><text:p><xsl:value-of select="Fdat"/></text:p></table:table-cell>
<table:table-cell><text:p><xsl:value-of select="BZ"/></text:p></table:table-cell>
<table:table-cell><text:p><xsl:value-of select="HS"/></text:p></table:table-cell>
<table:table-cell><text:p><xsl:value-of select="IDNR"/></text:p></table:table-cell>
<table:table-cell><text:p><xsl:value-of select="ST"/></text:p></table:table-cell>
<table:table-cell><text:p><xsl:value-of select="VerS"/></text:p></table:table-cell>
<table:table-cell><text:p><xsl:value-of select="VerW"/></text:p></table:table-cell>
</table:table-row>
</xsl:for-each>
</table:table>
</office:spreadsheet>
</office:body>
</office:document>
</xsl:template>
</xsl:stylesheet>
-
- ****
- Beiträge: 119
- Registriert: Di, 28.11.2006 19:44
- Wohnort: Meppen
Hat geklappt
Hallo und guten Tag,
endlich hatte ich Zeit für einen neuen Test.
Es hat prima geklappt, allerdings nur mit der OO-Version 2. Da ich aber auf einem zweiten System mit der OO-Version 1.1 arbeiten muß, habe ich dort ebenfalls den XML-Import versucht.
Ich bekomme nur eine leere Datei angezeigt.
Das Problem dürfte beim XML-Filter zu suchen sein:
Auch OO 2.0.4 liefert eine leere Tabelle wenn ich in den XML-Filter-Einstellungen als Anwendung OpenOffice Calc (.sxc) eintrage.
Könnte es dafür auch eine Lösung geben??
Auf jeden Fall schon mal recht herzlichen Dank.
Friedhelm
endlich hatte ich Zeit für einen neuen Test.
Es hat prima geklappt, allerdings nur mit der OO-Version 2. Da ich aber auf einem zweiten System mit der OO-Version 1.1 arbeiten muß, habe ich dort ebenfalls den XML-Import versucht.
Ich bekomme nur eine leere Datei angezeigt.
Das Problem dürfte beim XML-Filter zu suchen sein:
Auch OO 2.0.4 liefert eine leere Tabelle wenn ich in den XML-Filter-Einstellungen als Anwendung OpenOffice Calc (.sxc) eintrage.
Könnte es dafür auch eine Lösung geben??
Auf jeden Fall schon mal recht herzlichen Dank.
Friedhelm