2014-09-12 19 views
0

我试图让这个输出:设计一个表格内的XmlWriter

<thead> 
    <tr><th>Condition</th><th>Effective Dates</th><th>Condition Status</th></tr> 
</thead> 

,但我得到这个:

<thead> 
    <tr> 
     <th>DX Code</th> 
     <th>Date</th> 
     <th>Code Type</th> 
    </tr> 
</thead> 

我似乎无法得到的元素显示在单一线。 我这个代码是:

doc.WriteStartElement("thead"); 
    doc.WriteStartElement("tr"); 
    doc.WriteStartElement("th"); 
    doc.WriteString("DX Code"); 
    doc.WriteEndElement(); 
    doc.WriteStartElement("th"); 
    doc.WriteString("Date"); 
    doc.WriteEndElement(); 
    doc.WriteStartElement("th"); 
    doc.WriteString("Code Type"); 
    doc.WriteEndElement(); 
    doc.WriteEndElement(); 
    doc.WriteEndElement(); 

有越来越格式化,如第一个例子中的一种方式?我试着用WriteString,但是全部换成了“<”和“>”与XML“& LT”和“& GT”

回答

0

好,我知道它会通过调用doc.WriteWhiteSpace(“”)工作; (“tr”)元素之后。这会暂停indent/newline直到(“tr”)元素结束。