pgyori commented on code in PR #5964:
URL: https://github.com/apache/nifi/pull/5964#discussion_r856341418


##########
nifi-nar-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/xml/XMLRecordReader.java:
##########
@@ -509,6 +477,53 @@ private Record parseRecord(StartElement startElement, 
RecordSchema schema, boole
         }
     }
 
+    private void parseAttributesForRecord(StartElement startElement, 
RecordSchema schema, boolean coerceTypes, boolean dropUnknown, Map<String, 
Object> recordValues) {
+        final Iterator iterator = startElement.getAttributes();
+        while (iterator.hasNext()) {
+            final Attribute attribute = (Attribute) iterator.next();
+            final String attributeName = attribute.getName().toString();
+
+            final String targetFieldName = attributePrefix == null ? 
attributeName : attributePrefix + attributeName;
+
+            if (dropUnknown) {
+                final Optional<RecordField> field = 
schema.getField(attributeName);
+                if (field.isPresent()){
+
+                    // dropUnknown == true && coerceTypes == true

Review Comment:
   I extracted this chunk of the code to a method as-is. But I think yes, the 
comments are intentional. They emphasize that all four combinations of the 
dropUnknown and coerceTypes boolean values need to be covered. I checked and 
the comments are still in sync with the code.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to