English 中文(简体)
• 制作XML文件的一部分,作为示范文件
原标题:Creating a part of XML document as a string

我收到了一套带有违约值的辅助材料,我希望编写一份说明,作为下文(不是完整的xml文件)的一部分xml文件。 我想在每一个属性之间划出一个表格。 我发现的扼杀是本案中可行的选择。 在网络中,是否有更好的办法这样做?

<XmlNodes>
<ChildNode Attribute1 ="100"    Attribute2="200"    Attribute3 ="0"/>
<ChildNode Attribute1="100"     Attribute2="200"    Attribute3 ="0"/>
...
</XmlNodes>
最佳回答

这里的黑客很少,至少只是为了扼杀手法而晚于此刻:

var nodes = new XElement("XmlNodes");
foreach (var i in Enumerable.Range(1,10))
{
    nodes.Add(new XElement("ChildNode", 
        new XAttribute("Attribute1", 100), 
        new XAttribute("Attribute2", 200), 
        new XAttribute("Attribute3", 0)));
}

var result = nodes.ToString().Replace("" A", ""	A"); // **" A** becomes **"	A**

但我坚持认为,如果这是为了向人们提供 template的模板,那么你最好不要让他们以非XML格式(如CSV)加以洗刷,然后在你宣布时改用XML。

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签