深入jaxb xjc編碼問題的詳細(xì)介紹
更新時間:2013年05月16日 18:01:46 作者:
本篇文章是對jaxb xjc編碼的問題進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下
平時喜歡根據(jù)寫一個xjc批處理命令,根據(jù)xsd批量生成java類,覺得很方便也很酷。但是有時候xsd生成的java類中含有漢字,結(jié)果總是有些問題。
可是xjc命令參數(shù)又沒有encoding參數(shù)之類的。在網(wǎng)上搜了一通,忽然發(fā)現(xiàn)了一個好東東:xjc是由com.sun.tools.internal.xjc.Driver實現(xiàn)的,因此
批處理命令可以如下:
java -Dfile.encoding=UTF-8 -cp D:\java\jdk1.6.0_03\lib\tools.jar com.sun.tools.internal.xjc.Driver -p com.geostar.csw.domain.layer metadata_geo_Layer.xsd
結(jié)果:
parsing a schema...
compiling a schema...
com\geostar\csw\domain\layer\AbstractMDContentInformationType.java
com\geostar\csw\domain\layer\AbstractMDIdentificationType.java
com\geostar\csw\domain\layer\AbstractMDSpatialRepresentationType.java
com\geostar\csw\domain\layer\CIAddressType.java
com\geostar\csw\domain\layer\CICitationType.java
com\geostar\csw\domain\layer\CIContactType.java
com\geostar\csw\domain\layer\CIDateType.java
com\geostar\csw\domain\layer\CIDateTypeCode.java
com\geostar\csw\domain\layer\CIOnLineFunctionCode.java
com\geostar\csw\domain\layer\CIOnLineResourceType.java
com\geostar\csw\domain\layer\CIResponsiblePartyType.java
com\geostar\csw\domain\layer\CIRoleCode.java
com\geostar\csw\domain\layer\DQDataLineageType.java
com\geostar\csw\domain\layer\DQDataQualityType.java
com\geostar\csw\domain\layer\DQDqReportType.java
com\geostar\csw\domain\layer\DQDqStatementType.java
com\geostar\csw\domain\layer\DQSourceType.java
com\geostar\csw\domain\layer\DSAssociationTypeCode.java
com\geostar\csw\domain\layer\EXBoundingCoordinatesType.java
com\geostar\csw\domain\layer\EXExtentType.java
com\geostar\csw\domain\layer\EXGeographicBoundingBoxType.java
com\geostar\csw\domain\layer\EXGeographicBoundingPolygonType.java
com\geostar\csw\domain\layer\EXGeographicDescriptionType.java
com\geostar\csw\domain\layer\EXGeographicExtentPropertyType.java
com\geostar\csw\domain\layer\EXGeographicExtentType.java
com\geostar\csw\domain\layer\EXTemporalExtentPropertyType.java
com\geostar\csw\domain\layer\EXTemporalExtentType.java
com\geostar\csw\domain\layer\EXVerticalExtentType.java
com\geostar\csw\domain\layer\FBZY.java
com\geostar\csw\domain\layer\JHDA.java
com\geostar\csw\domain\layer\MDAerialImageIdentificationType.java
com\geostar\csw\domain\layer\MDAggregateInfomationPropertyType.java
com\geostar\csw\domain\layer\MDAggregateInfomationType.java
com\geostar\csw\domain\layer\MDAnalogMapIdentificationType.java
com\geostar\csw\domain\layer\MDApprovedTypeCode.java
com\geostar\csw\domain\layer\MDArchiveIdentificationType.java
com\geostar\csw\domain\layer\MDBrowseGraphicType.java
com\geostar\csw\domain\layer\MDCRSType.java
com\geostar\csw\domain\layer\MDCharacterSetCode.java
com\geostar\csw\domain\layer\MDClassificationCode.java
com\geostar\csw\domain\layer\MDConstraintsPropertyType.java
com\geostar\csw\domain\layer\MDContentInformationPropertyType.java
com\geostar\csw\domain\layer\MDCoverageContentTypeCode.java
com\geostar\csw\domain\layer\MDCoverageDescriptionType.java
com\geostar\csw\domain\layer\MDDataIdentificationType.java
com\geostar\csw\domain\layer\MDDescKeys.java
com\geostar\csw\domain\layer\MDDigitalArchiveIdentificationType.java
com\geostar\csw\domain\layer\MDDistributionType.java
com\geostar\csw\domain\layer\MDDistributorType.java
com\geostar\csw\domain\layer\MDEllipsoidParametersType.java
com\geostar\csw\domain\layer\MDFeatureCatalogueDescriptionType.java
com\geostar\csw\domain\layer\MDFormatType.java
com\geostar\csw\domain\layer\MDGeometricObjectTypeCode.java
com\geostar\csw\domain\layer\MDGovNameTypeBak.java
com\geostar\csw\domain\layer\MDGridSpatialRepresentationType.java
com\geostar\csw\domain\layer\MDIdentificationPropertyType.java
com\geostar\csw\domain\layer\MDIdentifierType.java
com\geostar\csw\domain\layer\MDImageDescriptionType.java
com\geostar\csw\domain\layer\MDImageIdentificationType.java
com\geostar\csw\domain\layer\MDImagingConditionCode.java
com\geostar\csw\domain\layer\MDLegConstsType.java
com\geostar\csw\domain\layer\MDMaintInformationType.java
com\geostar\csw\domain\layer\MDMaintenanceFrequencyCode.java
com\geostar\csw\domain\layer\MDMapFormCode.java
com\geostar\csw\domain\layer\MDMetadataType.java
com\geostar\csw\domain\layer\MDProgressCode.java
com\geostar\csw\domain\layer\MDProjectionParametersType.java
com\geostar\csw\domain\layer\MDReferenceSystemType.java
com\geostar\csw\domain\layer\MDReferencedThemeType.java
com\geostar\csw\domain\layer\MDResolutionType.java
com\geostar\csw\domain\layer\MDResourceTypeCode.java
com\geostar\csw\domain\layer\MDRestrictionCode.java
com\geostar\csw\domain\layer\MDRestrictionCodeEx.java
com\geostar\csw\domain\layer\MDScopeCode.java
com\geostar\csw\domain\layer\MDSecurityConstraintsType.java
com\geostar\csw\domain\layer\MDSpatialRepresentationPropertyType.java
com\geostar\csw\domain\layer\MDSpatialRepresentationTypeCode.java
com\geostar\csw\domain\layer\MDTopicCategoryCode.java
com\geostar\csw\domain\layer\MDTopoLogyLevelCode.java
com\geostar\csw\domain\layer\MDTpCatType.java
com\geostar\csw\domain\layer\MDVectorSpatialRepresentationType.java
com\geostar\csw\domain\layer\ObjectFactory.java
com\geostar\csw\domain\layer\SVOperationMetadataType.java
com\geostar\csw\domain\layer\SVServiceIdentificationType.java
com\geostar\csw\domain\layer\SpatialReferenceInfo.java
com\geostar\csw\domain\layer\TBOOL.java
com\geostar\csw\domain\layer\TDYTABLETYPE.java
com\geostar\csw\domain\layer\TDataInfo.java
com\geostar\csw\domain\layer\TJHSJ.java
com\geostar\csw\domain\layer\TJHTYPE.java
com\geostar\csw\domain\layer\TJHXX.java
com\geostar\csw\domain\layer\TLAYERTYPE.java
com\geostar\csw\domain\layer\TMInstantType.java
com\geostar\csw\domain\layer\TMPeriodType.java
com\geostar\csw\domain\layer\TMetaInfo.java
com\geostar\csw\domain\layer\TMetaTotal.java
com\geostar\csw\domain\layer\TTABLETYPE.java
com\geostar\csw\domain\layer\TTHMEATICTYPE.java
com\geostar\csw\domain\layer\TUPDATETYPE.java
com\geostar\csw\domain\layer\TUserInfo.java
com\geostar\csw\domain\layer\TVersionInfo.java
com\geostar\csw\domain\layer\TZDGL.java
com\geostar\csw\domain\layer\TZDJH.java
com\geostar\csw\domain\layer\UpdateDescribe.java
com\geostar\csw\domain\layer\package-info.java
c:\Catalog實體類生成工具>
忽然感覺好興奮!jaxb真的是好東東!
可是xjc命令參數(shù)又沒有encoding參數(shù)之類的。在網(wǎng)上搜了一通,忽然發(fā)現(xiàn)了一個好東東:xjc是由com.sun.tools.internal.xjc.Driver實現(xiàn)的,因此
批處理命令可以如下:
java -Dfile.encoding=UTF-8 -cp D:\java\jdk1.6.0_03\lib\tools.jar com.sun.tools.internal.xjc.Driver -p com.geostar.csw.domain.layer metadata_geo_Layer.xsd
結(jié)果:
復(fù)制代碼 代碼如下:
parsing a schema...
compiling a schema...
com\geostar\csw\domain\layer\AbstractMDContentInformationType.java
com\geostar\csw\domain\layer\AbstractMDIdentificationType.java
com\geostar\csw\domain\layer\AbstractMDSpatialRepresentationType.java
com\geostar\csw\domain\layer\CIAddressType.java
com\geostar\csw\domain\layer\CICitationType.java
com\geostar\csw\domain\layer\CIContactType.java
com\geostar\csw\domain\layer\CIDateType.java
com\geostar\csw\domain\layer\CIDateTypeCode.java
com\geostar\csw\domain\layer\CIOnLineFunctionCode.java
com\geostar\csw\domain\layer\CIOnLineResourceType.java
com\geostar\csw\domain\layer\CIResponsiblePartyType.java
com\geostar\csw\domain\layer\CIRoleCode.java
com\geostar\csw\domain\layer\DQDataLineageType.java
com\geostar\csw\domain\layer\DQDataQualityType.java
com\geostar\csw\domain\layer\DQDqReportType.java
com\geostar\csw\domain\layer\DQDqStatementType.java
com\geostar\csw\domain\layer\DQSourceType.java
com\geostar\csw\domain\layer\DSAssociationTypeCode.java
com\geostar\csw\domain\layer\EXBoundingCoordinatesType.java
com\geostar\csw\domain\layer\EXExtentType.java
com\geostar\csw\domain\layer\EXGeographicBoundingBoxType.java
com\geostar\csw\domain\layer\EXGeographicBoundingPolygonType.java
com\geostar\csw\domain\layer\EXGeographicDescriptionType.java
com\geostar\csw\domain\layer\EXGeographicExtentPropertyType.java
com\geostar\csw\domain\layer\EXGeographicExtentType.java
com\geostar\csw\domain\layer\EXTemporalExtentPropertyType.java
com\geostar\csw\domain\layer\EXTemporalExtentType.java
com\geostar\csw\domain\layer\EXVerticalExtentType.java
com\geostar\csw\domain\layer\FBZY.java
com\geostar\csw\domain\layer\JHDA.java
com\geostar\csw\domain\layer\MDAerialImageIdentificationType.java
com\geostar\csw\domain\layer\MDAggregateInfomationPropertyType.java
com\geostar\csw\domain\layer\MDAggregateInfomationType.java
com\geostar\csw\domain\layer\MDAnalogMapIdentificationType.java
com\geostar\csw\domain\layer\MDApprovedTypeCode.java
com\geostar\csw\domain\layer\MDArchiveIdentificationType.java
com\geostar\csw\domain\layer\MDBrowseGraphicType.java
com\geostar\csw\domain\layer\MDCRSType.java
com\geostar\csw\domain\layer\MDCharacterSetCode.java
com\geostar\csw\domain\layer\MDClassificationCode.java
com\geostar\csw\domain\layer\MDConstraintsPropertyType.java
com\geostar\csw\domain\layer\MDContentInformationPropertyType.java
com\geostar\csw\domain\layer\MDCoverageContentTypeCode.java
com\geostar\csw\domain\layer\MDCoverageDescriptionType.java
com\geostar\csw\domain\layer\MDDataIdentificationType.java
com\geostar\csw\domain\layer\MDDescKeys.java
com\geostar\csw\domain\layer\MDDigitalArchiveIdentificationType.java
com\geostar\csw\domain\layer\MDDistributionType.java
com\geostar\csw\domain\layer\MDDistributorType.java
com\geostar\csw\domain\layer\MDEllipsoidParametersType.java
com\geostar\csw\domain\layer\MDFeatureCatalogueDescriptionType.java
com\geostar\csw\domain\layer\MDFormatType.java
com\geostar\csw\domain\layer\MDGeometricObjectTypeCode.java
com\geostar\csw\domain\layer\MDGovNameTypeBak.java
com\geostar\csw\domain\layer\MDGridSpatialRepresentationType.java
com\geostar\csw\domain\layer\MDIdentificationPropertyType.java
com\geostar\csw\domain\layer\MDIdentifierType.java
com\geostar\csw\domain\layer\MDImageDescriptionType.java
com\geostar\csw\domain\layer\MDImageIdentificationType.java
com\geostar\csw\domain\layer\MDImagingConditionCode.java
com\geostar\csw\domain\layer\MDLegConstsType.java
com\geostar\csw\domain\layer\MDMaintInformationType.java
com\geostar\csw\domain\layer\MDMaintenanceFrequencyCode.java
com\geostar\csw\domain\layer\MDMapFormCode.java
com\geostar\csw\domain\layer\MDMetadataType.java
com\geostar\csw\domain\layer\MDProgressCode.java
com\geostar\csw\domain\layer\MDProjectionParametersType.java
com\geostar\csw\domain\layer\MDReferenceSystemType.java
com\geostar\csw\domain\layer\MDReferencedThemeType.java
com\geostar\csw\domain\layer\MDResolutionType.java
com\geostar\csw\domain\layer\MDResourceTypeCode.java
com\geostar\csw\domain\layer\MDRestrictionCode.java
com\geostar\csw\domain\layer\MDRestrictionCodeEx.java
com\geostar\csw\domain\layer\MDScopeCode.java
com\geostar\csw\domain\layer\MDSecurityConstraintsType.java
com\geostar\csw\domain\layer\MDSpatialRepresentationPropertyType.java
com\geostar\csw\domain\layer\MDSpatialRepresentationTypeCode.java
com\geostar\csw\domain\layer\MDTopicCategoryCode.java
com\geostar\csw\domain\layer\MDTopoLogyLevelCode.java
com\geostar\csw\domain\layer\MDTpCatType.java
com\geostar\csw\domain\layer\MDVectorSpatialRepresentationType.java
com\geostar\csw\domain\layer\ObjectFactory.java
com\geostar\csw\domain\layer\SVOperationMetadataType.java
com\geostar\csw\domain\layer\SVServiceIdentificationType.java
com\geostar\csw\domain\layer\SpatialReferenceInfo.java
com\geostar\csw\domain\layer\TBOOL.java
com\geostar\csw\domain\layer\TDYTABLETYPE.java
com\geostar\csw\domain\layer\TDataInfo.java
com\geostar\csw\domain\layer\TJHSJ.java
com\geostar\csw\domain\layer\TJHTYPE.java
com\geostar\csw\domain\layer\TJHXX.java
com\geostar\csw\domain\layer\TLAYERTYPE.java
com\geostar\csw\domain\layer\TMInstantType.java
com\geostar\csw\domain\layer\TMPeriodType.java
com\geostar\csw\domain\layer\TMetaInfo.java
com\geostar\csw\domain\layer\TMetaTotal.java
com\geostar\csw\domain\layer\TTABLETYPE.java
com\geostar\csw\domain\layer\TTHMEATICTYPE.java
com\geostar\csw\domain\layer\TUPDATETYPE.java
com\geostar\csw\domain\layer\TUserInfo.java
com\geostar\csw\domain\layer\TVersionInfo.java
com\geostar\csw\domain\layer\TZDGL.java
com\geostar\csw\domain\layer\TZDJH.java
com\geostar\csw\domain\layer\UpdateDescribe.java
com\geostar\csw\domain\layer\package-info.java
忽然感覺好興奮!jaxb真的是好東東!
相關(guān)文章
C++多態(tài)的實現(xiàn)及原理詳細(xì)解析
C++的多態(tài)性用一句話概括就是:在基類的函數(shù)前加上virtual關(guān)鍵字,在派生類中重寫該函數(shù),運(yùn)行時將會根據(jù)對象的實際類型來調(diào)用相應(yīng)的函數(shù)。如果對象類型是派生類,就調(diào)用派生類的函數(shù);如果對象類型是基類,就調(diào)用基類的函數(shù)2013-09-09C++詳細(xì)分析講解函數(shù)參數(shù)的擴(kuò)展
在C++中,定義函數(shù)時可以給形參指定一個默認(rèn)的值,這樣調(diào)用函數(shù)時如果沒有給這個形參賦值(沒有對應(yīng)的實參),那么就使用這個默認(rèn)的值。也就是說,調(diào)用函數(shù)時可以省略有默認(rèn)值的參數(shù)2022-04-04一文帶你學(xué)習(xí)C/C++中的<Windows.h>庫
c語言 #include<windows.h>是寫window程序需要的重要頭文件,下面這篇文章主要給大家介紹了C/C++中<Windows.h>庫的相關(guān)資料,文中通過實例代碼介紹的非常詳細(xì),需要的朋友可以參考下2023-01-01