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

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

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

NIFI-13335 Added ability for the XMLRecordReader to handle where an array of 
data has different types.

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

This closes #9356.


> XMLReader drops values from name-value content if values are mixture of 
> strings and numbers
> -------------------------------------------------------------------------------------------
>
>                 Key: NIFI-13335
>                 URL: https://issues.apache.org/jira/browse/NIFI-13335
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>    Affects Versions: 1.24.0, 1.27.0, 2.0.0-M4
>         Environment: Docker
>            Reporter: Stephen Jeffrey Hindmarch
>            Assignee: Daniel Stieglitz
>            Priority: Major
>
> This is similar to NIFI-13334, but does not require an array of records to 
> demonstrate.
> If you create an XMLReader service and set the following:
>  * Parse XML Attributes = true
>  * Expect Records as Arrays = false
>  * Field Name for Content = Value
> Then use the reader in a ConvertRecord processor with a JSONRecordSetWriter
> When parsing a flow file such as
> {noformat}
> <Event Type="foo">
>   <System>
>     <EventID>0x0001</EventID>
>   </System>
>   <UserData>
>     <Data Name="Param1">String1</Data>
>     <Data Name="Param2">String2</Data>
>     <Data Name="Param3">String3</Data>
>   </UserData>
> </Event>{noformat}
> then the data tags all get parsed with the correct values.
> {noformat}
> [ {
>   "Type" : "foo",
>   "System" : {
>     "EventID" : "0x0001"
>   },
>   "UserData" : {
>     "Data" : [ {
>         "Name" : "Param1",
>         "Value" : "String1"
>     }, {
>         "Name" : "Param2",
>         "Value" : "String2"
>     }, {
>         "Name" : "Param3",
>         "Value" : "String3"
>     } ]
>   }
> } ]{noformat}
> But if one of those data tags has a numeric value then all of the values are 
> dropped and are replaced with null. For example
> {noformat}
> <Event Type="foo">
>   <System>
>     <EventID>0x0001</EventID>
>   </System>
>   <UserData>
>     <Data Name="Param1">String1</Data>
>     <Data Name="Param2">2</Data>
>     <Data Name="Param3">String3</Data>
>   </UserData>
> </Event>
> {noformat}
> parses to
> {noformat}
> [ {
>   "Type" : "foo",
>   "System" : {
>     "EventID" : "0x0001"
>   },
>   "UserData" : {
>     "Data" : [ {
>         "Name" : "Param1",
>         "Value" : null
>     }, {
>         "Name" : "Param2",
>         "Value" : null
>     }, {
>         "Name" : "Param3",
>         "Value" : null
>     } ]
>   }
> } ]{noformat}
> and all of the tag data is lost.



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

Reply via email to