PDA

View Full Version : Why I failed in reading "<object>"


HuaMuLan
03-24-2009, 08:01 PM
When I used readValue , read files contains "<" , I always failed in reading that string . Why?

in_name = getOpenFileName()

if in_name != undefined then
(

in_file = openFile in_name



if in_file != undefined then

(
readValue in_file

)
)
close in_file

and the file I read contains "<object> name </object>"
This is only a test for me reading XML files.

ZeBoxx2
03-24-2009, 08:40 PM
probably because you don't want to use readValue. readValue interprets whatever gets read as a MaxScript parseable value. You probably want one of the other read commands, such as readLine (reads the entire line and returns it as a new string value).

HuaMuLan
03-24-2009, 08:47 PM
Actually , I want to read in my XML files . I find readValue ready cann't do that .
Now I use <string><Interface:MemStream>.readToken(). It seems works properly , but need to care more when one read in characters like "8,9,30..." . Maxscript assumed that they are chars so they need to be execute to convert them to digiatls:P

HuaMuLan
03-24-2009, 09:01 PM
I have tried readValue more than once , did it works good for you ?

ZeBoxx2
03-24-2009, 09:13 PM
all of the buffer methods are basically for plaintext strings only (short of the binary stream ones). If you want to parse anything more than very basic XML files, I'd look into using .NET instead of trying to write your own XML parser with pure maxscript.

PiXeL_MoNKeY
03-24-2009, 09:17 PM
Is there a reason you aren't using teh DotNet controls to access the XML data? Paul Neale has notes on it here (http://paulneale.com/tutorials/dotNet/xml/xmlReading.htm).

-Eric

HuaMuLan
03-27-2009, 05:34 AM
Well , I just haven't use DONET befor .I will have a close look at it.
Thax all of you.

HuaMuLan
03-29-2009, 07:01 AM
Thanx I learned it .And upload mine(not a XML format,need to be updated) to my personal website.

CGTalk Moderation
03-29-2009, 07:01 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.