get_xml_value (OpenInsight 32-Bit)
At 25 JUN 2010 03:35:55PM John Bouley wrote:
I found that get_xml_value will not return correct data if the resulting data has value marks, field marks or CR&LF…
Why should it matter if there are value marks in the data?
Thanks,
John
At 25 JUN 2010 03:50PM John Bouley wrote:
Try the following code in 9.1 or above, in 8.x it works:
function test_get_xml_value(void)
xml=1234":\0D0A\:"1,100":\0D0A\
Declare Function get_xml_value
val=get_xml_value("number_accounts_placed",xml)
debug
Return val
At 25 JUN 2010 05:52PM Sean FitzSimons wrote:
John,
I am not certain what the problem is just yet, but…. it isn't the crlf. I tried your code without the \0D0A\ and it didn't return anything in VAL.
I'll have to delve further and get back to you.
Sean
At 05 NOV 2010 09:29AM Bill Caisley wrote:
Sean,
Is there a fix for this yet? Still broken in 9.2
At 05 NOV 2010 01:29PM Bob Carten wrote:
The problem is that John's string is not well-formed xml.
If I fix the xml I get the correct answer. See below.
So what changed?
Older versions of get_xml_value contain a home-grown parsing code.
In 9.x we made get_xml_value use the Microsoft XMLDOM object. The benefit is that the parser correctly handles well formed xml. The cost is that it now requires well formed XML.
0001 0002 Declare Function get_xml_value 0003 0004 xml = "<test>1234</test>":\0D0A\:"<number_accounts_placed>1,100</number_accounts_placed>":\0D0A\ 0005 val = get_xml_value("number_accounts_placed",xml) 0006 *xml is malformed, Val is blank 0007 0008 good_xml = "<myxml>":xml:"</myxml>" 0009 good_val = get_xml_value("number_accounts_placed",good_xml) 0010 *xml is well formed good_Val is correct 0011
At 05 NOV 2010 02:44PM John Bouley wrote:
FYI,
In the previous example I ended up writting my own parsing routine.
Good to know there is an explanation… Perhaps the documentation should be updated to warn the unsuspecting programmer that his xml should be "well formatted".
![]()
Thanks,
John