XMLparse empty tag

Ideas for new features & functions

Moderators: Dorian (MJT support), JRL

Post Reply
Enricoys
Junior Coder
Posts: 27
Joined: Mon Jan 06, 2014 1:18 pm

XMLparse empty tag

Post by Enricoys » Mon Oct 16, 2017 10:36 am

Unfortunately I hoped that in the new version 14.4.01 an annoying problem with XMLparse would have been solved. However, I still see a system error occurring as soon as XMLparse is used for an empty tag. Now I have to make a relatively complex check before I can use XMLparse. I would guess that it is just a minor modification in XMLparse to return a empty field when the tag is empty in the XML file. Could you please modify XMLparse behaviour in the next version.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: XMLparse empty tag

Post by Marcus Tettmar » Mon Oct 16, 2017 2:12 pm

Sorry we missed that. I've made sure it is on bug tracker and will give this priority to investigate and fix.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

zabros2020
Pro Scripter
Posts: 70
Joined: Sun May 03, 2009 11:49 pm
Location: AU

Re: XMLparse empty tag

Post by zabros2020 » Mon Oct 23, 2017 2:21 am

This is how i like to use xmlparse:

Note: title for <book category="CHILDREN"> is empty and will return null with no error warning.

Code: Select all

Let>IGNOREERRORS=1
LabelToVar>XML,sXML
XMLParse>sXML,/bookstore/book,val,numBooks
Let>k=0
Repeat>k
  Let>k=k+1
  XMLParse>sXML,/bookstore/book[%k%]/title/text(),val,len
  MessageModal>val
  Let>val=
Until>k=numBooks
 
Let>IGNOREERRORS=0
/*
XML:
<?xml version="1.0" encoding="UTF-8"?>
 
<bookstore>
 
<book category="COOKING">
  <title lang="en">Everyday Italian</title>
  <author>Giada De Laurentiis</author>
  <year>2005</year>
  <price>30.00</price>
</book>
 
<book category="CHILDREN">
  <title lang="en"></title>
  <author>J K. Rowling</author>
  <year>2005</year>
  <price>29.99</price>
</book>
 
<book category="WEB">
  <title lang="en">XQuery Kick Start</title>
  <author>James McGovern</author>
  <author>Per Bothner</author>
  <author>Kurt Cagle</author>
  <author>James Linn</author>
  <author>Vaidyanathan Nagarajan</author>
  <year>2003</year>
  <price>49.99</price>
</book>
 
<book category="WEB">
  <title lang="en">Learning XML</title>
  <author>Erik T. Ray</author>
  <year>2003</year>
  <price>39.95</price>
</book>
 
</bookstore>
*/


Loving MS's Capabilities!!!

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts