[ 
https://issues.apache.org/jira/browse/NIFI-14780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18060741#comment-18060741
 ] 

ASF subversion and git services commented on NIFI-14780:
--------------------------------------------------------

Commit 625236b7f307c9d51a70b53166e6983e3aff45e0 in nifi's branch 
refs/heads/main from dan-s1
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=625236b7f3 ]

NIFI-14780 Removed introduction of default field name for content when content 
is not set to be included and schema is inferred in XMLReader.

This closes #10929.

Signed-off-by: Pierre Villard <[email protected]>


> XMLReader writes null value if "Field Name for Content" is not set
> ------------------------------------------------------------------
>
>                 Key: NIFI-14780
>                 URL: https://issues.apache.org/jira/browse/NIFI-14780
>             Project: Apache NiFi
>          Issue Type: Bug
>            Reporter: Gábor Gyimesi
>            Assignee: Daniel Stieglitz
>            Priority: Major
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> In the XMLReader controller service if the 'Parse XML Attributes' is set to 
> true then XML node attributes are written as record fields. In this case the 
> content and the attributes are defined together as a record. In such a case, 
> the name of the tag will be used as the name for the record and the value of 
> this property will be used as the name for the field holding the original 
> content. The 'Field Name for Content' property is used in this case to define 
> the field name for the content in the record. For example if this attribute 
> is set to 'tagValue' this will be the result using the XMLReader and the 
> JsonRecordSetWriter:
> Input:
> {code:java}
> <note>
> <to alias="TK">Kyle</to>
> <from>Stan</from>
> <heading>Reminder</heading>
> <body>Don't forget me this weekend!</body>
> </note>{code}
> Output:
> {code:java}
> [{"to":{"alias":"TK","tagValue":"Kyle"},"from":"Stan","heading":"Reminder","body":"Don't
>  forget me this weekend!"}] 
> {code}
> However when the 'Field Name for Content' is not set the content is meant to 
> be ignored and not written, resulting in the following debug message:
> {code:java}
> "Found content for a field that was supposed to be named with the value of 
> the "Field Name for Content" property but the property was not set. The 
> content was not added to the record."{code}
> This seems to be inconsistent with the result seen in the flow file, because 
> when the 'Field Name for Content' is empty a default "value" field is created 
> without any value:
> {code:java}
> [{"to":{"alias":"TK","value":null},"from":"Stan","heading":"Reminder","body":"Don't
>  forget me this weekend!"}] 
> {code}
> I think this is inconsistent, we should either create a default "value" 
> record field with the XML tag content if the "Field Name for Content" 
> property is empty or we should not create any default "value" record fields 
> at all.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to