Sign in to follow this  
badderjet

Stupid beginner (XML)

Recommended Posts

Ah damn I hate to be a nuisance. Well I saw the following in an earlier thread. Can aynone please explain to the very beginner the -line? What is the %, and the %!03d! at the end?? :-hmmmBTW I have some other questions.-I cannot make much use out of the xmloptions.txt in xmlgau01.zip. The problem is, in HTML you have those 'tags' and appropriate 'attributes'. Well e. g. you cannot put a color="#00FF33" into a

tag. I mean it must fit otherwise it won't work. So the problem in xmloptionas.txt is, I don't know what is tag and what is attribute.-The other thing I don't understand is the hirarchy stucture. Well it's obvious that the and lines have the highest priority, and everything resides between those two lines.-Is the whole thing case sensitive?-Again to come to the thing below: There's a line, but it has obviously no end (no ). So what does it affect then?-Sometimes I saw " /> " at the end of a line. When do I need this and not only " > " ?%(360 (A:Ambient wind direction, degrees) (A:Plane heading degrees gyro, degrees) - dnor near d 0 == ?)%!03d!Thanks for your effort... :-)Regards :-wave from EDDFhttp://flightsimmers.net/airport/etti/signature_pro.jpg

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Didn't I suggest to start with "easy" XML gauges? The "Strings" definetely aren't the easy ones.% is used in strings to "glue" together non-text and text parts. The !03d! is a format notation , which means that the values calculated are diaplayed as integers (d) with 3 digits (3) and leading zeros (0). If your value is 1.23 it will be displayed as "001".The xmloptions.txt isn't added "to make sense" it is just a collection of possible tags and attributes that seem to be recognized by the XML gauges. Please note that xmlgau01.zip was made a good deal BEFORE the SDK was out, so it can only contain the information that was possible to extract by "trial and error" and "educated guesses". To the tags and attributes the SDK contains some extra files, that should be usable with several XML editors, but I wasn't able to use them yet.Arne Bartels

Share this post


Link to post
Share on other sites

Yes, strings aren't too easy to understand. I had the same feeling about xml as you do when I first started out, just keep trying. You can't believe the satisfaction when something 'suddenly' works out. I'm still struggeling with strings, and although I frequently run into problems with almost anything, I have gotten a feel on what belongs where. 'All' it takes is practice, patience and a shitload of coffee.Usually you'd start out with a default gauge, and work from there. Here is a line I've been working on almost the entire day, but originally it came from the Baron DME.xml:%((L:DME_Select,bool))%{if}%((A:NAV2 DME, nmiles) s0 (A:NAV2 DMESPEED, knots) s1)%{else}%((A:NAV1 DME, nmiles) s0 (A:NAV1 DMESPEED, knots) s1)%{end}%(l0 0 >= (L:DME_Select,bool) ! (L:NavCom1 on,bool) && (L:DME_Select,bool) (L:NavCom2 on,bool) && || &&)%{if}%(l0 9999 min d 99 <= (L:DME_Select,bool) ! (L:NavCom1 on,bool) && (L:DME_Select,bool) (L:NavCom2 on,bool) && || &&)%{if}%!04.1f!%{else}%!4d!%{end} %(l1 9999 min)%!04d! %(l0 l1 / 60 * 99 min)%!02d! min%{else}---- ---- --%{end})"No comment please on WHY I have to do such a stupid thing :) It was the only way I found.Told you, strings are *horrible* :D When your able to read this code snippet, and figuring out what it actually do, your skills are beyond mine :) But it works just like I intended.Some knowlegde of reverse polish notation is required, for calculating purposes and to be able to setup rather complex boolean equations.About your . See if you can find a further down ;)blablabla is something that *belongs* inside tags, thus the written format with afterwards, If the string was placed outside the text start and end, I assume it won't be a 'legal' thing to do. I did these mistakes myself at first.Especially in the beginning, try to 'prooftest' each new version with Internet Explorer, if it shows up there, at least FS2002 shouldn't crash on you. When confidence arise, you'll only 'need' Explorer when a gauge doesn't show up. I only use notepad now to edit, or a better program when the code gets too large.Also, I'd highly reccomend to put somewhere in whatever gauge, something like this: %((L:Ampmode,enum))%!08.4f!Adjust as needed, but the clue for this particular one is this: I had a 'calculated' userdefined variable that was used somewhere else (L:Ampmode,enum). Since my gauge didn't work out as planned, I needed to check if the value was correct in the first place. So here I only display that particular value. Ok, the intended value is correct, the fault must be somewhere else.Note: L:Variablename,unit. ALWAYS make sure you include a unit with L-variables (uservariables). I found a bug today in my EHSI due to this, and I have been struggling for a month with it. All it ever needed was a ",bool" in the end. And it was SO hard to spot! (it's a 35k code including plenty of comments).Standard procedure for finding faults. (I know, the formatting sucks :)).The biggest problem you're bound to encounter is the fact that the MS SDK has more to offer than really works. If you suspect that your variable of choice doesn't work, crosscheck with Arnes list of variables. If it is not listed there, you can most likely forget that approach and try something else - it will most likely never work, no matter what. Yes, been there, done that :DAlthough I've only 'been into' xml and its way of doing gauges for about two months, I learn something new every day. I had no gauge background before this, and I'm working on my first few ones.Just don't give up, check the default gauges, compare with the SDK, and other papers. Help force life back to freeware again, as you cannot copyright gauge code of this type.

Share this post


Link to post
Share on other sites

Wow, thanks for the answers regarding the string line etc... :-hahDidn't I suggest to start with "easy" XML gauges?Well yes, you actually did! But sorry, first this was to a gauge made by me and second I couln't know strings are so difficult. :-)But still, please tell me are Gauges case sensitive or not?And Karl, in another post you said I should create a status gauge. Therefore I'd need a L Var for interacting with the other gauge, right? Sorry but in the included *.cab files I didn't find any gauge using this so please tell me how to initialize such a variable and how to set a value.Damn, I have to do something by myself, not always asking :-(Regards :-wave from EDDFhttp://flightsimmers.net/airport/etti/signature_pro.jpg

Share this post


Link to post
Share on other sites

Another very good source of information is provided in the panel SDK in the /inc folder. Gauges.dtd and gauges.xdr, these are "schemas" to provide a checking routine for checking the .XML for proper format. I donot recommend to use these as such but in the document itself it shows a structure. I.E. what tags can be used within other tags, what information is allowed within the tags etc.. You donot need to understand the documents themselves just use as a reference. Also using the Gauges.xdr is easier to read than the Gauges.dtd.( open these with notepad or other text editor)Also one very good tip. ( I hope it works for you as it does me )Make a simple gauge with a small bitmap 20 pixels by 20 pixels labeled with something like "test" or "reload" save it as Reload.bmp. Then use the following code for the gauge. (>K:RELOAD_PANELS)Place the gauge in your project panel.In my mind this is the "Holy Grail". No other designing for FS has as much power as this one. By pressing this button once before working on your project unlocks all XML documents from the gauge system. Letting you, the designer modify AND save the document while the actual gauge is still active. By pressing reload again after saving you can see the new results within seconds. No more switching to another aircraft then switching back. From testing the reload will stay active until any window is resized. This button does NOT reread the panel.cfg. I really hope that this works for you as it will save either, your hair from turning gray or, keeping hair on your head by not pulling it out !!! LOL :-) Keep trying stuff with XML. It will not become easy right away, but if you keep going at it for awhile suddenly it'll just "click" and you'll be off and running. I have been experimenting with this 2 weeks after FS2002 was released and have caught on quite well. My only other related experience that helped was Digital Electronics and the BASIC computer language, both studied over 15 years ago. Roman(KGRB)

Share this post


Link to post
Share on other sites

Hey Roman!Thank you a LOT for that little gauge... Seems to be VERY useful :-hah 'Cause always loadin notha aircraft, then again loadin the original one... annoying. But now it's gonna get faster :-)It's cool to such have kind people here in the forums who also 'push up' the beginners, support them and sharing their knowledge... :-hahRegards :-wave from EDDFhttp://flightsimmers.net/airport/etti/signature_pro.jpg

Share this post


Link to post
Share on other sites

tags and parameters are case sensitive. You can easily find it out by typing one tag of one gauge in captials and see the it isn't drawn any more.Arne Bartels

Share this post


Link to post
Share on other sites

Huh? Microsoft use L:Variables extensively. Even the DME.xml of the Baron use an L-type switch check.To set it, just use:5 (>L:yourvariablename, enum) or something.Oh, btw. You should unpack those .cab files soft of lik: baron.cab becomes a bacon directory containing 1024 and 640 subdirs.Then rename baron.cab to baron.bakup.bak (safety) and it will still work. I was packing files for each test before I learned this. Sort of saved the day for me. The 'load_panel' issue was the second huge discovery in the system.I wonder what secrets like this Microsoft sits on that they are not sharing? :(

Share this post


Link to post
Share on other sites

XML is a standard poised to replace the current HTML which is the code behind the webpages you see.See: www.w3.org/xml -I cannot make much use out of the xmloptions.txt in xmlgau01.zip. The problem is, in HTML you have those 'tags' and appropriate 'attributes'. Well e. g. you cannot put a color="#00FF33" into a

tag. I mean it must fit otherwise it won't work. So the problem in xmloptionas.txt is, I don't know what is tag and what is attribute.> Answer is, You could pick any tag and any attribute and it won't report an error -xml is extensible- that is you could put any tag with any attibute and It's ok.-The other thing I don't understand is the hirarchy stucture. Well it's obvious that the and lines have the highest priority, and everything resides between those two lines.> Read above, again -xml is extensible- You can make up your own tags, attibutes, and so on. In this case, the tag is the main tag-Is the whole thing case sensitive?> Not really, But it's good pratice to make sure everything is in the right case. It's also good pratice to keep all the tag names in lowercase-Again to come to the thing below: There's a line, but it has obviously no end (no ). So what does it affect then?> It's an error. Unless the XML processer is tolerant, it will stop it and report an error.-Sometimes I saw " /> " at the end of a line. When do I need this and not only " > " ?> The W3C standard says you can't do , instead you have to do " So the XML Processor knows that tag stops there, and doesn't get confused.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this