RomanV
(RomanV)
October 30, 2018, 6:49pm
1
There’s a windows PC running my software that consumes a web service.
When it recives certain message the XML parser crashes in this line
xml.LoadXml(XMLText)
Parser Error 4: Not well formed (invalid token)
It is VERY strange that other computers do not crash.
I’ve put a try catch block to see details about the exception as it says line = “1”, and Node = “”
Also AFTER the try catch block I get a runtime error… Crash in Universal/REALString.cpp 130. Failure condition usageCount
What is this ? Is there any workaround ?
RomanV
(RomanV)
October 30, 2018, 6:54pm
2
The xml looks absolutely fine to me…
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetPartnersResponse xmlns="XmlServices">
<GetPartnersResult>
<Status>
<Success>true</Success>
<ErrorId>0</ErrorId>
<TimeStamp>2018-10-30T19:52:44.0371069+01:00</TimeStamp>
</Status>
<Partners>
<Partner>
<Id>719</Id>
<Name>Booking.com XML</Name>
<Active>true</Active>
<IsLive>true</IsLive>
</Partner>
<Partner>
<Id>11</Id>
<Name>Expedia</Name>
<Active>true</Active>
<IsLive>true</IsLive>
</Partner>
<Partner>
<Id>43</Id>
<Name>HotelBeds.com</Name>
<Active>true</Active>
<IsLive>true</IsLive>
</Partner>
<Partner>
<Id>3261</Id>
<Name>DespegarXML</Name>
<Active>true</Active>
<IsLive>true</IsLive>
</Partner>
<Partner>
<Id>896</Id>
<Name>Price Travel</Name>
<Active>true</Active>
<IsLive>false</IsLive>
</Partner>
<Partner>
<Id>828</Id>
<Name>By Hours</Name>
<Active>true</Active>
<IsLive>false</IsLive>
</Partner>
<Partner>
<Id>992</Id>
<Name>HotelDo (BestDay)</Name>
<Active>true</Active>
<IsLive>true</IsLive>
</Partner>
<Partner>
<Id>5465</Id>
<Name>SimpleBookingXML</Name>
<Active>true</Active>
<IsLive>true</IsLive>
</Partner>
<Partner>
<Id>2</Id>
<Name>All Travel Agencies</Name>
<Active>true</Active>
<IsLive>false</IsLive>
</Partner>
</Partners>
</GetPartnersResult>
</GetPartnersResponse>
</soap:Body>
</soap:Envelope>
try to remove the soap:enveloppe tag at the top and bottom and see if the xml still has the error ?
RomanV
(RomanV)
October 30, 2018, 7:44pm
4
You mean… trim the xml, to make it begin here ?
soap:Body
RomanV
(RomanV)
October 30, 2018, 7:57pm
5
I’ve tried it, but I get an exception as well
RomanV
(RomanV)
October 30, 2018, 7:58pm
6
The thing is… why in some pcs the original XML can be aprsed and in others doesn’t work???
Guesses that might help:
What is the source of the XML?
If it’s remote, did you define an encoding?
Is there a preceding BOM that’s causing Line 1 Node “” to be the most accurate description of where the issue is for the XML parser?
When it fails, write the string to a text file and get this file back to you.
Compare to a file on your computer.
Maybe an encoding problem.
RomanV
(RomanV)
October 30, 2018, 8:16pm
9
This is the raw data from the XML.
It comes from a well known trusted webservice
<?xml version="1.0" encoding="utf-8"?>true02018-10-30T21:14:03.9541781+01:00719Booking.com XMLtruetrue11Expediatruetrue43HotelBeds.comtruetrue3261DespegarXMLtruetrue896Price Traveltruefalse828By Hourstruefalse992HotelDo (BestDay)truetrue5465SimpleBookingXMLtruetrue2All Travel Agenciestruefalse
I DID NOT define encoding… can you guy enlighten me please ? I didn’t think it was necessary … How do I do it ?
I don’t know hat’s a preceding BOM… (begging of message?) I guess not…
Louis_D
(Louis D)
October 30, 2018, 8:23pm
10
If the same XML message is properly decoded on some PC’s and not on others, I would take a look at the windows updates on the computers where it fails. There have been several updates related to XML. Perhaps some of the computers are not correctly / completely updated?
RomanV
(RomanV)
October 30, 2018, 8:24pm
11
Perhaps, Louis… but… where do I start ? Is there any particular update I should look for ?
First, try defining the encoding with DefineEncoding :
XMLText = XMLText.DefineEncoding(Encodings.UTF8)
RomanV
(RomanV)
October 30, 2018, 8:27pm
13
oh… Well… welll…
A reboot of the PC fixed it… now… With all respect… i think this is enough for me to join some “reboot” church…
RomanV
(RomanV)
October 30, 2018, 8:34pm
14
thanks everybody… I obviously forgot the n1 rule of troubleshooting: first of all try a reboot.
I will also check for encoding problems in my code, later…,