KennyAround
Member
Is possible to use Read-XML() just to read part of an XML file instead of the whole file? Say, from an XML file of transactions from all accounts, is it possible just to read in those from a certain account?
DEFINE TEMP-TABLE tt NO-UNDO
FIELD id AS INT
FIELD gl AS INT
.
CREATE tt. ASSIGN tt.id = 1 tt.gl = 1000.
CREATE tt. ASSIGN tt.id = 2 tt.gl = 2000.
CREATE tt. ASSIGN tt.id = 3 tt.gl = 1000.
TEMP-TABLE tt:DEFAULT-BUFFER-HANDLE:WRITE-XML( "file", "c:/temp/tt.xml" ).
MESSAGE "file created" VIEW-AS ALERT-BOX.
EMPTY TEMP-TABLE tt.
TEMP-TABLE tt:DEFAULT-BUFFER-HANDLE:READ-XML( "file", "c:/temp/tt.xml", ?, ?, ? ).
FOR EACH tt:
DISPLAY tt.
END.
<?xml version="1.0"?>
<tt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ttRow>
<id>1</id>
<gl>1000</gl>
</ttRow>
<ttRow>
<id>2</id>
<gl>2000</gl>
</ttRow>
<ttRow>
<id>3</id>
<gl>1000</gl>
</ttRow>
</tt>
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<tt>
<xsl:for-each select="tt/ttRow[gl='1000']">
<ttRow>
<xsl:copy-of select="id"/>
<xsl:copy-of select="gl"/>
</ttRow>
</xsl:for-each>
</tt>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="tt.filter.xsl"?>
<tt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ttRow>
<id>1</id>
<gl>1000</gl>
</ttRow>
<ttRow>
<id>2</id>
<gl>2000</gl>
</ttRow>
<ttRow>
<id>3</id>
<gl>1000</gl>
</ttRow>
</tt>
No.
I had a quick try with importing an XML file with an XSL that performs a select, but the transformation is ignored.