当前位置: 编程技术>c/c++/嵌入式
深入jaxb xjc编码问题的详细介绍
来源: 互联网 发布时间:2014-10-14
本文导语: 平时喜欢根据写一个xjc批处理命令,根据xsd批量生成java类,觉得很方便也很酷。但是有时候xsd生成的java类中含有汉字,结果总是有些问题。可是xjc命令参数又没有encoding参数之类的。在网上搜了一通,忽然发现了一个好东东...
平时喜欢根据写一个xjc批处理命令,根据xsd批量生成java类,觉得很方便也很酷。但是有时候xsd生成的java类中含有汉字,结果总是有些问题。
可是xjc命令参数又没有encoding参数之类的。在网上搜了一通,忽然发现了一个好东东:xjc是由com.sun.tools.internal.xjc.Driver实现的,因此
批处理命令可以如下:
java -Dfile.encoding=UTF-8 -cp D:javajdk1.6.0_03libtools.jar com.sun.tools.internal.xjc.Driver -p com.geostar.csw.domain.layer metadata_geo_Layer.xsd
结果:
parsing a schema...
compiling a schema...
comgeostarcswdomainlayerAbstractMDContentInformationType.java
comgeostarcswdomainlayerAbstractMDIdentificationType.java
comgeostarcswdomainlayerAbstractMDSpatialRepresentationType.java
comgeostarcswdomainlayerCIAddressType.java
comgeostarcswdomainlayerCICitationType.java
comgeostarcswdomainlayerCIContactType.java
comgeostarcswdomainlayerCIDateType.java
comgeostarcswdomainlayerCIDateTypeCode.java
comgeostarcswdomainlayerCIOnLineFunctionCode.java
comgeostarcswdomainlayerCIOnLineResourceType.java
comgeostarcswdomainlayerCIResponsiblePartyType.java
comgeostarcswdomainlayerCIRoleCode.java
comgeostarcswdomainlayerDQDataLineageType.java
comgeostarcswdomainlayerDQDataQualityType.java
comgeostarcswdomainlayerDQDqReportType.java
comgeostarcswdomainlayerDQDqStatementType.java
comgeostarcswdomainlayerDQSourceType.java
comgeostarcswdomainlayerDSAssociationTypeCode.java
comgeostarcswdomainlayerEXBoundingCoordinatesType.java
comgeostarcswdomainlayerEXExtentType.java
comgeostarcswdomainlayerEXGeographicBoundingBoxType.java
comgeostarcswdomainlayerEXGeographicBoundingPolygonType.java
comgeostarcswdomainlayerEXGeographicDescriptionType.java
comgeostarcswdomainlayerEXGeographicExtentPropertyType.java
comgeostarcswdomainlayerEXGeographicExtentType.java
comgeostarcswdomainlayerEXTemporalExtentPropertyType.java
comgeostarcswdomainlayerEXTemporalExtentType.java
comgeostarcswdomainlayerEXVerticalExtentType.java
comgeostarcswdomainlayerFBZY.java
comgeostarcswdomainlayerJHDA.java
comgeostarcswdomainlayerMDAerialImageIdentificationType.java
comgeostarcswdomainlayerMDAggregateInfomationPropertyType.java
comgeostarcswdomainlayerMDAggregateInfomationType.java
comgeostarcswdomainlayerMDAnalogMapIdentificationType.java
comgeostarcswdomainlayerMDApprovedTypeCode.java
comgeostarcswdomainlayerMDArchiveIdentificationType.java
comgeostarcswdomainlayerMDBrowseGraphicType.java
comgeostarcswdomainlayerMDCRSType.java
comgeostarcswdomainlayerMDCharacterSetCode.java
comgeostarcswdomainlayerMDClassificationCode.java
comgeostarcswdomainlayerMDConstraintsPropertyType.java
comgeostarcswdomainlayerMDContentInformationPropertyType.java
comgeostarcswdomainlayerMDCoverageContentTypeCode.java
comgeostarcswdomainlayerMDCoverageDescriptionType.java
comgeostarcswdomainlayerMDDataIdentificationType.java
comgeostarcswdomainlayerMDDescKeys.java
comgeostarcswdomainlayerMDDigitalArchiveIdentificationType.java
comgeostarcswdomainlayerMDDistributionType.java
comgeostarcswdomainlayerMDDistributorType.java
comgeostarcswdomainlayerMDEllipsoidParametersType.java
comgeostarcswdomainlayerMDFeatureCatalogueDescriptionType.java
comgeostarcswdomainlayerMDFormatType.java
comgeostarcswdomainlayerMDGeometricObjectTypeCode.java
comgeostarcswdomainlayerMDGovNameTypeBak.java
comgeostarcswdomainlayerMDGridSpatialRepresentationType.java
comgeostarcswdomainlayerMDIdentificationPropertyType.java
comgeostarcswdomainlayerMDIdentifierType.java
comgeostarcswdomainlayerMDImageDescriptionType.java
comgeostarcswdomainlayerMDImageIdentificationType.java
comgeostarcswdomainlayerMDImagingConditionCode.java
comgeostarcswdomainlayerMDLegConstsType.java
comgeostarcswdomainlayerMDMaintInformationType.java
comgeostarcswdomainlayerMDMaintenanceFrequencyCode.java
comgeostarcswdomainlayerMDMapFormCode.java
comgeostarcswdomainlayerMDMetadataType.java
comgeostarcswdomainlayerMDProgressCode.java
comgeostarcswdomainlayerMDProjectionParametersType.java
comgeostarcswdomainlayerMDReferenceSystemType.java
comgeostarcswdomainlayerMDReferencedThemeType.java
comgeostarcswdomainlayerMDResolutionType.java
comgeostarcswdomainlayerMDResourceTypeCode.java
comgeostarcswdomainlayerMDRestrictionCode.java
comgeostarcswdomainlayerMDRestrictionCodeEx.java
comgeostarcswdomainlayerMDScopeCode.java
comgeostarcswdomainlayerMDSecurityConstraintsType.java
comgeostarcswdomainlayerMDSpatialRepresentationPropertyType.java
comgeostarcswdomainlayerMDSpatialRepresentationTypeCode.java
comgeostarcswdomainlayerMDTopicCategoryCode.java
comgeostarcswdomainlayerMDTopoLogyLevelCode.java
comgeostarcswdomainlayerMDTpCatType.java
comgeostarcswdomainlayerMDVectorSpatialRepresentationType.java
comgeostarcswdomainlayerObjectFactory.java
comgeostarcswdomainlayerSVOperationMetadataType.java
comgeostarcswdomainlayerSVServiceIdentificationType.java
comgeostarcswdomainlayerSpatialReferenceInfo.java
comgeostarcswdomainlayerTBOOL.java
comgeostarcswdomainlayerTDYTABLETYPE.java
comgeostarcswdomainlayerTDataInfo.java
comgeostarcswdomainlayerTJHSJ.java
comgeostarcswdomainlayerTJHTYPE.java
comgeostarcswdomainlayerTJHXX.java
comgeostarcswdomainlayerTLAYERTYPE.java
comgeostarcswdomainlayerTMInstantType.java
comgeostarcswdomainlayerTMPeriodType.java
comgeostarcswdomainlayerTMetaInfo.java
comgeostarcswdomainlayerTMetaTotal.java
comgeostarcswdomainlayerTTABLETYPE.java
comgeostarcswdomainlayerTTHMEATICTYPE.java
comgeostarcswdomainlayerTUPDATETYPE.java
comgeostarcswdomainlayerTUserInfo.java
comgeostarcswdomainlayerTVersionInfo.java
comgeostarcswdomainlayerTZDGL.java
comgeostarcswdomainlayerTZDJH.java
comgeostarcswdomainlayerUpdateDescribe.java
comgeostarcswdomainlayerpackage-info.java
c:Catalog实体类生成工具>
忽然感觉好兴奋!jaxb真的是好东东!
可是xjc命令参数又没有encoding参数之类的。在网上搜了一通,忽然发现了一个好东东:xjc是由com.sun.tools.internal.xjc.Driver实现的,因此
批处理命令可以如下:
java -Dfile.encoding=UTF-8 -cp D:javajdk1.6.0_03libtools.jar com.sun.tools.internal.xjc.Driver -p com.geostar.csw.domain.layer metadata_geo_Layer.xsd
结果:
代码如下:
parsing a schema...
compiling a schema...
comgeostarcswdomainlayerAbstractMDContentInformationType.java
comgeostarcswdomainlayerAbstractMDIdentificationType.java
comgeostarcswdomainlayerAbstractMDSpatialRepresentationType.java
comgeostarcswdomainlayerCIAddressType.java
comgeostarcswdomainlayerCICitationType.java
comgeostarcswdomainlayerCIContactType.java
comgeostarcswdomainlayerCIDateType.java
comgeostarcswdomainlayerCIDateTypeCode.java
comgeostarcswdomainlayerCIOnLineFunctionCode.java
comgeostarcswdomainlayerCIOnLineResourceType.java
comgeostarcswdomainlayerCIResponsiblePartyType.java
comgeostarcswdomainlayerCIRoleCode.java
comgeostarcswdomainlayerDQDataLineageType.java
comgeostarcswdomainlayerDQDataQualityType.java
comgeostarcswdomainlayerDQDqReportType.java
comgeostarcswdomainlayerDQDqStatementType.java
comgeostarcswdomainlayerDQSourceType.java
comgeostarcswdomainlayerDSAssociationTypeCode.java
comgeostarcswdomainlayerEXBoundingCoordinatesType.java
comgeostarcswdomainlayerEXExtentType.java
comgeostarcswdomainlayerEXGeographicBoundingBoxType.java
comgeostarcswdomainlayerEXGeographicBoundingPolygonType.java
comgeostarcswdomainlayerEXGeographicDescriptionType.java
comgeostarcswdomainlayerEXGeographicExtentPropertyType.java
comgeostarcswdomainlayerEXGeographicExtentType.java
comgeostarcswdomainlayerEXTemporalExtentPropertyType.java
comgeostarcswdomainlayerEXTemporalExtentType.java
comgeostarcswdomainlayerEXVerticalExtentType.java
comgeostarcswdomainlayerFBZY.java
comgeostarcswdomainlayerJHDA.java
comgeostarcswdomainlayerMDAerialImageIdentificationType.java
comgeostarcswdomainlayerMDAggregateInfomationPropertyType.java
comgeostarcswdomainlayerMDAggregateInfomationType.java
comgeostarcswdomainlayerMDAnalogMapIdentificationType.java
comgeostarcswdomainlayerMDApprovedTypeCode.java
comgeostarcswdomainlayerMDArchiveIdentificationType.java
comgeostarcswdomainlayerMDBrowseGraphicType.java
comgeostarcswdomainlayerMDCRSType.java
comgeostarcswdomainlayerMDCharacterSetCode.java
comgeostarcswdomainlayerMDClassificationCode.java
comgeostarcswdomainlayerMDConstraintsPropertyType.java
comgeostarcswdomainlayerMDContentInformationPropertyType.java
comgeostarcswdomainlayerMDCoverageContentTypeCode.java
comgeostarcswdomainlayerMDCoverageDescriptionType.java
comgeostarcswdomainlayerMDDataIdentificationType.java
comgeostarcswdomainlayerMDDescKeys.java
comgeostarcswdomainlayerMDDigitalArchiveIdentificationType.java
comgeostarcswdomainlayerMDDistributionType.java
comgeostarcswdomainlayerMDDistributorType.java
comgeostarcswdomainlayerMDEllipsoidParametersType.java
comgeostarcswdomainlayerMDFeatureCatalogueDescriptionType.java
comgeostarcswdomainlayerMDFormatType.java
comgeostarcswdomainlayerMDGeometricObjectTypeCode.java
comgeostarcswdomainlayerMDGovNameTypeBak.java
comgeostarcswdomainlayerMDGridSpatialRepresentationType.java
comgeostarcswdomainlayerMDIdentificationPropertyType.java
comgeostarcswdomainlayerMDIdentifierType.java
comgeostarcswdomainlayerMDImageDescriptionType.java
comgeostarcswdomainlayerMDImageIdentificationType.java
comgeostarcswdomainlayerMDImagingConditionCode.java
comgeostarcswdomainlayerMDLegConstsType.java
comgeostarcswdomainlayerMDMaintInformationType.java
comgeostarcswdomainlayerMDMaintenanceFrequencyCode.java
comgeostarcswdomainlayerMDMapFormCode.java
comgeostarcswdomainlayerMDMetadataType.java
comgeostarcswdomainlayerMDProgressCode.java
comgeostarcswdomainlayerMDProjectionParametersType.java
comgeostarcswdomainlayerMDReferenceSystemType.java
comgeostarcswdomainlayerMDReferencedThemeType.java
comgeostarcswdomainlayerMDResolutionType.java
comgeostarcswdomainlayerMDResourceTypeCode.java
comgeostarcswdomainlayerMDRestrictionCode.java
comgeostarcswdomainlayerMDRestrictionCodeEx.java
comgeostarcswdomainlayerMDScopeCode.java
comgeostarcswdomainlayerMDSecurityConstraintsType.java
comgeostarcswdomainlayerMDSpatialRepresentationPropertyType.java
comgeostarcswdomainlayerMDSpatialRepresentationTypeCode.java
comgeostarcswdomainlayerMDTopicCategoryCode.java
comgeostarcswdomainlayerMDTopoLogyLevelCode.java
comgeostarcswdomainlayerMDTpCatType.java
comgeostarcswdomainlayerMDVectorSpatialRepresentationType.java
comgeostarcswdomainlayerObjectFactory.java
comgeostarcswdomainlayerSVOperationMetadataType.java
comgeostarcswdomainlayerSVServiceIdentificationType.java
comgeostarcswdomainlayerSpatialReferenceInfo.java
comgeostarcswdomainlayerTBOOL.java
comgeostarcswdomainlayerTDYTABLETYPE.java
comgeostarcswdomainlayerTDataInfo.java
comgeostarcswdomainlayerTJHSJ.java
comgeostarcswdomainlayerTJHTYPE.java
comgeostarcswdomainlayerTJHXX.java
comgeostarcswdomainlayerTLAYERTYPE.java
comgeostarcswdomainlayerTMInstantType.java
comgeostarcswdomainlayerTMPeriodType.java
comgeostarcswdomainlayerTMetaInfo.java
comgeostarcswdomainlayerTMetaTotal.java
comgeostarcswdomainlayerTTABLETYPE.java
comgeostarcswdomainlayerTTHMEATICTYPE.java
comgeostarcswdomainlayerTUPDATETYPE.java
comgeostarcswdomainlayerTUserInfo.java
comgeostarcswdomainlayerTVersionInfo.java
comgeostarcswdomainlayerTZDGL.java
comgeostarcswdomainlayerTZDJH.java
comgeostarcswdomainlayerUpdateDescribe.java
comgeostarcswdomainlayerpackage-info.java
忽然感觉好兴奋!jaxb真的是好东东!