|
Rank: Member
Joined: 1/15/2016 Posts: 16 Location: Newport News, VA USA
|
Hi, this is my first time mapping to xml. My schema has a required attribute "Specifier" that must be present in the xml and can be |A|E|. <xs:element name="LicenseRecords"> <xs:complexType> <xs:sequence> <xs:element ref="LicenseRecord" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="LicenseRecord"> <xs:complexType> <xs:attribute name="LicenseType" use="required"> <xs:simpleType> <xs:restriction base="riLicenseType"> <xs:maxLength value="3"/> <xs:minLength value="2"/> </xs:restriction> </xs:simpleType> </xs:attribute> <xs:attribute name="LicenseState" use="required"> <xs:simpleType> <xs:restriction base="riStateCodes"> <xs:length value="2"/> </xs:restriction> </xs:simpleType> </xs:attribute> <xs:attribute name="LicenseStartDate" use="required"> <xs:simpleType> <xs:restriction base="riDate"/> </xs:simpleType> </xs:attribute> <xs:attribute name="LicenseNumber" use="required"> <xs:simpleType> <xs:restriction base="riAlphaNumeric"> <xs:minLength value="1"/> <xs:maxLength value="12"/> </xs:restriction> </xs:simpleType> </xs:attribute> <xs:attribute name="LicenseEndDate" use="required"> <xs:simpleType> <xs:restriction base="riDate"/> </xs:simpleType> </xs:attribute> <xs:attribute name="LicenseStatus" use="required"> <xs:simpleType> <xs:restriction base="riTypeStatus"> <xs:length value="1"/> </xs:restriction> </xs:simpleType> </xs:attribute> <xs:attribute name="Specifier" use="required"> <xs:simpleType> <xs:restriction base="riSpecifier"> <xs:minLength value="0"/> <xs:maxLength value="1"/> </xs:restriction> </xs:simpleType> </xs:attribute> </xs:complexType>
<xs:simpleType name="riSpecifier"> <xs:restriction base="xs:string"> <xs:pattern value="A|E|"/> </xs:restriction>
The sample csv has a blank value for the Specifier. My Mapforce output looks like this:
<LicenseRecords> <LicenseRecord LicenseType="PA" LicenseState="RI" LicenseStartDate="2013-03-25" LicenseNumber="PA3456" LicenseEndDate="2382-12-31" LicenseStatus="A"/> </LicenseRecords>
Any suggestion how to insure that the attribute Specifier="" will appear in the above Mapforce output?
Thanks
|
|
Rank: Advanced Member
Joined: 6/16/2006 Posts: 486 Location: AT
|
Assuming you have a column in your CSV connected to that attribute:
Option A: Turn off "[x] Treat empty fields as absent" in the CSV component.
Option B: Add a substitute-missing component and with an empty string constant before the required attribute.
|
|
Rank: Member
Joined: 1/15/2016 Posts: 16 Location: Newport News, VA USA
|
Thank You That!
|
|
guest |