I doubt if you could create one as different XML files have different formats. I suggest you look at several XML files and see how you go about extracting the data manually, see what common processes you go through and then see if you can automate these. You need to be familiar with the data. I have over 3800 xml files on my PC - only one is mine - the rest belong to the system and various applications. Most of those that I have looked at (not many) are different. Yes, there are similarities which will help but there are differences.
Another thing - use Google to look up "rexx xml parser". There appears to be stuff already out there so why re-invent the wheel? Seems like IBM has one but it may only be for CMS but as it is source code it could be adapted as required. Others for PC could be obtained and changed for MVS - mainly the IO.
There is a PARSEXML exec on IBM's website that you can download and use as-is, if it meets your needs. I understand that it uses the same basic logic as the COBOL XML parsing function.
Personally, I use my own scaled-down version. Really, all you need to do is parse the xml string, looking for the starting tag '<....>' the value, and the ending tag '</.....>' in a loop.
XML is deceptively simple. Writing something to parse your XML is relatively easy. Writing something to parse any standards-compliant XML is a different thing altogether. By the time you've thrown in attributes, namespace handling, CDATA sections, etc. you've got a big piece of work on your hands. And if you want a validating parser that checks the XML against a schema, well let's just not go there shall we?
Consider using one of the pre-built solutions suggested above, rather than rolling your own...
Steve
[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object:erlDesignPatterns)[/small]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.