<?xml version="1.0" encoding="ISO-8859-1"?>
<schema
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:s="http://niem.gov/niem/structures/2.0"
xmlns:nc="http://niem.gov/niem/niem-core/2.0"
targetNamespace="http://www.test.com"
>
<import namespace="http://niem.gov/niem/structures/2.0" schemaLocation="./niem/structures/2.0/structures.xsd"/>
<import namespace="http://niem.gov/niem/niem-core/2.0" schemaLocation="./niem/niem-core/2.0/niem-core.xsd"/>
<complexType name="TestType">
<complexContent>
<extension base="s:ComplexObjectType">
</extension>
</complexContent>
</complexType>
</schema>
[java] Exception in thread "main" javax.xml.bind.JAXBException: Provider com.sun.xml.bind.v2.ContextFactory could not be instantiated: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions [java] No element mapping exists for "http://niem.gov/niem/structures/2.0":"Augmentation" [java] this problem is related to the following location: [java] at @javax.xml.bind.annotation.XmlElementDecl(scope=class javax.xml.bind.annotation.XmlElementDecl$GLOBAL, substitutionHeadName=Augmentation, defaultValue=^@, substitutionHeadNamespace=http://niem.gov/niem/structures/2.0, namespace=http://niem.gov/niem/ansi-nist/2.0, name=ProtectionOrderAugmentation) [java] at public javax.xml.bind.JAXBElement gov.niem.niem.ansi_nist._2.ObjectFactory.createProtectionOrderAugmentation(gov.niem.niem.ansi_nist._2.ProtectionOrderAugmentationType) [java] at gov.niem.niem.ansi_nist._2.ObjectFactory [java] at protected java.util.List gov.niem.niem.ansi_nist._2.FingerprintPalmImagePositionType.palmPosition [java] at gov.niem.niem.ansi_nist._2.FingerprintPalmImagePositionType [java] at @javax.xml.bind.annotation.XmlSeeAlso(value=[class gov.niem.niem.ansi_nist._2.MajorCasePrintSegmentOffsetType, class gov.niem.niem.ansi_nist._2.FingerprintImageNISTQualityType, class gov.niem.niem.ansi_nist._2.FingerprintImageQualityType, class gov.niem.niem.ansi_nist._2.FingerprintImageMajorCasePrintType, class gov.niem.niem.ansi_nist._2.FingerprintPalmImagePositionType]) [java] at protected java.util.List gov.niem.niem.niem_core._2.FingerprintSetType.fingerprint [java] at gov.niem.niem.niem_core._2.FingerprintSetType [java] at protected java.util.List gov.niem.niem.niem_core._2.PersonType.personFingerprintSet [java] at gov.niem.niem.niem_core._2.PersonType [java] at protected java.util.List gov.niem.niem.niem_core._2.ContactInformationType.contactResponder [java] at gov.niem.niem.niem_core._2.ContactInformationType [java] at protected java.util.List gov.niem.niem.niem_core._2.LocationType.locationContactInformation [java] at gov.niem.niem.niem_core._2.LocationType [java] at protected java.util.List gov.niem.niem.niem_core._2.ImageType.imageLocation [java] at gov.niem.niem.niem_core._2.ImageType [java] at public javax.xml.bind.JAXBElement gov.niem.niem.niem_core._2.ObjectFactory.createImage(gov.niem.niem.niem_core._2.ImageType) [java] at gov.niem.niem.niem_core._2.ObjectFactory [java] at protected java.util.List gov.niem.niem.niem_core._2.ToothType.toothPosition [java] at gov.niem.niem.niem_core._2.ToothType [java] at @javax.xml.bind.annotation.XmlSeeAlso(value=[class com.test.TestType, class gov.niem.niem.niem_core._2.ToothType, class gov.niem.niem.niem_core._2.DateType, class gov.niem.niem.niem_core._2.LocationType, class gov.niem.niem.niem_core._2.EntityType, class gov.niem.niem.niem_core._2.BiometricType, class gov.niem.niem.niem_core._2.IdentificationType, class gov.niem.niem.niem_core._2.LocaleType, class gov.niem.niem.niem_core._2.OrganizationType, class gov.niem.niem.niem_core._2.ObligationType, class gov.niem.niem.niem_core._2.DNALocusType, class gov.niem.niem.niem_core._2.PropertyType, class gov.niem.niem.niem_core._2.RelativeLocationType, class gov.niem.niem.niem_core._2.PersonNameType, class gov.niem.niem.niem_core._2.ObligationExemptionType, class gov.niem.niem.niem_core._2.MeasureRangeValueType, class gov.niem.niem.niem_core._2.FacilityType, class gov.niem.niem.niem_core._2.ItemValueType, class gov.niem.niem.niem_core._2.TelephoneNumberType, class gov.niem.niem.niem_core._2.AddressType, class gov.niem.niem.niem_core._2.MapLocationType, class gov.niem.niem.niem_core._2.TwoDimensionalGeographicCoordinateType, class gov.niem.niem.niem_core._2.PersonLanguageType, class gov.niem.niem.niem_core._2.ContactInformationType, class gov.niem.niem.niem_core._2.PersonType, class gov.niem.niem.niem_core._2.PassportType, class gov.niem.niem.niem_core._2.LatitudeCoordinateType, class gov.niem.niem.niem_core._2.MedicalConditionType, class gov.niem.niem.niem_core._2.DocumentType, class gov.niem.niem.niem_core._2.SupervisionType, class gov.niem.niem.niem_core._2.InjuryType, class gov.niem.niem.niem_core._2.HighwayType, class gov.niem.niem.niem_core._2.InternationalTelephoneNumberType, class gov.niem.niem.niem_core._2.ItemTitleType, class gov.niem.niem.niem_core._2.DNAType, class gov.niem.niem.niem_core._2.JurisdictionType, class gov.niem.niem.niem_core._2.LesseeType, class gov.niem.niem.niem_core._2.ScheduleDayType, class gov.niem.niem.niem_core._2.ClothingType, class gov.niem.niem.niem_core._2.CapabilityType, class gov.niem.niem.niem_core._2.WeaponType, class gov.niem.niem.niem_core._2.IntoxicationType, class gov.niem.niem.niem_core._2.AddressGridType, class gov.niem.niem.niem_core._2.EncounterClassificationType, class gov.niem.niem.niem_core._2.LienType, class gov.niem.niem.niem_core._2.DateRangeType, class gov.niem.niem.niem_core._2.UTMCoordinateType, class gov.niem.niem.niem_core._2.LongitudeCoordinateType, class gov.niem.niem.niem_core._2.VehicleBranderType, class gov.niem.niem.niem_core._2.AreaType, class gov.niem.niem.niem_core._2.DrivingRestrictionType, class gov.niem.niem.niem_core._2.DecalType, class gov.niem.niem.niem_core._2.LessorType, class gov.niem.niem.niem_core._2.CaseDispositionDecisionType, class gov.niem.niem.niem_core._2.EmailType, class gov.niem.niem.niem_core._2.StreetType, class gov.niem.niem.niem_core._2.FingerprintSetType, class gov.niem.niem.niem_core._2.ItemRegistrationType, class gov.niem.niem.niem_core._2.PhysicalFeatureType, class gov.niem.niem.niem_core._2.CircularRegionType, class gov.niem.niem.niem_core._2.NANPTelephoneNumberType, class gov.niem.niem.niem_core._2.InsuranceType, class gov.niem.niem.niem_core._2.StatusType, class gov.niem.niem.niem_core._2.FullTelephoneNumberType, class gov.niem.niem.niem_core._2.ContactRadioType, class gov.niem.niem.niem_core._2.DispositionType, class gov.niem.niem.niem_core._2.MeasureType, class gov.niem.niem.niem_core._2.StructuredAddressType, class gov.niem.niem.niem_core._2.KitType, class gov.niem.niem.niem_core._2.MilitarySummaryType, class gov.niem.niem.niem_core._2.LienHolderType, class gov.niem.niem.niem_core._2.AngularMeasureType, class gov.niem.niem.niem_core._2.VehicleBrandType, class gov.niem.niem.niem_core._2.InstantMessengerType, class gov.niem.niem.niem_core._2.DriverLicenseBaseType, class gov.niem.niem.niem_core._2.CrossStreetType, class gov.niem.niem.niem_core._2.ActivityType, class gov.niem.niem.niem_core._2.ItemType, class gov.niem.niem.niem_core._2.AssociationType, class gov.niem.niem.niem_core._2.IdentityType, class gov.niem.niem.ansi_nist._2.ImageQualityType, class gov.niem.niem.ansi_nist._2.TransactionType, class gov.niem.niem.ansi_nist._2.SignatureImageVectorType, class gov.niem.niem.ansi_nist._2.PhysicalFeatureSizeType, class gov.niem.niem.ansi_nist._2.FaceImageAttributeType, class gov.niem.niem.ansi_nist._2.PhysicalFeatureColorDetailType, class gov.niem.niem.ansi_nist._2.MinutiaType, class gov.niem.niem.ansi_nist._2.MinutiaeType, class gov.niem.niem.ansi_nist._2.OrganizationDocumentCountType, class gov.niem.niem.ansi_nist._2.TransactionCharacterSetDirectoryType, class gov.niem.niem.ansi_nist._2.SignatureImageVectorRepresentationType, class gov.niem.niem.ansi_nist._2.TransactionImageResolutionType, class gov.niem.niem.ansi_nist._2.FingerprintPatternType, class gov.niem.niem.ansi_nist._2.NISTStandardMinutiaeType, class gov.niem.niem.ansi_nist._2.FaceImageFeaturePointType, class gov.niem.niem.ansi_nist._2.PhysicalFeatureDescriptionType, class gov.niem.niem.ansi_nist._2.MinutiaeReadingSystemType, class gov.niem.niem.ansi_nist._2.MinutiaeFingerPositionType, class gov.niem.niem.ansi_nist._2.ImageCaptureType, class gov.niem.niem.ansi_nist._2.MinutiaeFingerPatternType, class gov.niem.niem.niem_core._2.BinaryType, class gov.niem.niem.ansi_nist._2.ContentRecordType, class gov.niem.niem.ansi_nist._2.MinutiaPositionType, class gov.niem.niem.ansi_nist._2.TransactionContentSummaryType, class gov.niem.niem.ansi_nist._2.TransactionDomainType, class gov.niem.niem.ansi_nist._2.RecordType, class gov.niem.niem.ansi_nist._2.PoseAngleType, class gov.niem.niem.ansi_nist._2.IdentificationRangeType, class gov.niem.niem.ansi_nist._2.FingerprintType]) [java] at com.test.TestType [java] at public com.test.TestType com.test.ObjectFactory.createTestType() [java] at com.test.ObjectFactory [java] No element mapping exists for "http://niem.gov/niem/structures/2.0":"Augmentation" [java] this problem is related to the following location: [java] at @javax.xml.bind.annotation.XmlElementDecl(scope=class javax.xml.bind.annotation.XmlElementDecl$GLOBAL, substitutionHeadName=Augmentation, defaultValue=^@, substitutionHeadNamespace=http://niem.gov/niem/structures/2.0, namespace=http://niem.gov/niem/ansi-nist/2.0, name=ActivityAugmentation) [java] at public javax.xml.bind.JAXBElement gov.niem.niem.ansi_nist._2.ObjectFactory.createActivityAugmentation(gov.niem.niem.ansi_nist._2.ActivityAugmentationType) [java] at gov.niem.niem.ansi_nist._2.ObjectFactory [java] at protected java.util.List gov.niem.niem.ansi_nist._2.FingerprintPalmImagePositionType.palmPosition [java] at gov.niem.niem.ansi_nist._2.FingerprintPalmImagePositionType [java] at @javax.xml.bind.annotation.XmlSeeAlso(value=[class gov.niem.niem.ansi_nist._2.MajorCasePrintSegmentOffsetType, class gov.niem.niem.ansi_nist._2.FingerprintImageNISTQualityType, class gov.niem.niem.ansi_nist._2.FingerprintImageQualityType, class gov.niem.niem.ansi_nist._2.FingerprintImageMajorCasePrintType, class gov.niem.niem.ansi_nist._2.FingerprintPalmImagePositionType]) [java] at protected java.util.List gov.niem.niem.niem_core._2.FingerprintSetType.fingerprint [java] at gov.niem.niem.niem_core._2.FingerprintSetType [java] at protected java.util.List gov.niem.niem.niem_core._2.PersonType.personFingerprintSet [java] at gov.niem.niem.niem_core._2.PersonType [java] at protected java.util.List gov.niem.niem.niem_core._2.ContactInformationType.contactResponder [java] at gov.niem.niem.niem_core._2.ContactInformationType [java] at protected java.util.List gov.niem.niem.niem_core._2.LocationType.locationContactInformation [java] at gov.niem.niem.niem_core._2.LocationType [java] at protected java.util.List gov.niem.niem.niem_core._2.ImageType.imageLocation [java] at gov.niem.niem.niem_core._2.ImageType [java] at public javax.xml.bind.JAXBElement gov.niem.niem.niem_core._2.ObjectFactory.createImage(gov.niem.niem.niem_core._2.ImageType) [java] at gov.niem.niem.niem_core._2.ObjectFactory [java] at protected java.util.List gov.niem.niem.niem_core._2.ToothType.toothPosition [java] at gov.niem.niem.niem_core._2.ToothType [java] at @javax.xml.bind.annotation.XmlSeeAlso(value=[class com.test.TestType, class gov.niem.niem.niem_core._2.ToothType, class gov.niem.niem.niem_core._2.DateType, class gov.niem.niem.niem_core._2.LocationType, class gov.niem.niem.niem_core._2.EntityType, class gov.niem.niem.niem_core._2.BiometricType, class gov.niem.niem.niem_core._2.IdentificationType, class gov.niem.niem.niem_core._2.LocaleType, class gov.niem.niem.niem_core._2.OrganizationType, class gov.niem.niem.niem_core._2.ObligationType, class gov.niem.niem.niem_core._2.DNALocusType, class gov.niem.niem.niem_core._2.PropertyType, class gov.niem.niem.niem_core._2.RelativeLocationType, class gov.niem.niem.niem_core._2.PersonNameType, class gov.niem.niem.niem_core._2.ObligationExemptionType, class gov.niem.niem.niem_core._2.MeasureRangeValueType, class gov.niem.niem.niem_core._2.FacilityType, class gov.niem.niem.niem_core._2.ItemValueType, class gov.niem.niem.niem_core._2.TelephoneNumberType, class gov.niem.niem.niem_core._2.AddressType, class gov.niem.niem.niem_core._2.MapLocationType, class gov.niem.niem.niem_core._2.TwoDimensionalGeographicCoordinateType, class gov.niem.niem.niem_core._2.PersonLanguageType, class gov.niem.niem.niem_core._2.ContactInformationType, class gov.niem.niem.niem_core._2.PersonType, class gov.niem.niem.niem_core._2.PassportType, class gov.niem.niem.niem_core._2.LatitudeCoordinateType, class gov.niem.niem.niem_core._2.MedicalConditionType, class gov.niem.niem.niem_core._2.DocumentType, class gov.niem.niem.niem_core._2.SupervisionType, class gov.niem.niem.niem_core._2.InjuryType, class gov.niem.niem.niem_core._2.HighwayType, class gov.niem.niem.niem_core._2.InternationalTelephoneNumberType, class gov.niem.niem.niem_core._2.ItemTitleType, class gov.niem.niem.niem_core._2.DNAType, class gov.niem.niem.niem_core._2.JurisdictionType, class gov.niem.niem.niem_core._2.LesseeType, class gov.niem.niem.niem_core._2.ScheduleDayType, class gov.niem.niem.niem_core._2.ClothingType, class gov.niem.niem.niem_core._2.CapabilityType, class gov.niem.niem.niem_core._2.WeaponType, class gov.niem.niem.niem_core._2.IntoxicationType, class gov.niem.niem.niem_core._2.AddressGridType, class gov.niem.niem.niem_core._2.EncounterClassificationType, class gov.niem.niem.niem_core._2.LienType, class gov.niem.niem.niem_core._2.DateRangeType, class gov.niem.niem.niem_core._2.UTMCoordinateType, class gov.niem.niem.niem_core._2.LongitudeCoordinateType, class gov.niem.niem.niem_core._2.VehicleBranderType, class gov.niem.niem.niem_core._2.AreaType, class gov.niem.niem.niem_core._2.DrivingRestrictionType, class gov.niem.niem.niem_core._2.DecalType, class gov.niem.niem.niem_core._2.LessorType, class gov.niem.niem.niem_core._2.CaseDispositionDecisionType, class gov.niem.niem.niem_core._2.EmailType, class gov.niem.niem.niem_core._2.StreetType, class gov.niem.niem.niem_core._2.FingerprintSetType, class gov.niem.niem.niem_core._2.ItemRegistrationType, class gov.niem.niem.niem_core._2.PhysicalFeatureType, class gov.niem.niem.niem_core._2.CircularRegionType, class gov.niem.niem.niem_core._2.NANPTelephoneNumberType, class gov.niem.niem.niem_core._2.InsuranceType, class gov.niem.niem.niem_core._2.StatusType, class gov.niem.niem.niem_core._2.FullTelephoneNumberType, class gov.niem.niem.niem_core._2.ContactRadioType, class gov.niem.niem.niem_core._2.DispositionType, class gov.niem.niem.niem_core._2.MeasureType, class gov.niem.niem.niem_core._2.StructuredAddressType, class gov.niem.niem.niem_core._2.KitType, class gov.niem.niem.niem_core._2.MilitarySummaryType, class gov.niem.niem.niem_core._2.LienHolderType, class gov.niem.niem.niem_core._2.AngularMeasureType, class gov.niem.niem.niem_core._2.VehicleBrandType, class gov.niem.niem.niem_core._2.InstantMessengerType, class gov.niem.niem.niem_core._2.DriverLicenseBaseType, class gov.niem.niem.niem_core._2.CrossStreetType, class gov.niem.niem.niem_core._2.ActivityType, class gov.niem.niem.niem_core._2.ItemType, class gov.niem.niem.niem_core._2.AssociationType, class gov.niem.niem.niem_core._2.IdentityType, class gov.niem.niem.ansi_nist._2.ImageQualityType, class gov.niem.niem.ansi_nist._2.TransactionType, class gov.niem.niem.ansi_nist._2.SignatureImageVectorType, class gov.niem.niem.ansi_nist._2.PhysicalFeatureSizeType, class gov.niem.niem.ansi_nist._2.FaceImageAttributeType, class gov.niem.niem.ansi_nist._2.PhysicalFeatureColorDetailType, class gov.niem.niem.ansi_nist._2.MinutiaType, class gov.niem.niem.ansi_nist._2.MinutiaeType, class gov.niem.niem.ansi_nist._2.OrganizationDocumentCountType, class gov.niem.niem.ansi_nist._2.TransactionCharacterSetDirectoryType, class gov.niem.niem.ansi_nist._2.SignatureImageVectorRepresentationType, class gov.niem.niem.ansi_nist._2.TransactionImageResolutionType, class gov.niem.niem.ansi_nist._2.FingerprintPatternType, class gov.niem.niem.ansi_nist._2.NISTStandardMinutiaeType, class gov.niem.niem.ansi_nist._2.FaceImageFeaturePointType, class gov.niem.niem.ansi_nist._2.PhysicalFeatureDescriptionType, class gov.niem.niem.ansi_nist._2.MinutiaeReadingSystemType, class gov.niem.niem.ansi_nist._2.MinutiaeFingerPositionType, class gov.niem.niem.ansi_nist._2.ImageCaptureType, class gov.niem.niem.ansi_nist._2.MinutiaeFingerPatternType, class gov.niem.niem.niem_core._2.BinaryType, class gov.niem.niem.ansi_nist._2.ContentRecordType, class gov.niem.niem.ansi_nist._2.MinutiaPositionType, class gov.niem.niem.ansi_nist._2.TransactionContentSummaryType, class gov.niem.niem.ansi_nist._2.TransactionDomainType, class gov.niem.niem.ansi_nist._2.RecordType, class gov.niem.niem.ansi_nist._2.PoseAngleType, class gov.niem.niem.ansi_nist._2.IdentificationRangeType, class gov.niem.niem.ansi_nist._2.FingerprintType]) [java] at com.test.TestType [java] at public com.test.TestType com.test.ObjectFactory.createTestType() [java] at com.test.ObjectFactory
I've for days now, trying to figure out what the cause is. Augmentation
and AugmentationType
are declared in ./niem/niem-core/2.0/niem-core.xsd
The niem xsd files are found here:
- https://www.niem.gov/create-iepd/pages/production-releases.aspx
- http://release.niem.gov/niem/2.1/niem-2.1.zip
My Test.java
file fails on this:
JAXBContext jc = JAXBContext.newInstance("com.test");
我尝试使用内置jaxb实现的JDK6,并用java.net上最新的jaxb实现覆盖它(并将api jar放在jre / lib / endorsed中)。
我找到了this old forum message from 2007,并出现了类似的错误。
您必须执行一个browser-view-source来查看该线程中的xml位。
我对此进行了各种尝试,将其调整为现在的niem模式,但我对此毫无意义。
这是jaxb xjc编译器中的错误还是niem模式文件中的错误?显然,它可以使用XMLSpy进行编译,但是我想尽可能地坚持使用xjc / jaxb ...
我正在像这样编译xml文件:
xjc -d src/java -b bindings.xml src/jaxb/test.xsd
bindings.xml
:<jaxb:bindings
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
jaxb:version="2.0"
>
<jaxb:globalBindings underscoreBinding="asCharInWord">
</jaxb:globalBindings>
</jaxb:bindings>
最佳答案
我在解组ECF-4.0消息(基于NIEM)时遇到了一个非常类似的问题。我通过从ObjectFactory类而不是包名称显式构造我的JAXBContext来解决此问题:
ecf4Context = JAXBContext.newInstance(gov.niem.niem.structures._2.ObjectFactory.class,
oasis.names.tc.legalxml_courtfiling.schema.xsd.corefilingmessage_4.ObjectFactory.class);
做出更改后,我很快就能将复杂的消息提取到Java中。
关于java - jaxb不编译niem模式,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8913889/