以XML格式保存数据 [英] Saving data in XML format

查看:88
本文介绍了以XML格式保存数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

请告诉我如何完成以下操作或以下方法是否正确。

Currenlty我有一份有9页的报告的硬拷贝。我需要将其数字化并以与硬拷贝相同的形式显示报告(其中包含不同的子部分,每个部分都有一些复选框,单选按钮等等)。方法是

1。为整个9页创建单个XML模板。为XML模板生成XSD。创建一个XSL,以与硬拷贝相同的格式显示XML。

我在以下内容中无效:
1。我可以使用所需格式的XSL显示xml。但是第一次它没有数据。
例如:

Hi All,

Please advice me on how to accomplish the following or whether the following approach is correct.

Currenlty I have hardcopy of a report which has 9 pages. I need to digitize this and show the report in the same form as the hardcopy (which has different subsections and each has some checkbox, radio buttons, etc...). The approach is

1. Create an single XML template for the entire 9 pages.
2. Generate an XSD for the XML template.
3. Create an XSL to show the XML in the same format as the hardcopy.

I am void at the following:
1. I can display the xml with XSL applied in the format required. but first time it will not have data.
ex:

<Root>
      <Section1>
            <DiseaseName></DiseaseName>
            <patient Name=""/>
      </Section1>
</Root>


当用户通过在线表单输入数据(即)时,用户将访问Http://localhost/VD/XMLForm.xml
一旦他输入数据并保存它就会有文本框和其他输入输入区域,这样我就可以得到带有数据的xml。

我将如何实现这一目标...请提供建议。 />

When the user enters the data via the online form (i.e.,) the user will be accessing Http://localhost/VD/XMLForm.xml
which will have the textbox and other input entry areas once he enters the data and saves it should yield me xml with data.

How will I accomplish this...please advice.

<Root>
      <Section1>
            <DiseaseName>Some Disease</DiseaseName>
            <patient Name="XYZ"/>
      </Section1>
</Root>


怀疑是用户点击保存后,是否有任何内置类以xml格式保存,或者我应该写入登录以获取疾病形式字段并插入相应的标签。完成后,我会将数据库中的XML存储在数据库中,并在必要时进行检索。

谢谢。

The doubt is once the user clicks save, is there any built in class to save in an xml format or should i write the login to take the disease form field and insert into the corresponding tag. Once this is done, I will store the XML in the DB with the data and retrieve whenever necessary.

Thanks.

推荐答案

我好不太了解整个工作流程。但是,关于以XML格式保存内容,您可以使用 XmlDocument.Save 方法?

例如下面的一些代码:


Well I don't quite understand your whole workflow. However regarding saving the content in XML format, can you use XmlDocument.Save method?

For example some code like below:

// Create the XmlDocument.
XmlDocument doc = new XmlDocument();
doc.LoadXml("<Root><Section1><DiseaseName></DiseaseName><patient Name=\"\"/></Section1></Root>");

// Update the document
XmlElement node = (XmlElement)doc.SelectSingleNode("/Root/Section1/DiseaseName");
node.InnerText = "Some Disease";

node = (XmlElement)doc.SelectSingleNode("/Root/Section1/patient");
node.GetAttributeNode("Name").Value = "XYZ";

// Save the document to a file.
doc.Save("data.xml");







这篇关于以XML格式保存数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆