Question Can WRITE-XML set attributes on the outermost node (the prodataset)

Andy_S

New Member
Hi
Using 10.2B06, I am using a ProDataset to build up my data, then using WRITE-XML to write the file.
The customer wants the XML to have an attribute on the outermost tag, but this is my ProDataset so not sure how I can do that.
e.g.

<?xml version="1.0" encoding="UTF-8"?>
<data content="orders">
<header>xyz ....</header>
<order ref="000001"> abc ....</order>
</data>

How could I get an attribute of name "content" and whose value is "orders" onto the ProDataset whose XML-NODE-NAME is "data" ?

Andy
 

Cecil

19+ years progress programming and still learning.
I think you best option is unfortunately is to not use the WRITE-XML() method but to use the long handed technique of using the SAX-WRITER to generate the required XML document. The added advantage is that it will give you better control over the XML in general.

The WRITE-XML() only really works in conjunction with the READ-XML(). I have never been able to find a use for it outside of the ABL.
 

RealHeavyDude

Well-Known Member
As far as I know they were designed to write an output similar to when you serialize an ADO .NET dataset. Since I don't speak .NET I can't tell whether that goal was achieved or not. Nevertheless I also only ever got it working in conjunction with the READ-XML () method and for example use it to read and write configurations from and to files.

Heavy Regards, RealHeavyDude.
 

Andy_S

New Member
As far as I know they were designed to write an output similar to when you serialize an ADO .NET dataset. Since I don't speak .NET I can't tell whether that goal was achieved or not. Nevertheless I also only ever got it working in conjunction with the READ-XML () method and for example use it to read and write configurations from and to files.

Heavy Regards, RealHeavyDude.

I can make it do most of what is needed, just this one has got me stuck. Will try the SAX WRITER method. Thanks
 

Andy_S

New Member
I think you best option is unfortunately is to not use the WRITE-XML() method but to use the long handed technique of using the SAX-WRITER to generate the required XML document. The added advantage is that it will give you better control over the XML in general.

The WRITE-XML() only really works in conjunction with the READ-XML(). I have never been able to find a use for it outside of the ABL.

Okay thanks. I can do most of what is needed with WRITE-XML, just not this part. So will try SAX-WRITER.
 
Top