Click here to Skip to main content
15,910,234 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone,

I am new to XML.

I want to write an XML file about a Reactor.
The reactor contains some parts.
For example. a saddle contains sternum and shim-plate, maybe I can write like below:

XML
<saddle>
<sternum></sternum>
<shim-plate></shim-plate>
</saddle>

What's more, saddle owns its ID, and sternum and shim-plate also own their ID , on the otherside, sternum and shim-plate elements own other "length" and "width".
Well...I don't know how to write my XML, I tried to write it like below:
XML
<saddle ID="">
<sternum ID=""><length></lenght></sternum>
<shim-plate ID=""><length></lenght></shim-plate>
</saddle>


Is it right or there will be better method to write this XML?:confused:
Please give me some suggestions or help!!Thanks a lot!!
Posted
Updated 10-Oct-10 21:44pm
v2
Comments
Dalek Dave 11-Oct-10 3:44am    
Edited for Grammar and Readability.

1 solution

When following the new XML standards it's better to avoid attributes and use elements instead. Like the example of your XML below:
<saddle>
    <id></id>
    <sternum>
        <id></id>
        <length></lenght>
    </sternum>
    <shim-plate>
        <id></id>
        <length></lenght>
    </shim-plate>
</saddle>

Good luck!
 
Share this answer
 
Comments
sanyexian 11-Oct-10 4:37am    
Hi,Nijboer!Thank you very much for your answer! I've got it!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900