Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parsing XML in COBOL

Status
Not open for further replies.

oldcoderunner

Programmer
Mar 7, 2007
6
GB
My COBOL program is using the XML PARSE statement to parse a string received from a unix system. After each end-tag there is a string of characters Hex'254040' which is a line feed and two spaces. However the parser instead of skipping past these 'white-space' characters, is returning them to the program as CONTENT-CHARACTERS, even though they outside of a START-TAG / END-TAG structure.
Any ideas on why the parser is behaving like this and how to stop it?
 
The parser is behaving correctly. Those whitespace characters are a text node of the containing element. Unless your parser has some mechanism to ignore whitespace in the input document, you must deal with the whitespace.

Given the hex values, you must be on a mainframe. Can you apply an XSLT either using the XML parser, or on a job step before the COBOL program? If so, you could quite easily strip out the extra whitespace characters.

Tom Morrison
 
Hi,

I am new to COBOL and have to develop a XML Parser on COBOL to read the request coming from FrontEnd which is on Java. Can some one please send me some dummy code to study how it works?
 
Does any one know how to do vice-versa for this.
i.e. I want to put my Data Structure values in the XML Tags to be passed to other system.
 

XML GENERATE xmlPO from purchaseOrder
count in numChars



I use XML Generate as above code but it gives below error

"Expected a data-name; 'GENERATE' found. Statement or clause ignored"

Is it the proble with I Series version I am using. We are using V5R3..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top