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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML Parser in Cobol

Status
Not open for further replies.

WolfgangIreland

Programmer
Dec 11, 2000
1
DE
Hello together,
I have to write a program to browse a XML Message and to verify the message. Anyone done the same and give me some hints?
Thanks
 
Hi,

I saw some examples in the book COBOL UNLEASHED.
 
WolfgangIreland,

i submitted a similar question under "parsing strings",
thread209-38500 the mean time, i have been dabbling with a solution to the very same problem, except i don't need to verify the document.
Without getting to lengthy, i can give you a couple of hints:

- process the document as a large string; maintain a pointer to the character position from where you are processing at any certain time;
- use reference modification to extract bits from it (thank you, Crox !);
- find tags for example by searching for a &quot;<&quot; and work out which one it is, or check if it is the one you're searching for (whatever you need);
- get the value between the tags by UNSTRINGing it, DELIMITED BY the end tag.

After processing an begin tag / end tag couple, remember to set your pointer ahead of the end tag before searching for a next one; do this either by working out the offset you need, or search for it and set the pointer up by its length (= begin tag length + 1, usually).

Any more questions are welcome, as ever.

Good luck !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top