2015-09-04 194 views
1

我不知道是否有人熟悉STAX的API,特別是stax2的API。問題用stax2-API

我有我的應用程序一個奇怪的行爲。

我有,但是隻要我把org.codehaus.woodstox取決於Java.xml.stream:stax-1.0-2

應用程序答:stax2-API在我的依賴,甚至不需要使用它但是,應用程序切換到使用stax2-api。

Stax2-API是作爲按照在github:

Stax2 API由以下斯塔克斯XML 實現本機實現:

Woodstox阿爾託此外,Stax2 API包含包裝實現 ,可以是用於支持常規Stax 實施(如Sun SJSXP(默認的Stax實現,捆綁 ,JDK 1.6和1.7))上的大部分API。

API類位於org.codehaus.stax2包中。

Stax2 API also contains partial Reference Implementation of many of API classes, under org.codehaus.stax2.ri: intention is to make it as painless as possible for Java Stax parser to implement full Stax2 support. 

<dependency> 
    <groupId>org.codehaus.woodstox</groupId> 
    <artifactId>stax2-api</artifactId> 
    <version>3.1.2</version> 
</dependency> 

stax2的依賴關係如下:

<dependencies> 
      <!-- Since baseline with 4.0 is Java5, we still need to officially keep this in; 
       should drop once we go up to Java6 or 7 
       --> 
      <dependency> 
       <groupId>javax.xml.stream</groupId> 
       <artifactId>stax-api</artifactId> 
       <version>1.0-2</version> 
       <!-- at this point, with inclusion in JDK 1.6, this should be given --> 
       <scope>provided</scope> 
      </dependency> 
    </dependencies> 

應當指出的是,我的應用程序,其原有的依賴上順暢運行Java.xml.stream:stax-1.0- 2。

任何想法,爲什麼stax2代替STAX。

+0

能否請你解釋一下你的「應用程序切換[原文],用stax2-API」的意思是什麼呢? –

+0

我放棄了,我要去另一個lib。但是,如果我會解釋,stax2-api有一個stax-api的部分參考實現。 lib的所有者告訴我,它似乎唯一的可能性是陰影。因爲stax2-api中有一些軟件包可以取代stax-api軟件包。所以應用程序使用這些。 – MaatDeamon

+1

您可能誤解了他所說的話(或者我誤解了你的意思),因爲stax2-api沒有與stax-api相同的任何包。因此陰影不會改變任何東西。 –

回答

1

這個問題沒有任何意義:stax2-api只是一個API擴展,實現可以選擇實現。它沒有任何其他的力量;不會自動註冊任何東西。

你可能有什麼是在類路徑中包含任何Stax實現將導致添加SPI(META-INF/services /),並且這可能會改變實際的Stax實現,除非你指定實現你想要的當致電XMLInputFactory.newFactory())。 但這與Stax2 API jar無關。