How to validate an XPS document?

旧时模样 提交于 2019-12-24 01:36:10

问题


Is there any C# API to validate a generated XPS document? (i.e. to make sure the file is a valid xps file)


回答1:


Don't know about an API, but there is a Microsoft tool that tests a file's conformity to the XML Paper Specification:

http://msdn.microsoft.com/en-us/library/aa348104.aspx

Cheers!




回答2:


Xps just an XML format.

You could try:

  1. Rename the XPS file to *.zip, and unzip it. You will see all the xml. There are quite a few files and directories.
  2. Download the XML Paper Specification for xps from http://www.microsoft.com/whdc/device/print/xps/xpsspec.mspx.

  3. So now you have the spec for xps, the schemas (there are five), and a whole bunch of xml documents to validate.

There are of course plenty of easy ways to validate xml in C# once you figure out which schema corresponds to which xml file.

Good luck with that.



来源:https://stackoverflow.com/questions/3785784/how-to-validate-an-xps-document

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!