mibuso.com

Microsoft Business Solutions online community
It is currently Sat Sep 20, 2014 1:55 pm

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Here is how to format XMLDOM output nicely
PostPosted: Tue Feb 15, 2011 12:49 pm 
Offline

Joined: Tue Apr 11, 2006 10:00 pm
Posts: 1392
Location: Vienna
Country: Austria (at)
Gave me a hard time, so I thought I would share. If you don't do this, everything will be in one line...

Code: Select all

//Name   DataType   Subtype   Length
//Outs   OutStream      
//F   File      
//Reader   Automation   'Microsoft XML, v6.0'.SAXXMLReader60   
//Writer   Automation   'Microsoft XML, v6.0'.MXXMLWriter60   

F.QUERYREPLACE(FALSE);
F.CREATE(FileName);
F.CREATEOUTSTREAM(Outs);

IF ISCLEAR(Writer) THEN
   CREATE(Writer);

Writer.indent := TRUE;
Writer.standalone := FALSE;
Writer.omitXMLDeclaration := TRUE;
Writer.encoding := 'utf-8';

IF ISCLEAR(Reader) THEN
   CREATE(Reader);

Reader.contentHandler := Writer;
Reader.dtdHandler := Writer;   
Reader.errorHandler := Writer;

Reader.putProperty('http://xml.org/sax/properties/declaration-handler', Writer);
Reader.putProperty('http://xml.org/sax/properties/lexical-handler', Writer);

Reader.parse(PXMLDocOut);

PXMLDocOut.loadXML(Writer.output);

PXMLDocOut.save(Outs);
F.CLOSE;

_________________
Sorry, no support using PM, e-mail or MSN - please use this forum.


Top
 Profile  
 
 Post subject: Re: Here is how to format XMLDOM output nicely
PostPosted: Tue Feb 15, 2011 1:34 pm 
Offline

Joined: Fri Mar 30, 2007 12:50 pm
Posts: 215
Location: Nieuwe Niedorp
Country: Netherlands (nl)
Nice, I have once searched for a solution and did not find one!
Thanks for sharing!

_________________
Reijer Molenaar
Freelance NAV Developer
Object Manager
TVblik


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: