|
| 1 | +--- |
| 2 | +layout: default-layout |
| 3 | +title: DSParsedResultItem Class - Dynamsoft Code Parser SDK iOS Edition API Reference |
| 4 | +description: This page shows DSParsedResultItem Class of Dynamsoft Code Parser SDK iOS Edition. |
| 5 | +keywords: DSParsedResultItem, api reference, iOS |
| 6 | +needAutoGenerateSidebar: true |
| 7 | +--- |
| 8 | + |
| 9 | + |
| 10 | +# DSParsedResultItem Class |
| 11 | + |
| 12 | +`ParsedResultItem` it the basic unit of a parsed result. It stores the field name, value and additional information. |
| 13 | + |
| 14 | +## Definition |
| 15 | + |
| 16 | +*Assembly:* DynamsoftCodeParser.xcframework |
| 17 | + |
| 18 | +<div class="sample-code-prefix"></div> |
| 19 | +>- Objective-C |
| 20 | +>- Swift |
| 21 | +> |
| 22 | +>1. |
| 23 | +```objc |
| 24 | +@interface DSParsedResultItem: DSCapturedResultItem |
| 25 | +``` |
| 26 | +2. |
| 27 | +```swift |
| 28 | +class ParsedResultItem : CapturedResultItem |
| 29 | +``` |
| 30 | + |
| 31 | +## Method Summary |
| 32 | + |
| 33 | +| Method | Description | |
| 34 | +| ------ | ----------- | |
| 35 | +| [`getFieldMappingStatus`](#getfieldmappingstatus) | Gets the mapping status of a specified field from the parsed result. | |
| 36 | +| [`getFieldValidationStatus`](#getfieldvalidationstatus) | Gets the validation status of a specified field from the parsed result. | |
| 37 | +| [`getFieldValue`](#getfieldvalue) | Gets the value of a specified field from the parsed result. | |
| 38 | + |
| 39 | +## Property Summary |
| 40 | + |
| 41 | +| Property | Type | Description | |
| 42 | +| -------- | ---- | ----------- | |
| 43 | +| [`codeType`](#codetype) | *NSString* | Gets the code type of the parsed result. | |
| 44 | +| [`jsonString`](#jsonstring) | *NSString* | Gets the parsed result as a JSON formatted string. | |
| 45 | +| [`parsedFields`](#parsedfields) | *NSDictionary* | A `NSDictionary` object stores the field names and values of the parsed fields. | |
| 46 | + |
| 47 | +## Method Detail |
| 48 | + |
| 49 | +### getFieldMappingStatus |
| 50 | + |
| 51 | +Gets the mapping status of a specified field from the parsed result. Certain fields in the parsed result, such as the residing province or state, are abbreviated (e.g. BC standing for British Columbia). The library takes such fields and maps them to their full form. If the mapping is successful, the `MappingStatus` will be `DSMappingStatusSucceeded`. To learn of the other options of `MappingStatus`, please refer to the link below. |
| 52 | + |
| 53 | +<div class="sample-code-prefix"></div> |
| 54 | +>- Objective-C |
| 55 | +>- Swift |
| 56 | +> |
| 57 | +>1. |
| 58 | +```objc |
| 59 | +- (DSMappingStatus *)getFieldMappingStatus(NSString *)fieldName; |
| 60 | +``` |
| 61 | +2. |
| 62 | +```swift |
| 63 | +func getFieldMappingStatus(_ fieldName:String) -> MappingStatus |
| 64 | +``` |
| 65 | + |
| 66 | +**Parameters** |
| 67 | + |
| 68 | +`fieldName`: The name of the field. |
| 69 | + |
| 70 | +**Return Value** |
| 71 | + |
| 72 | +Returns a [MappingStatus]({{ site.dcv_enumerations }}code-parser/mapping-status.html?lang=objc,swift) enumeration value representing the mapping status of a specified field. |
| 73 | + |
| 74 | +### getFieldValidationStatus |
| 75 | + |
| 76 | +Gets the validation status of a specified field from the parsed result. Certain fields can be validated with one of four possible validation methods: certification, checksum, length, and regex. Whether a field is validated or not, as well as the validation method, is determined by the code specification e.g. AAMVA specification. |
| 77 | + |
| 78 | +<div class="sample-code-prefix"></div> |
| 79 | +>- Objective-C |
| 80 | +>- Swift |
| 81 | +> |
| 82 | +>1. |
| 83 | +```objc |
| 84 | +- (DSValidationStatus *)getFieldValidationStatus(NSString *)fieldName; |
| 85 | +``` |
| 86 | +2. |
| 87 | +```swift |
| 88 | +func getFieldValidationStatus(_ fieldName:String) -> ValidationStatus |
| 89 | +``` |
| 90 | + |
| 91 | +**Parameters** |
| 92 | + |
| 93 | +`fieldName`: The name of the field. |
| 94 | + |
| 95 | +**Return Value** |
| 96 | + |
| 97 | +Returns a [ValidationStatus]({{ site.dcv_enumerations }}code-parser/validation-status.html?lang=objc,swift) enumeration value saying whether the validation of a specified field was successful, failed, or if it did not require validation.. |
| 98 | + |
| 99 | +### getFieldValue |
| 100 | + |
| 101 | +Gets the value of a specified field from the parsed result. |
| 102 | + |
| 103 | +<div class="sample-code-prefix"></div> |
| 104 | +>- Objective-C |
| 105 | +>- Swift |
| 106 | +> |
| 107 | +>1. |
| 108 | +```objc |
| 109 | +- (NSString *)getFieldValue(NSString *)fieldName; |
| 110 | +``` |
| 111 | +2. |
| 112 | +```swift |
| 113 | +func getFieldValue(_ fieldName:String) -> String |
| 114 | +``` |
| 115 | + |
| 116 | +**Parameters** |
| 117 | + |
| 118 | +`fieldName`: The name of the field. |
| 119 | + |
| 120 | +**Return Value** |
| 121 | + |
| 122 | +Returns a string representing the specified field value. |
| 123 | + |
| 124 | +## Property Detail |
| 125 | + |
| 126 | +### codeType |
| 127 | + |
| 128 | +Returns the code type of the parsed result. It can be one of the following: |
| 129 | + |
| 130 | +- "AADHAAR" |
| 131 | +- "AAMVA_DL_ID" |
| 132 | +- "AAMVA_DL_ID_WITH_MAG_STRIPE" |
| 133 | +- "MRTD_TD1_ID" |
| 134 | +- "MRTD_TD2_ID" |
| 135 | +- "MRTD_TD2_VISA" |
| 136 | +- "MRTD_TD3_PASSPORT" |
| 137 | +- "MRTD_TD3_VISA" |
| 138 | +- "MRTD_TD2_FRENCH_ID" |
| 139 | +- "SOUTH_AFRICA_DL" |
| 140 | +- "VIN" |
| 141 | + |
| 142 | +<div class="sample-code-prefix"></div> |
| 143 | +>- Objective-C |
| 144 | +>- Swift |
| 145 | +> |
| 146 | +>1. |
| 147 | +```objc |
| 148 | +@property (nonatomic, readonly) NSString * codeType; |
| 149 | +``` |
| 150 | +2. |
| 151 | +```swift |
| 152 | +var codeType: String? { get } |
| 153 | +``` |
| 154 | + |
| 155 | +### jsonString |
| 156 | + |
| 157 | +The parsed result as a JSON formatted string. |
| 158 | + |
| 159 | +<div class="sample-code-prefix"></div> |
| 160 | +>- Objective-C |
| 161 | +>- Swift |
| 162 | +> |
| 163 | +>1. |
| 164 | +```objc |
| 165 | +@property (nonatomic, readonly) NSString * jsonString; |
| 166 | +``` |
| 167 | +2. |
| 168 | +```swift |
| 169 | +var jsonString: String? { get } |
| 170 | +``` |
| 171 | + |
| 172 | +### parsedFields |
| 173 | + |
| 174 | +A `NSDictionary` object stores the field names and values of the parsed fields. The field names are stored as the key of the HashMap while the field values are stored as the value. |
| 175 | + |
| 176 | +<div class="sample-code-prefix"></div> |
| 177 | +>- Objective-C |
| 178 | +>- Swift |
| 179 | +> |
| 180 | +>1. |
| 181 | +```objc |
| 182 | +@property (nonatomic, readonly) NSDictionary<NSString *, NSString *> * parsedFields; |
| 183 | +``` |
| 184 | +2. |
| 185 | +```swift |
| 186 | +var parsedFields: NSDictionary { get } |
| 187 | +``` |
0 commit comments