PDA

View Full Version : xml validation


carel
02-22-2008, 05:45 AM
I would like to use an xml editor for studying and editing Flashpanoramas xml, but every xml editor seems to choke on Flashpanoramas xml. It usually happens somewhere in a line with <spot.

I guess most people here just use a regular text editor, but I find the highly structured setup of a dedicated xml editor, such as xml notepad 2007 much easier to use.

Any suggestions...?

Carel Struycken

fritsjan
02-22-2008, 10:39 AM
I noticed that too, also when you try to view an fpp xml in IEbrowser, it hangs. My guess is that it has to do with the '.' in a <spot declaration.

for example the dot in 3.00:

<spot id="hidemapTab" url="tour-map/hidemap.png" static="1" salign="LT" align="LT"
staticX="3.00" staticY="20.00" depth="10" visible="0" alpha="0"
onClick="mapback.Close;"
/>

I am just guessing, am I right?

Aifos
02-22-2008, 01:22 PM
i use Dreamweaver
it separates your parameters in colours.
<spot id="1" url="files/1" static="1" depth="115"
onclick="action()"/>

if you have a missing " the parameter turn red so you know when you have anerror and it is easyer to fing it.

cheathamlane
02-22-2008, 02:44 PM
I would imagine that it would choke on the semicolon rather than a period.

I've found that when I use an FPP-supplied example XML file as a base for my own, that I get the error(s). When I start from scratch, no errors.

It may be an issue with the encoding of the file -- Starting from scratch, I always work in a page encoded utf-8, so can handle most any character w/o issue.
<?xml version='1.0' encoding="utf-8"?>

Editor of choice: BBEdit (http://barebonessoftware.com/)!

The latest rev allows you to show/hide blocks of code on the fly, which is something I've been wanting for a while.

zleifr
02-24-2008, 05:51 PM
I second Patrick on BBEdit. It is super chingon. Also, one reason that various XML editors may not be super happy with FPP XML is that I don't believe multi-line attributes are legal, ie:
onclick="
spot.property=value;
spot.property=value;
"

cheathamlane
02-24-2008, 06:02 PM
Also, one reason that various XML editors may not be super happy with FPP XML is that I don't believe multi-line attributes are legal, ie:
onclick="
spot.property=value;
spot.property=value;
"

Good point Z! I had missed that.

carel
02-24-2008, 06:48 PM
Here is another reason why Flashpanoramas xml will not validate:
(?panoName=images/pano2&pan=100)" />

It is because in xml "&[word]" is used for an "entity refference".
"&" and "<" are reserved characters in xml and xml expects a closing character of ";". So when it encounters "=" instead, it invalidates the file as xml.

Here is a quote on the subject from www.w3schools.com

//quote
There are 5 predefined entity references in XML:
&lt; < less than
&gt; > greater than
&amp; & ampersand
&apos; ' apostrophe
&quot; " quotation mark

Note: Only the characters "<" and "&" are strictly illegal in XML. The greater than character is legal, but it is a good habit to replace it.
//endquote

What a bummer! XML editors make it sooo much easier for semi-dyslexics like me.

Carel

carel
02-24-2008, 07:21 PM
I think I found a solution: search&replace all "&" with "$". Now the flashpanoramas xml is validated by xml editors, or at least tolerated:)

(This should work, unless "$" is used by Flashpanoramas for something already...?)
Oh, I just see that "$" is used for loaderText. I cannot find "~" used for anything. So that should work unless one works on a Spanish or Portugese website...? Is there a safer character as temporary replacement for "$" ?

Carel

cheathamlane
02-24-2008, 08:27 PM
I think I found a solution: search&replace all "&" with "$". Now the flashpanoramas xml is validated by xml editors, or at least tolerated:)

(This should work, unless "$" is used by Flashpanoramas for something already...?)
Oh, I just see that "$" is used for loaderText. I cannot find "~" used for anything. So that should work unless one works on a Spanish or Portugese website...? Is there a safer character as temporary replacement for "$" ?

Carel

AAAHHH! Carel, no! :o I foresee madness...

You can always wrap weird stuff up in CDATA markers, but I'm not sure off the top of my head about doing that in attributes.

Your easiest bet will be to just use a plain text editor, of whatever flavor -- rather than trying exotic workarounds to make your WYSIWYG XML editor happy. Otherwise you have to remember to search and replace your (now improperly formatted for FPP) workarounds with what FPP likes.

?