22. Juni 2007 12:57
filenameTxt := 'C:\begleitschein.xml';
Datei.OPEN(filenameTxt);
Datei.CREATEINSTREAM(Instr);
......
importXMLFile(Instr,68000);
......
filename := dialogManagement.OpenFile('XML-Datei importieren','',4,'XML-Dateien (*.xml)|*.xml',0);
Datei.OPEN(filenameTxt);
Datei.CREATEINSTREAM(Instr);
......
importXMLFile(Instr,68000);
......
importXMLFile(VAR InStr : InStream;XmlPortNo : Integer) ret : Boolean
{
TempXMLMessage."XML Request".CREATEOUTSTREAM(StreamMessageOut);
TempXMLMessage."XML Request".CREATEINSTREAM(StreamMessageIn);
IF ISCLEAR(XMLDoc1) THEN
CREATE(XMLDoc1);
IF ISCLEAR(XMLDoc2) THEN
CREATE(XMLDoc2);
XMLDoc1.load(InStr);
RemoveNamespace(XMLDoc1,XMLDoc2);
XMLDoc2.save(StreamMessageOut); //Hier kracht's!!!!!!
ret := XMLPORT.IMPORT(XmlPortNo, StreamMessageIn);
TempXMLMessage."XML Request".CREATEINSTREAM(StreamMessageIn);
CLEAR(XMLDoc1);
CLEAR(XMLDoc2);
}
RemoveNamespace(XMLSourceDocument : Automation "'Microsoft XML, v4.0'.DOMDocument40";VAR XMLDestinationDocument : Automation "'Microsof
{
IF ISCLEAR(XMLDestinationDocument) THEN
CREATE(XMLDestinationDocument);
TempXMLMessage."XML Request".CREATEOUTSTREAM(StreamStylesheet1);
TempXMLMessage."XML Request".CREATEINSTREAM(StreamStylesheet2);
StreamStylesheet1.WRITETEXT('<?xml version="1.0" encoding="UTF-8"?>');
StreamStylesheet1.WRITETEXT('<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">');
StreamStylesheet1.WRITETEXT('<xsl:output method="xml" encoding="UTF-8" />');
StreamStylesheet1.WRITETEXT('<xsl:template match="/">');
StreamStylesheet1.WRITETEXT('<xsl:copy>');
StreamStylesheet1.WRITETEXT('<xsl:apply-templates />');
StreamStylesheet1.WRITETEXT('</xsl:copy>');
StreamStylesheet1.WRITETEXT('</xsl:template>');
StreamStylesheet1.WRITETEXT('<xsl:template match="*">');
StreamStylesheet1.WRITETEXT('<xsl:element name="{local-name()}">');
StreamStylesheet1.WRITETEXT('<xsl:apply-templates select="@* | node()" />');
StreamStylesheet1.WRITETEXT('</xsl:element>');
StreamStylesheet1.WRITETEXT('</xsl:template>');
StreamStylesheet1.WRITETEXT('<xsl:template match="@*">');
StreamStylesheet1.WRITETEXT('<xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>');
StreamStylesheet1.WRITETEXT('</xsl:template>');
StreamStylesheet1.WRITETEXT('<xsl:template match="text() | processing-instruction() | comment()">');
StreamStylesheet1.WRITETEXT('<xsl:copy />');
StreamStylesheet1.WRITETEXT('</xsl:template>');
StreamStylesheet1.WRITETEXT('</xsl:stylesheet>');
IF ISCLEAR(XMLStyleSheet) THEN
CREATE(XMLStyleSheet);
XMLStyleSheet.load(StreamStylesheet2);
XMLSourceDocument.transformNodeToObject(XMLStyleSheet,XMLDestinationDocument);
CLEAR(XMLStyleSheet);
}
22. Juni 2007 13:48