Parsing xml

Kelly Burgess kellyb at
Mon Nov 12 22:35:02 EST 2018

Michael wrote:
> For more complex issues I store a copy of the XML as a template and add replaceable fields to it for adding data.

I might mention that if you're doing a lot of that and performance becomes an issue, I've done an "ExpandTags" external that's useful.  The v1.5 on my website needs refreshing - I've since done a v2.0, rewritten as an xcomp and ported for 64bit Studio.  You can create your templates using designated open/close tags with many possible content options.

e.g. if I use '<--' and '-->' for open/close tags, I can put "<--OMNIS FIELD=iMyInstanceVar-->" into a template, and when I call

    Do iExpandTagsObj.$dosubstitutions(iTaggedText,iExpandedText) Returns err

all of the tags in iTaggedText are replaced with the designated content and the result is returned in iExpandedText - the contents of iMyInstanceVar would replace the quoted assembly above.

Optional parameters to $dosubstitutions() can specify treatment of square brakets, linebreaks, and high ascii, encoding it as html, decimal or hex. (© becomes ©  or  ©  or  &#xA9;)  Other tagging options will call methods and replace the tag with the method results (METHOD=), or with file contents (FILE=), results a calculation (EVAL=), or use field contents or method results or file contents and expand it further (TAGGEDFIELD= or TAGGEDMETHOD= or TAGGEDFILE=), lots of options.


More information about the omnisdev-en mailing list