你要使用的是WriterProcessingInstruction() Method
其實你查看XmlTextWriter的Help就找到範例了
以下是擷取的範例
e.g.
//Write the XML delcaration.
writer.WriteStartDocument();
//Write the ProcessingInstruction node.
String PItext="type='text/xsl' href='book.xsl'";
writer.WriteProcessingInstruction("xml-stylesheet", PItext);
由<? ?>所包含的是Processing Instruction, 這是XML的相關規格你本身應該要知道才是
知道它是什麼東西, 自然可以很快地找到對應的Method
※ 引述《ireullin (raison detre)》之銘言:
: 請問一下在 XmlTextWriter 中
: 如何寫入如下面第二行中決定讀取xsl檔的標籤
: <?xml version="1.0" encoding="big5" ?>
: <?xml-stylesheet type="text/xsl" href="test.xsl" ?>
: 我使用了 WriteStartDocument
: 但是他只有寫出
: <?xml version="1.0" encoding="big5" ?>
: 請各位提示一下該用哪個method
: 因為我試了幾個都不行
--
對於已經無法擁有的
唯一能做的是
不要忘記
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.125.251.225
※ 編輯: petrushka 來自: 140.125.251.225 (08/14 11:18)