Original Message:
Sent: Thu April 27, 2023 01:52 AM
From: Matthias Blomme
Subject: FIELDTYPE on XMLNSC
Hi Francois
I want to check the type of InputRoot.XMLNSC.root.field1 to add some logic after that. I beleive that should match with XMLNSC.Folder since it has no value.
However, as you can see from the json output is doesn't. It also doesn't match XMLNSC.ELEMENT as you can see from the next screenshot and as I stated before, it only matches on Name.

------------------------------
Regards
Matthias Blomme
Original Message:
Sent: Thu April 20, 2023 07:49 AM
From: Francois Brandelik
Subject: FIELDTYPE on XMLNSC
Hi Matthias,
It would perhaps help if you would explain, what you are trying to achieve. Apparently not as I expected to move the XML tree into a JSON tree...
As for field1 remember that you are defining it as nil. So it might match the XMLNSC.ELEMENT type (type name value) and not the XMLNSC.FOLDER type. Same would apply for field2.
I also got confused with your tree because you did not define something like the below for the Fieldtype
SET ref.reffieldname = FIELDNAME(reffield);
SET ref.reffieldtype = FIELDTYPE(reffield);
SET ref.foldertype = (ref.reffieldtype = XMLNSC.FOLDER);
If you define something a null i.e. attribute nil=true I would expect it to be reported as XMLNSC.ELEMENT, regardless of wether you look at it as folder or element.
Hope this helps you understand.
------------------------------
Francois Brandelik
Original Message:
Sent: Thu April 20, 2023 02:33 AM
From: Matthias Blomme
Subject: FIELDTYPE on XMLNSC
Hi Francois,
I understand your remark, but I'm really not.
The output in JSON is just so that I have a visual print of the variables without taking the flow in debug mode, that is the "Result" part. I am not trying to set a fieldtype, I am comparing values here.
And there is nothing structurally wrong with the xml declaration in a json tree, json will handle it just as any other field.
You might notice that my input message is xml and that I check the fieldtype of the InputRoot.
SET OutputRoot.JSON.Data.FieldType.field1FolderMatch = (FIELDTYPE(InputRoot.XMLNSC.root.field1) = XMLNSC.Folder);
In that case I would expect the value of field1FolderMatch to be TRUE and not FALSE, since field1 of the inputroot is indeed a folder under the xmlnsc parser.
------------------------------
Regards
Matthias Blomme
Original Message:
Sent: Wed April 19, 2023 07:44 AM
From: Francois Brandelik
Subject: FIELDTYPE on XMLNSC
Hi Mathias,
You are comparing apples and oranges. Why would you expect it to match when you are using different parsers?
You may notice that not even the structures match under the parser.
Exhibit A) the XML declaration has no place in a JSON tree...
You are going by first field. In this case you might have to delete the first field (and its attributes) as it is the XML declaration...
And should that not be
SET OutputRoot.JSON.Data.field1(FieldType) = FIELDTYPE(InputRoot.XMLNSC.root.field1);
As for the suitability of this statement need I remind you that the fieldtypes change according to the parser you use (XMLNS, XMLNSC)? So even if you did use the above statement, I would still expect your output to either fail, or not be what you expect...
I expect that a better example would be to look at:
SET OutputRoot.JSON.Data = InputRoot.XMLNSC.root;
------------------------------
Francois Brandelik
Original Message:
Sent: Tue April 18, 2023 04:09 AM
From: Matthias Blomme
Subject: FIELDTYPE on XMLNSC
Hey all
I have a question regarding the use of the FIELDTYPE function and the variables.
Let me paint the picture
I have the following input data
<?xml version="1.0" encoding="UTF-8"?><root><field1 nil="true" /><field2>data</field2></root>
When executing the following code to print the values and matches
CREATE LASTCHILD OF OutputRoot DOMAIN 'JSON';SET OutputRoot.JSON.Data = InputRoot.XMLNSC;SET OutputRoot.JSON.Data.FieldType.field1 = FIELDTYPE(InputRoot.XMLNSC.root.field1);SET OutputRoot.JSON.Data.FieldType.field1FolderRef = XMLNSC.Folder;SET OutputRoot.JSON.Data.FieldType.field1FolderMatch = (FIELDTYPE(InputRoot.XMLNSC.root.field1) = XMLNSC.Folder); SET OutputRoot.JSON.Data.FieldType.field1NameRef = Name;SET OutputRoot.JSON.Data.FieldType.field1NameMatch = (FIELDTYPE(InputRoot.XMLNSC.root.field1) = Name);
I get the following data result

I was expecting XMLNSC.Folder to match on the field1 element. Am I wrong here? Is the XMLNSC.Folder not meant for this? Even the documentation mentions that it should be used for that. \FIELDTYPE function
I expect that I'm using it wrong or that there is some dependency or interpretation that I am missing. Can anybody shed some light on this?
------------------------------
Regards
Matthias Blomme
------------------------------