Board index FlightGear Development Nasal

Failed to load xml: not well-formed (invalid token)

Nasal is the scripting language of FlightGear.

Failed to load xml: not well-formed (invalid token)

Postby wlbragg » Tue Aug 30, 2016 5:59 pm

Code: Select all
 var timer_set_time = getprop("/fdm/jsbsim/systems/timer/timer-set-sec");
 timer_set_time = timer_set_time - 600;
 if (timer_set_time < 0) timer_set_time = 5400;

Is there any reason the less-than operator used this way should cause
Code: Select all
Failed to load xml: not well-formed (invalid token)

It works fine using greater-than, as in
Code: Select all
if (timer_set_time > 5400) timer_set_time = 0;

/fdm/jsbsim/systems/timer/timer-set-sec is defined as an "int" in -set.
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7588
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: Failed to load xml: not well-formed (invalid token)

Postby Thorsten » Tue Aug 30, 2016 6:13 pm

Probably the parser thinks < is supposed to open an xml tag. Which is... not well formed.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Failed to load xml: not well-formed (invalid token)

Postby wkitty42 » Tue Aug 30, 2016 6:43 pm

if that's the case then checking for less than is broken?? can it be escaped like "\<"? does the language even have escaping?
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9148
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: Failed to load xml: not well-formed (invalid token)

Postby D-ECHO » Tue Aug 30, 2016 6:45 pm

Don't know whether it fits for your purpose, but may
=<
help?
D-ECHO
 
Posts: 2460
Joined: Sat May 09, 2015 1:31 pm
Pronouns: Bea (she/her)
Version: next

Re: Failed to load xml: not well-formed (invalid token)

Postby Gijs » Tue Aug 30, 2016 6:51 pm

I suppose you've placed this code in a xml file? Scroll down a bit from http://wiki.flightgear.org/XML#Data and look for the CDATA trick.

Reversing the condition may also work:
Code: Select all
0 > timer_set_time
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9544
Joined: Tue Jul 03, 2007 3:55 pm
Location: Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: Failed to load xml: not well-formed (invalid token)

Postby wlbragg » Tue Aug 30, 2016 6:57 pm

Yes, XML code and nasal. I tried =< and got the same thing (I can't verify that, I may have had it reversed <= ).
I was able to use == and catch the exact number that would be the next value in the increment, but I just thought it strange that you can't use less-than in nasal. I'll try both escaping and =< to see if either one works.

Edit:
0 > timer_set_time

I'll try that also, I remember an issue that required this solution.

Probably the parser thinks < is supposed to open an xml tag. Which is... not well formed.

Then if "escaping" is allowed in nasal, that seems to be a logical choice or
Code: Select all
0 > timer_set_time

should work.
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7588
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: Failed to load xml: not well-formed (invalid token)

Postby AndersG » Tue Aug 30, 2016 8:26 pm

You need to escape your data (= the Nasal code) in the XML hierarchy, e.g. (not sure why I put an escape there, though):
Code: Select all
   <script><![CDATA[
     # Ground handling configuration.
     MAX_WIRE_LENGTH = 200;

     globals["Nordstern"] = globals["ZLTNT"];
    ]]>
   </script>

The problem is entirely at the XML syntax level. It would not be an issue if you placed your Nasal code in a Nasal code file (.nas).
Callsign: SE-AG
Aircraft (uhm...): Submarine Scout, Zeppelin NT, ZF Navy free balloon, Nordstern, Hindenburg, Short Empire flying-boat, ZNP-K, North Sea class, MTB T21 class, U.S.S. Monitor, MFI-9B, Type UB I submarine, Gokstad ship, Renault FT.
AndersG
 
Posts: 2525
Joined: Wed Nov 29, 2006 10:20 am
Location: Göteborg, Sweden
Callsign: SE-AG
OS: Debian GNU Linux


Return to Nasal

Who is online

Users browsing this forum: No registered users and 5 guests