How to start using XML as data storage
Hi.
Well here's the thing. I have to make xml file that will store some data. Since I started with XML just yesterday there are few things that are not so clear.
First can I use this to store some info:
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE Camera [
<!ELEMENT name (#PCDATA)>
<!ELEMENT id (#PCDATA)>
<!ELEMENT path (#PCDATA)>
]>
<Camera>
<name>camera1</name>
<id>1</id>
<path>no data</path>
</Camera>
Is this legal to use.
I would need to store structure in xml file and the structure look something like this
int num_of_cameras;
camera {
name;
id;
}
Is the way to do it DTD? And where could I found some good examples on the subject of DTD? Thanxs
[967 byte] By [
Odiee] at [2007-11-19 23:45:25]

# 2 Re: How to start using XML as data storage
No problem, but just want to know is the one above correct way to use xml.
And say I have to store cameras count, where would I specify that in xml file.
Odiee at 2007-11-10 3:28:04 >

# 3 Re: How to start using XML as data storage
here is a Simple One.Check it out may be this One Help you.
<xml>
<NoofCamera>put Value here </NoofCamera>
<CameraInfo>
<CameraNo> 1 </CameraNo>
<CameraName> Kodak</CameraName>
</CameraInfo>
</xml>
Thanx
# 4 Re: How to start using XML as data storage
Yes, but you used NoofCamera tags, How and where I specify tags?
Do I do that using <!DOCTYPE>? or does XML generate tags just by using them? Like you used <NoofCamera> tags and did'n specify anywhhere what it was. Does that meen that I can use something like this to specify data?
<xml>
<CameraCount> 16 </CameraCount>
<CameraInfo>
<name> camera1 </name>
<id> 1 </id>
<path> usa.newyork.manhattan.21streat </path>
</CameraInfo>
<CameraInfo>
<name> camera2 </name>
<id> 2 </id>
<path> croatia.zagreb.dubrava.11streat </path>
</CameraInfo>
<CameraInfo> ...and so on ... </CameraInfo>
Is this correct?
Odiee at 2007-11-10 3:30:03 >

# 5 Re: How to start using XML as data storage
yes Except Closing tag of XMl :p which u forget i think .And it's upto you. That what's the name you are going to choose for your node .you can define it at the time when you will create your xml.
<xml>
<CameraCount> 16 </CameraCount>
<CameraInfo>
<name> camera1 </name>
<id> 1 </id>
<path> usa.newyork.manhattan.21streat </path>
</CameraInfo>
<CameraInfo>
<name> camera2 </name>
<id> 2 </id>
<path> croatia.zagreb.dubrava.11streat </path>
</CameraInfo>
<CameraInfo> ...and so on ... </CameraInfo>
</xml>
Thanx