日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

android transform xml xsl,XslCompiledTransform.Transform 方法 (System.Xml.Xsl) | Microsoft Docs

發布時間:2025/3/21 67 豆豆
生活随笔 收集整理的這篇文章主要介紹了 android transform xml xsl,XslCompiledTransform.Transform 方法 (System.Xml.Xsl) | Microsoft Docs 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

使用 URI 指定的輸入文檔執行轉換,然后將結果輸出到 XmlWriter。Executes the transform using the input document specified by the URI and outputs the results to an XmlWriter. The XsltArgumentList provides additional run-time arguments.

public:

void Transform(System::String ^ inputUri, System::Xml::Xsl::XsltArgumentList ^ arguments, System::Xml::XmlWriter ^ results);

public void Transform (string inputUri, System.Xml.Xsl.XsltArgumentList? arguments, System.Xml.XmlWriter results);

public void Transform (string inputUri, System.Xml.Xsl.XsltArgumentList arguments, System.Xml.XmlWriter results);

member this.Transform : string * System.Xml.Xsl.XsltArgumentList * System.Xml.XmlWriter -> unit

Public Sub Transform (inputUri As String, arguments As XsltArgumentList, results As XmlWriter)

參數

inputUri

輸入文檔的 URI。The URI of the input document.

XsltArgumentList,包含用作轉換輸入的命名空間限定的參數。An XsltArgumentList containing the namespace-qualified arguments used as input to the transform. 此值可為 null。This value can be null.

The XmlWriter to which you want to output.

If the style sheet contains an xsl:output element, you should create the XmlWriter using the XmlWriterSettings object returned from the OutputSettings property. 這樣可以確保 XmlWriter 的輸出設置是正確的。This ensures that the XmlWriter has the correct output settings.

例外

inputUri 或 results 值為 null。The inputUri or results value is null.

執行 XSLT 轉換時出錯。There was an error executing the XSLT transform.

inputtUri 值包含無法找到的文件名或目錄。The inputtUri value includes a filename or directory cannot be found.

無法解析 inputUri 值。The inputUri value cannot be resolved.

- 或 --or-

處理該請求時出錯。An error occurred while processing the request.

inputUri 不是有效的 URI。inputUri is not a valid URI.

加載輸入文檔時出現分析錯誤。There was a parsing error loading the input document.

示例

下面的示例使用 XsltArgumentList 對象創建一個表示當前日期和時間的參數。The following example uses an XsltArgumentList object to create a parameter representing the current date and time.

using System;

using System.IO;

using System.Xml;

using System.Xml.Xsl;

public class Sample

{

public static void Main()

{

// Create the XslCompiledTransform and load the stylesheet.

XslCompiledTransform xslt = new XslCompiledTransform();

xslt.Load("order.xsl");

// Create the XsltArgumentList.

XsltArgumentList xslArg = new XsltArgumentList();

// Create a parameter which represents the current date and time.

DateTime d = DateTime.Now;

xslArg.AddParam("date", "", d.ToString());

// Transform the file.

using (XmlWriter w = XmlWriter.Create("output.xml"))

{

xslt.Transform("order.xml", xslArg, w);

}

}

}Imports System.IO

Imports System.Xml

Imports System.Xml.Xsl

Public Class Sample

Public Shared Sub Main()

' Create the XslCompiledTransform and load the stylesheet.

Dim xslt As New XslCompiledTransform()

xslt.Load("order.xsl")

' Create the XsltArgumentList.

Dim xslArg As New XsltArgumentList()

' Create a parameter which represents the current date and time.

Dim d As DateTime = DateTime.Now

xslArg.AddParam("date", "", d.ToString())

Using w As XmlWriter = XmlWriter.Create("output.xml")

' Transform the file.

xslt.Transform("order.xml", xslArg, w)

End Using

End Sub

End Class

該示例使用以下兩個數據文件作為輸入。The example uses the following two data files as input.

order.xmlorder.xml

The Handmaid's Tale

19.95

Americana

16.95

order .xslorder.xsl

注解

此方法使用 XmlUrlResolver 沒有用戶憑據的默認值來解析輸入文檔和 document() 在樣式表中找到的任何 XSLT 函數的實例。This method uses a default XmlUrlResolver with no user credentials to resolve the input document and any instances of the XSLT document() function found in the style sheet. 如果這些資源中的任何一個需要身份驗證的網絡資源,請使用 XmlResolver 以作為其參數之一的重載,并使用 XmlResolver 所需的憑據指定。If any of these resources are located on a network resource that requires authentication, use the overload that takes an XmlResolver as one of its arguments and specify an XmlResolver with the necessary credentials.

使用 XmlReader 帶有默認設置的來加載輸入文檔。An XmlReader with default settings is used to load the input document. 在上禁用 DTD 處理 XmlReader 。DTD processing is disabled on the XmlReader. 如果需要 DTD 處理,請創建一個 XmlReader 啟用了此功能的,并將其傳遞給 Transform 方法。If you require DTD processing, create an XmlReader with this feature enabled, and pass it to the Transform method.

適用于

《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀

總結

以上是生活随笔為你收集整理的android transform xml xsl,XslCompiledTransform.Transform 方法 (System.Xml.Xsl) | Microsoft Docs的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。