作者:mobiledu2502885111 | 来源:互联网 | 2023-05-19 11:38
IamdevelopinganapplicationusingOSGi(Equinoxplatform),andoneofthebundlesneedstoparse
I am developing an application using OSGi (Equinox platform), and one of the bundles needs to parse XML files. So far I implemented this with SAX (javax.xml.parsers.SAXParserFactory) and I would like to retrieve the SAXParserFactory from the platform.
我正在使用OSGi (Equinox平台)开发一个应用程序,其中一个包需要解析XML文件。到目前为止,我使用SAX (javax.xml.parsers.SAXParserFactory)实现了这一点,我希望从平台中检索SAXParserFactory。
I saw the OSGi standard provides for a XMLParserActivator to allow JAXP implementations to register themselves (http://www.osgi.org/javadoc/r4v41/org/osgi/util/xml/XMLParserActivator.html), so my guess is that there should be some bundles that offer the SAXParserFactory as a service.
我看到OSGi标准提供了XMLParserActivator,允许JAXP实现注册自己(http://www.osgi.org/javadoc/r4v41/org/osgi/util/xml/XMLParserActivator.html),所以我猜想应该有一些包提供SAXParserFactory作为服务。
However, I could not figure out which bundle to add as dependency in order to find a service that offers a SAXParserFactory. I try to retrieve a service reference using
然而,为了找到提供SAXParserFactory的服务,我无法确定将哪个包添加为依赖项。我尝试使用检索服务引用
context.getServiceReferences(SAXParserFactory.class.getName(), "(&(parser.namespaceAware=true)(parser.validating=true))")
Given that XML parsing is a rather common thing to do, I suppose there are implementations available, or other means for getting a XML parser service from the platform.
考虑到XML解析是一种非常常见的操作,我认为有可用的实现,或者从平台获取XML解析器服务的其他方法。
Any help would be very welcome!
任何帮助都是非常受欢迎的!
2 个解决方案