Hi guys
I am testing out write-xml method and have a problem with naming the nodes.
The simple test-program:
def temp-table tt
xml-node-name "entries"
field tf1 as char
field tf2 as int.
def var a as logical no-undo.
create tt.
assign tt.tf1 = 'test'
tt.tf2 = 123.
create tt .
assign tt.tf1 = 'test2'
tt.tf2 = 321.
/* Dump temp-table as xml */
a = temp-table tt:write-xml("file","c:\Temp\tt.xml",true,"ISO-8859-1",?,false,false).
Gives me this xml-file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<entries xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<entriesRow>
<tf1>test</tf1>
<tf2>123</tf2>
</entriesRow>
<entriesRow>
<tf1>test2</tf1>
<tf2>321</tf2>
</entriesRow>
</entries>
My 2 problems are:
1. I don't wnat the "xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance". Is it possible to specify not to write this into the file ?
2. My temp-table has name set to "entries". The write-xml method puts out every record with name: <entriesRow>. Is it possible to specify what this name should be.
This is the result i am looking for:
<?xml version="1.0" encoding="ISO-8859-1"?>
<entries>
<entry>
<tf1>test</tf1>
<tf2>123</tf2>
</entry>
<entry>
<tf1>test2</tf1>
<tf2>321</tf2>
</entry>
</entries>
Is it possible to get this result using write-xml or do i have to use sax-writeer ?
Thanks.
Lars E.
I am testing out write-xml method and have a problem with naming the nodes.
The simple test-program:
def temp-table tt
xml-node-name "entries"
field tf1 as char
field tf2 as int.
def var a as logical no-undo.
create tt.
assign tt.tf1 = 'test'
tt.tf2 = 123.
create tt .
assign tt.tf1 = 'test2'
tt.tf2 = 321.
/* Dump temp-table as xml */
a = temp-table tt:write-xml("file","c:\Temp\tt.xml",true,"ISO-8859-1",?,false,false).
Gives me this xml-file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<entries xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<entriesRow>
<tf1>test</tf1>
<tf2>123</tf2>
</entriesRow>
<entriesRow>
<tf1>test2</tf1>
<tf2>321</tf2>
</entriesRow>
</entries>
My 2 problems are:
1. I don't wnat the "xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance". Is it possible to specify not to write this into the file ?
2. My temp-table has name set to "entries". The write-xml method puts out every record with name: <entriesRow>. Is it possible to specify what this name should be.
This is the result i am looking for:
<?xml version="1.0" encoding="ISO-8859-1"?>
<entries>
<entry>
<tf1>test</tf1>
<tf2>123</tf2>
</entry>
<entry>
<tf1>test2</tf1>
<tf2>321</tf2>
</entry>
</entries>
Is it possible to get this result using write-xml or do i have to use sax-writeer ?
Thanks.
Lars E.