Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Basic XML Question from XML Newbie

Status
Not open for further replies.

TheCivic

Programmer
Feb 7, 2006
34
GB
Hi everyone,
Can someone please give me some advice? I have never wrote a xml file before and would like to know what nodes i should use.

My xml file will contain 0, 1 or more actions, 0 or 1 comments, 0 or 1 locations.

Each action will have a name, date and time.
Each comment will just have text.
Each location will just have text.

Should i use a format like this??
<root>
<actions>
<action>something here</action>
<action>something here</action>
<action>something here</action>
<actions/>
<comments>
<comment>something here</comment>
<comments/>
<locations>
<location>something here</location>
<locations/>
<root/>

or should i use this?
<root>
<action>something here</action>
<action>something here</action>
<action>something here</action>
<comment>something here</comment>
<location>something here</location>
<root/>

I am not sure when and where to use child nodes, or whether you have too.
Also are there any articles on easy ways to read, add and update xml. I am storing this xml within a database field, so it is NOT coming from a file.

Thank you everyone in advance.
 
>I am not sure when and where to use child nodes, or whether you have too.
You are absolutely free to do whatever you want. Nothing stops you from using or not using child nodes. As long as the result is a well-formed doc, only the logic/semantic dictates.

>Also are there any articles on easy ways to read, add and update xml.[/i
You know what to do. "easy"? nothing is at the start.

>I am storing this xml within a database field, so it is NOT coming from a file.
Read your database software on xml support.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top