ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Message Broker, line feed when writing to a file

Post new topic  Reply to topic
 Message Broker, line feed when writing to a file « View previous topic :: View next topic » 
Author Message
Otto Wolfram
PostPosted: Fri May 19, 2023 6:11 am    Post subject: Message Broker, line feed when writing to a file Reply with quote

Newbie

Joined: 19 May 2023
Posts: 6
Location: Belarus, Minsk

Hello everyone, I work in the version of IBM Message broker 9.0.

I ran into this problem: when writing to a text document (.txt), I want to write data to a file in the form of an XML tree,
the data is generated in Compute.node and are passed to File Output.

Or, at least, tell me how to use SQL to make a line break when writing data to a text file

I have been suffering for the second day, I can't find the answer, I have read a lot of posts on various forums and everything is without result

I want to do the correct logging, but it turns out that the logs are written in one line.
Please help me!!!!!!!!

Here is an example of the code I am generating:
Code:
SET OutputRoot.XMLNSC.DATA.Header = 'Text title';
SET OutputRoot.XMLNSC.DATA.Header.Subtitle = 'Subtitle';
SET OutputRoot.XMLNSC.DATA.Body = 'Main Text';
SET OutputRoot.XMLNSC.DATA.Footer ='End Text';


I want to get something like this in a text file:
Code:
<DATA>
    <Header>Text title</Heder>
        <Subtitle>Subtitle</Subtitle>
    <Body>Main Text</Body>
    <Footer>End Text</Footer>
</DATA>

And not in one line.
Back to top
View user's profile Send private message
gbaddeley
PostPosted: Sun May 21, 2023 3:35 pm    Post subject: Reply with quote

Jedi

Joined: 25 Mar 2003
Posts: 2492
Location: Melbourne, Australia

Valid XML does not require line breaks and indenting. Data will be shorter and much faster to parse without the white space. If you need to look at the XML data in a nicely formatted way, use some sort of tool to view it.
_________________
Glenn
Back to top
View user's profile Send private message
Otto Wolfram
PostPosted: Sun May 21, 2023 10:27 pm    Post subject: Reply with quote

Newbie

Joined: 19 May 2023
Posts: 6
Location: Belarus, Minsk

gbaddeley wrote:
Valid XML does not require line breaks and indenting. Data will be shorter and much faster to parse without the white space. If you need to look at the XML data in a nicely formatted way, use some sort of tool to view it.


I need to move the text to a new line (\n) for more legible text output, since I use this for logs, and using third-party applications is not possible. The processing speed of the data and the text file is not important!

I have data output to a text file like this:
Code:
<DATA><Header>Text title</Heder><Subtitle>Subtitle</Subtitle><Body>Main Text</Body><Footer>End Text</Footer></DATA>


And it is necessary so:
Code:
<DATA>
    <Header>Text title</Heder>
        <Subtitle>Subtitle</Subtitle>
    <Body>Main Text</Body>
    <Footer>End Text</Footer>
</DATA>
Back to top
View user's profile Send private message
joebuckeye
PostPosted: Mon May 22, 2023 4:53 am    Post subject: Reply with quote

Partisan

Joined: 24 Aug 2007
Posts: 364
Location: Columbus, OH

If you are generating this message why are you using the XMLNSC parser for it if you want to display it in a text format?
Back to top
View user's profile Send private message
Otto Wolfram
PostPosted: Mon May 22, 2023 5:19 am    Post subject: Reply with quote

Newbie

Joined: 19 May 2023
Posts: 6
Location: Belarus, Minsk

joebuckeye wrote:
If you are generating this message why are you using the XMLNSC parser for it if you want to display it in a text format?


And what to use? Please tell me, am I desperate? preferably with some kind of example . Perhaps you meant that it is necessary to use DataObject, but I have already tried(

Or tell me how to implement it in a different way, I would appreciate it)
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon May 22, 2023 9:40 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

Otto Wolfram wrote:
joebuckeye wrote:
If you are generating this message why are you using the XMLNSC parser for it if you want to display it in a text format?


And what to use? Please tell me, am I desperate? preferably with some kind of example . Perhaps you meant that it is necessary to use DataObject, but I have already tried(

Or tell me how to implement it in a different way, I would appreciate it)

Just use a browser like FireFox or Chrome or MSEdge to display the xml document...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
gbaddeley
PostPosted: Mon May 22, 2023 4:16 pm    Post subject: Reply with quote

Jedi

Joined: 25 Mar 2003
Posts: 2492
Location: Melbourne, Australia

Otto Wolfram wrote:
I need to move the text to a new line (\n) for more legible text output, since I use this for logs....

I suggest that you log it as a normal XML string (this will save space in your logs) and then use your log viewing tool to nicely format the XML for human viewing. This is was we do in our ACE MF logging solution. We are logging tens of GB per day, so space matters.

Basically, your request is not very practical, and you are having difficultly finding anything because very few folks (if any) are doing it ?
_________________
Glenn
Back to top
View user's profile Send private message
Otto Wolfram
PostPosted: Mon May 22, 2023 9:30 pm    Post subject: Reply with quote

Newbie

Joined: 19 May 2023
Posts: 6
Location: Belarus, Minsk

gbaddeley wrote:

I suggest that you log it as a normal XML string (this will save space in your logs) and then use your log viewing tool to nicely format the XML for human viewing. This is was we do in our ACE MF logging solution. We are logging tens of GB per day, so space matters.

Basically, your request is not very practical, and you are having difficultly finding anything because very few folks (if any) are doing it ?


I understood you, thank you for the answer!
Back to top
View user's profile Send private message
Otto Wolfram
PostPosted: Mon May 22, 2023 9:49 pm    Post subject: Reply with quote

Newbie

Joined: 19 May 2023
Posts: 6
Location: Belarus, Minsk

At the end I will write about what I found on this topic, maybe someone will need it sometime:

I only found how to make each new entry output on a new line.
To do this, in the "File Output" module in the settings of this module in the "Records and Elements" tabs in the "Record definition" field, set the parameter to "Record Delimited Data". Other parameters line "Delimiter" -> "Broker System Line End" end "Delimiter Type" -> "Postfix" will stand by default, and if not, set them to these values.
But this is already an obvious thing)))))
Back to top
View user's profile Send private message
anil kumar
PostPosted: Wed Aug 02, 2023 3:46 am    Post subject: XSLT indentation Reply with quote

Voyager

Joined: 22 Jan 2017
Posts: 97
Location: India

Is there a reason that nobody suggested using XSLT indent Yes?
Back to top
View user's profile Send private message
Otto Wolfram
PostPosted: Wed Aug 02, 2023 3:53 am    Post subject: Re: XSLT indentation Reply with quote

Newbie

Joined: 19 May 2023
Posts: 6
Location: Belarus, Minsk

anil kumar wrote:
Is there a reason that nobody suggested using XSLT indent Yes?

Can you give an example of XSLT indentation? Please, it would be interesting to know how this problem cloud be solved.
Back to top
View user's profile Send private message
anil kumar
PostPosted: Wed Aug 02, 2023 4:44 am    Post subject: Reply with quote

Voyager

Joined: 22 Jan 2017
Posts: 97
Location: India

You can use XSLT transformation node in your flow to format your xml

Code:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:redirect="http://xml.apache.org/xalan/redirect"
extension-element-prefixes="redirect"
xmlns:xalan="http://xml.apache.org/xslt">
<xsl:output method="xml" indent="yes" xalan:indent-amount="4"/>

<xsl:template match="/">

<Greeting><message>it works!!!</message></Greeting>

</xsl:template>

</xsl:stylesheet>




You can use xslt like this to output xml with indentations, here I used 4 as indentation spacing which you can adjust based on your need.

You can experiment it by putting in your flow and test.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Message Broker, line feed when writing to a file
Jump to:  



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 vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.