Formatting Attributes of x-noderef object handles

Posted by Mike Fechner on 02-May-2018 15:31

Hi all,

I'm having a ProDataset with a hand full of temp-tables. The temp-table fields have the xml-node-type set to attribute. 

When I execute write-xml using the formatted option, the xml element nodes for the records are all starting in their own line. 

For better readability, I'd like to insert a line-break after every n th attribute. So instead of 

<record field1="value" field2="value" field3="value" field4="value" field5="value"> 

I'd like the output formatted like this 

<record field1="value" field2="value"

    field3="value" field4="value" field5="value"> 

or even

<record

    field1="value"

    field2="value"

    field3="value"

    field4="value"

    field5="value"> 

How can I insert text-nodes with the LF between the attribute nodes?

All Replies

Posted by Peter Judge on 03-May-2018 07:44

With the SAX-WRITER?
 
Not sure what you’re looking for is available.
 
Are you writing all fields as attributes? Do you care about datatypes?
 

Posted by Mike Fechner on 06-May-2018 11:46

Hi Peter,
 
“Are you writing all fields as attributes?”
 
That was the idea. The use case are XML files that contain development database contents (XML files created from ProDatasets) that should be committed to SCM. As most merge processes work on a line by line basis, using the classic XML output of a ProDataset my worry is, that fields from different records might be merged into a single record. So dumping the whole record in a single line avoids this issue.
 
However this may cause pretty long lines, so we intended to add a few line breaks after every n fields – to get a bit of the best of both worlds.
 
Cheers,
Mike
 
Von: Peter Judge <bounce-pjudge@community.progress.com>
Gesendet: Donnerstag, 3. Mai 2018 14:46
An: TU.OE.General@community.progress.com
Betreff: RE: [Technical Users - OE General] Formatting Attributes of x-noderef object handles
 
/cfs-file/__key/communityserver-discussions-components-files/26/76527.image001.png
Update from Progress Community
/cfs-file/__key/communityserver-discussions-components-files/26/5722.image002.jpg
 
With the SAX-WRITER?
 
Not sure what you’re looking for is available.
 
Are you writing all fields as attributes? Do you care about datatypes?
 

View online

 

You received this notification because you subscribed to the forum.  To unsubscribe from only this thread, go here.

Flag this post as spam/abuse.

Das Bild wurde vom Absender entfernt.
 

Posted by gus bjorklund on 09-May-2018 12:18

Mike,

This so bad it is not even wrong.

Source code control systems are designed to handle programs as /multi-line source text/. This has been going on successfully for decades.

If you are running into problems with XML files (which are /text/) then you need a different source code management system or you are doing something wrong.

Posted by marian.edu on 09-May-2018 13:22

Mike, you should find an Eclipse plugin that can compare the xml files as 'models'... if not already available somewhere I just might know someone that can help :)

 
Marian Edu

Acorn IT 
+40 740 036 212

Posted by Peter Judge on 11-Jun-2018 12:52

Given that the WRITE-{JSON,XML} methods give you no control over formatting other that “Is” and “IsNot” I think that I would do something along the lines of create an XmlOutputStream based on the Progress.IO.OutputStream  where you apply formatting. There’s a Write(<handle>) method you should override.
 
No, it’s not as easy or fast as WRITE-XML, but at least it’s in one place. This OutputStream design can be used in various places (the HTTP client and webhandlers use it or a variant of it pervasively) and it’s nice for plugging in alternate writers (but also readers via the InputStream equivalent).
 
 
 
 

This thread is closed