XML Parsing in ServiceNow - Saxon / library / XMLDocument ??

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-11-2023 09:46 AM
Hi all,
I am trying to parse out a very large (3k - 5k lines typically) XML document within the platform and am wondering if anyone has experience with the best way to parse large, complex XML docs. The info will be going into several tables, upwards of 16 or so and I need to figure out a proper way to break all the data down so that I can identify and insert it into the tables. Is there support for Saxon or a recommended library, or is the ServiceNow XMLDocument fully capable of handling that type of content?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-11-2023 10:04 AM
I convert xml response to JSON which makes much easier to parse it.
var jsonObj = gs.xmlToJSON(res_body); // Converting XML into a JSON object
Ref - https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0957116