| |||
| Hi, I am new to xml, so if I ask something stupid or funny, pls don't laugh. my problem is like this: I have a data structure like this 代码:
Thanks a lot! |
| |||
| Sorry for the confusion. What I wanted to do is save a data structure (i used to do that by save it as a binary file), this time I try to save it as xml. Since I am not familizr with xml at all, so possibly I have choose a stupid way doing this. I attach a simplified project to show how I do that. If there is more sophisticated or simpler way you can show me, it's very appreciated. Please ignore my previous question, it's due to my understading of "EndElement". |
| ||||
| Here is a very simple demo source. When you click button - loadXML, it will load XML file's contents into a dataset. Then display it. After that you click button - SaveXML, it gonna save a new xml file named new_customer.xml. It very simple. But it show a quick way and mostly used way to handle XML contents. After loaded Customers, it will append their name in TextBox, I use some XML concept to do that, XPath to get all names. The XML source is also simple, I didn't write a schema for it. In real world, most XML come with a DTD or schema to tell you the XML content's structure. The way you used, WriteStartElement.., it is like we create a HTTP stream from coding. But you know, we never create a website by that way. Mostly we create HTML sepearately and with some professional tools, and use some app to read it or save it. To XML, we do the same thing. |
| ||||
| I guess, you use C++ a long time and a smart guy. You are glad to do everything by your own code. I just brief your code. I think you want to save instances of a Class in the XML file. Am I right? If yes, why don't you use XML serialize? Check XmlSerializer Class in MSDN. |
![]() |
| 书签 |
| 主题工具 | |
| 显示模式 | |
| |
相似的主题 | ||||
| 主题 | 主题作者 | 版面 | 回复 | 最后发表 |
| question about reference parameter through bind2nd | clip | 技术杂烩 | 5 | 2004-04-26 03:49 AM |
| question about auto_ptr | clip | 技术杂烩 | 2 | 2004-03-24 12:30 PM |
| Question: C语言里,return能不能返回一个数组? | xyz1848 | 技术杂烩 | 7 | 2003-12-13 05:22 PM |
| May I have a question? | Lili yan | Zion/测试 | 3 | 2003-05-29 02:03 PM |
| 2 question | geoffrey | 技术杂烩 | 1 | 2003-03-17 11:50 AM |