AlexHolsgrove
11 years agoVisitor
ReadAsciiFile returns empty string
I am trying to read in an xml file with ReadAsciiFile but the content is always empty. I've added some checking to see if the file exists (I know it does) but again nothing. If I perform the checking on say an image file, it works fine (exists = true / type is PNG etc). When I replace the filename with my XML it just fails.
Why can it not read my XML file (some elements removed to save space)?
fileName = "pkg:/xml/data.xml" - or "pkg:/xml/test.png"
LocalFileBrowser = CreateObject("roFileSystem")
print (LocalFileBrowser.exists(fileName))
contents = ReadAsciiFile(fileName)
print "Type: "+type(contents )
Why can it not read my XML file (some elements removed to save space)?
<DefenderBitmapSet>
<ExtraInfo cellsize="40"/>
<Bitmap name="Background" filespec="pkg:/snake_assets/snake.map_w-dirt.png" />
<Bitmap name="game-over" filespec="pkg:/snake_assets/snake.gameover.png" />
<Bitmap name="title-screen" filespec="pkg:/snake_assets/snake.title.3.png" />
<Bitmap name="snake" filespec="pkg:/snake_assets/snake.body_sprite.png">
<Region name="butt-North" x="00" y="00" w="40" h="40" />
<Region name="butt-East" x="40" y="00" w="40" h="40" />
<Region name="butt-South" x="80" y="00" w="40" h="40" />
<Region name="butt-West" x="120" y="00" w="40" h="40" />
</Bitmap>
<Bitmap name="water_strip" filespec="pkg:/snake_assets/snake.water_sprite.png">
<Region name="a" x="0" y="0" w="40" h="40" t="400" />
</Bitmap>
<Bitmap name="empty" shape="rect" color="0" w="40" h="40" t="680" />
<Animation name="water">
<frame use="water_strip.a" />
</Animation>
<Animation name="tongue-North">
<frame use="snake.tongue-North" />
<frame use="empty" />
</Animation>
<Animation name="tongue-East">
<frame use="snake.tongue-East" />
<frame use="empty" />
</Animation>
<Animation name="tongue-South">
<frame use="snake.tongue-South" />
<frame use="empty" />
</Animation>
<Animation name="tongue-West">
<frame use="snake.tongue-West" />
<frame use="empty" />
</Animation>
</DefenderBitmapSet>