This is G o o g l e's cache of http://www.flashsandy.org/forum/index.php?showtopic=135 as retrieved on 17 Jul 2007 15:25:05 GMT.
G o o g l e's cache is the snapshot that we took of the page as we crawled the web.
The page may have changed since that time. Click here for the current page without highlighting.
This cached page may reference images which are no longer available. Click here for the cached text only.
To link to or bookmark this page, use the following url: http://www.google.com/search?q=cache:65AWPpGwqVEJ:www.flashsandy.org/forum/index.php%3Fshowtopic%3D135+site:www.flashsandy.org+showtopic&hl=en&ct=clnk&cd=89


Google is neither affiliated with the authors of this page nor responsible for its content.
These terms only appear in links pointing to this page: showtopic

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Buggy WRLParser, Problems with white space in the WRLParser
Petit
post Sep 27 2006, 11:27 AM
Post #1


Advanced Member
***

Group: Moderator
Posts: 543
Joined: 21-June 06
From: Borgholm, Sweden
Member No.: 38



I've played around a bit with the WRLParser, and found that it has some problems with white space.
The documentation says : "WRL files must NOT have indentation! Please choose the without indentation option before generation."

True enough, but it doesn't stop there. I tried to make a small change in the 2cubes.wrl, that comes with the Sandy 1.0 WRLTest. I used TextPad and saved the file as UTF8, and after that the geometry was corrupted.
After some testing and reading the file in hexadecimal form, I discovered that TextPad changed the white space in a subtle way.

Here is the point array for the first box in 2cubes.wrl:

CODE
coord DEF Box01-COORD Coordinate { point [
-16.68 0 19.32, 16.68 0 19.32, -16.68 0 -19.32, 16.68 0 -19.32,
-16.68 25.83 19.32, 16.68 25.83 19.32, -16.68 25.83 -19.32, 16.68 25.83 -19.32]
}


The first line of points ends with a space and an end of line, hex '20 0D 0A'. On save, the text editor strips the space character at the end of that line, as being superfluous. The WRLParser reads the point array as corrupted.
I don't know why it wants a space here, as we already have a comma ( ',' ) delimiter, which would be enough.

Possible solutions:

VRML uses space ( hex 20 ) as delimiter for the x, y, z values of in a point array, so we cannot simply skip spaces.

What we could do, to make the parser less sensitive to the amount and order of white space, would be to preprocess the file, after it is loaded to make the following change, before the text is parsed:

o Read through the file and change any length of white space into one space character.

If this is done, all 'end of line' or tab characters are converted to just one space, which is what the parser wants. As extra bonuses, we could use any UTF8 capable editor to write or change a VRML file, and we can use pretty printed WRL files with indentations for block levels.

The extra overhead introduced by preprocessing, I think, would be well compensated for by the possibility to use different VRML generators and the more human readable WRL files.

This post has been edited by Petit: Sep 27 2006, 11:30 AM
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
kiroukou
post Sep 27 2006, 12:09 PM
Post #2


Administrator
***

Group: Root Admin
Posts: 865
Joined: 12-June 06
Member No.: 1



Hi Petit,
Indeed I've heard some problems with the Wrl files... This format doens't seems to be a real standard...

in AS3 the problem will be easier to fix thanks to regular expressions.

For the moment, I recommand to use the ASEParser which seems to be more robust.

I'll read more carrefully your propositions, when I'll update my code and prepare it for the next release!
thanks!!
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Petit
post Sep 28 2006, 12:37 AM
Post #3


Advanced Member
***

Group: Moderator
Posts: 543
Joined: 21-June 06
From: Borgholm, Sweden
Member No.: 38



I suggested
QUOTE
Read through the file and change any length of white space into one space character.

Well, I tried my simplistic solution for a couple of hours, and found a nice little algorithm, that did just that.
To no avail (IMG:style_emoticons/default/sad.gif)

Which just proves, I didn't know the VRML file format well enough.
Had I not been such a simple mind, I should have realized, it's not quite that simple.

First of all comments in a wrl file starts with '#' and ends with end-of-line ( aka '\n' or hex 0D0A ).
Changing all white space to space makes everything a long and interesting comment, as the file will start with "#VRML V2.0 utf8".

So, some more thought should go into this.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

- Lo-Fi Version Time is now: 17th July 2007 - 03:07 PM
phpMyVisites