简体   繁体   English

使用javax包装器的XML自定义StAX解析器

[英]Custom StAX Parser for XML using javax wrappers

Custom StAX Parser for XML using javax wrappers 使用javax包装器的XML自定义StAX解析器

How do you do this; 你怎么做到这一点; or at least good suggestions on the right documentation / examples / tutorials? 或至少在正确的文档/示例/教程上有好的建议?

I've been using the javax.xml.stream package to process XML files but the application is begging for some "non-standard XML" (easy to understand what the means if you're not picky). 我一直在使用javax.xml.stream包来处理XML文件,但是该应用程序正在请求一些“非标准XML”(如果您不挑剔,则容易理解这意味着什么)。 I can write the parser, but I want this to be configurable: so that the app continues to use the same XML processing code except for changing the parser as needed. 我可以编写解析器,但是我希望它是可配置的:以便该应用程序继续使用相同的XML处理代码,只是根据需要更改解析器。

The hard part at this point is finding concrete info on how this is done. 此时最困难的部分是找到有关如何完成操作的具体信息。 Documentation speaks of, for example, configuring the parameters of SAXParserFactory and such, but I haven't found specific documentation or examples. 文档谈到例如配置SAXParserFactory的参数等,但是我还没有找到具体的文档或示例。 I've even looked into some existing StAX source code. 我什至研究了一些现有的StAX源代码。 Need some good hints / guidance on how this is done in order to move forward. 需要一些良好的提示/指导,以实现这一目标,以便继续前进。

According to the documentation, you can't. 根据文档,您不能。 You can use one of three approved parsers. 您可以使用三个批准的解析器之一。 Anything else will result in an error. 否则会导致错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM