XML Python 查看器

在瀏覽器中查看 XML 文檔,而無需 Adobe 雜技演員或使用 Python 實現自動化。

如何使用 Python for .NET 庫查看 XML 文件

為了查看 XML 文件,我們將使用 [Aspose.PDF for .NET](https://products.aspose.com/pdf/net) API,這是一個功能豐富、功能強大且易於使用的文檔操作 API,適用於 python-net 平臺。打開 [NuGet](https://www.nuget.org/packages/aspose.pdf) 包管理器,搜索“.PDF”並安裝。您也可以從程式包管理器主控台使用以下命令。

Python Package Manager Console

pip install aspose-pdf

通過 Python 查看 XML 文件


您需要使用 [Aspose.PDF for .NET](https://releases.aspose.com/pdf/net) 來嘗試環境中的代碼。

  1. 使用文件實例載入 XML 。
  2. 查看生成的檔案。

Python - 用於查看 XML 文件的示例代碼。

<% viewer-files.code-block.subtitle %>

    # Instantiate XslFoLoadOption object
    options = XslFoLoadOptions(".\\samples\\employees.xslt");
    # Set error handling strategy
    options.ParsingErrorsHandlingType = XslFoLoadOptions.ParsingErrorsHandlingTypes.ThrowExceptionImmediately;
    # Create Document object
    pdfDocument = Document(".\\samples\\employees.xml", options)
    pdfDocument.Save(_dataDir + "data_xml.pdf")