XML

Blitz3D Forums/Blitz3D Beginners Area/XML

Yahfree(Posted 2007) [#1]
hey, a friend was nice enough to supply a file that contains ALOT of information i need, the only problem is its in XML format, that i know nothing about, i want to write a program that will convert this information into somthing i can use.

the question is, how do i read off this file? any ideas? or is this somthing blitz cant do?


OJay(Posted 2007) [#2]
http://blitzbasic.com/codearcs/codearcs.php?code=1393


Yahfree(Posted 2007) [#3]
thanks, but i think it might be easyer for me to just copy and paste the file into note-pad and save as .txt


Yahfree(Posted 2007) [#4]
Hmm, i looked into XML files, they seem WAY easyer to navigate.

so i gave in and looked at that code archive after about 5 hours of studying it, and learning how XML files, here i am..

anyways heres my problem:

its giving me a "Object does not exist" error when i try to grab data off a node.

it gives the error in the function file under this function on this line:

function:
Function xmlNodeDataGet$(Node)
	this.xmlNode = Object.xmlNode(Node)
	Return this\Contents
End Function


Error line:
Return this\Contents


What are the possible causes for this?

its happening when i call this:

mainnode = xmlNodeFind("Car", rootnode)
node = xmlNodeFind("Name", mainnode)
name$ = xmlNodeDataGet(node);<-- Error


heres the part of the XML file i'm refering to:

<?xml version="1.0" ?> 
- <ArrayOfcars>
   - <Car Id="24692" Name="test" />



any ideas?


Gabriel(Posted 2007) [#5]
Well you haven't got a node called "name" so when you try to get data from it, you're using an object which doesn't exist. The node is called car and you already have it. Name is a property of the car node.


Yahfree(Posted 2007) [#6]
yeah, i figured it out it works now, i like these XML files


Yahfree(Posted 2007) [#7]
i bit off topic, but its required for the XML project.. how do i see if another type already exists? like for example,

theres about 1000 nodes, each one is a different type of 'car' so i made a 'CarType' storage on the car nodes..

that way i can later call all the data with that 'CarType' on it.

i'm storing my xml data in types.

i have a dropdown menu that i add all these CarTypes to, so that a user can pick what catagory displayed in the other dropdown.

so to add these i do this:

for allcars.car = each car
WB3D_AddGadgetItem(carscatagory,allcars\division$,0,0)
next


this works good but because theres more then 1 care with that division, it adds a bunch of useless duplicates i need to see like this:

for allcars.car = each car
if this isnt already in the dropdown then

WB3D_AddGadgetItem(shipcatagory,allships\division$,0,0)
next


How do i do this?