XML-Datei importieren

Antwort erstellen


BBCode ist eingeschaltet
[img] ist ausgeschaltet
[url] ist eingeschaltet
Smileys sind ausgeschaltet

Die letzten Beiträge des Themas
   

Ansicht erweitern Die letzten Beiträge des Themas: XML-Datei importieren

Hat geklappt

von Hömmelmann » Mo, 22.01.2007 12:04

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

von Karolus » Fr, 19.01.2007 12:38

Hallo nochmal

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>
Gruß Karo

von Karolus » Fr, 19.01.2007 12:16

Hallo Friedhelm

An dieser Stelle :
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.0">
....
<office:body>
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>
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

von Hömmelmann » Fr, 19.01.2007 09:51

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: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">
<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

von Karolus » Fr, 19.01.2007 08:39

Hallo Freidhelm
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??
Um das herauszufinden, postest du am besten mal den umgeschriebenen Filter , evtl. ist da ein Fehler, wie groß ist die xml-Datei ?

Gruß Karo

von Hömmelmann » Fr, 19.01.2007 08:30

Hallo Karolus

Stimmt, Internet ist nicht nötig. Trotzdem hakt es noch:

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??


Friedhelm

von Karolus » Fr, 19.01.2007 08:24

Hallo Friedhelm

Ich hab mich jetzt (erstmals) mit dem Thema "xslt-filter" befasst, und denke dass es auf diesem Weg funktioniert, damit wird ja meine Halbautomatik überflüssig.

Nein eine bestehende Internetverbindung brauchst beim Einsatz des Filters nicht.

Gruß Karo

von Hömmelmann » Fr, 19.01.2007 07:51

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

von Karolus » Do, 18.01.2007 18:17

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

Re: XML-Datei importieren

von hol.sten » Do, 18.01.2007 18:08

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.
Woher soll OOo Calc wissen, wie die Tabelle aufzubauen ist?
Hömmelmann hat geschrieben:Wer kann mir helfen??
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=xml

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

XML-Datei importieren

von Hömmelmann » Do, 18.01.2007 14:47

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

Nach oben