Invalid Character in Name

Flow above actually work if using Node-Red in groov EPIC device. But when come to Node-Red in Windows, XML node show "Error:Invalid Character in Name". Why would this happen?
It seems like msg.payload is the problem.
XML Format Function Node:
XML Node:

Nice, but you have hidden that information - as I see it.


There is no name.

It may be nice to be sure from where the output you showed comes.

Which node is giving you the error?

Put a debug node on the node before the node with the error and set it to show the whole message.

Paste those results and it may be easier to find the problem.

XML node is giving the error.
As you stated previously, I had put my debug node on the previous node of the XML node.

Here is the result:

O k a y. . . . .

1 - The debug is still only showing msg.payload

2 - name doesn't exist - again from what I see.

In the output (on the right side of the screen) to the right of where the object is....... See where the red arrow is on my example.

Screenshot from 2020-04-09 16-27-28

Move the mouse to there and click. That copies it to the clipboard.

Click on the </> at the top of the edit screen and paste the contents of the clipboard and let me see the entire contents.



Open the change node and take a picture of all the things happening in there.
That too could be a problem.

{"logging_type":"RealData","vender_id":null,"vender":"Solution Engineering","station_ref":"5218f947459b","station_id":"4A4B001","station_name":"Jalan","send_date":{"year":"2020","month":"04","day":"09"},"send_time":{"hour":"15","minute":"10","second":"00"},"update_date":{"year":"2020","month":"04","day":"09"},"update_time":{"hour":"15","minute":"10","second":"00"},"total_data":36,"output":{"data1":{"0":751,"1":"SITE_ID1","2":"Site ID1 number","3":null,"4":"4A4B001"},"data2":{"0":752,"1":"SITE_ID2","2":"Site ID2 number","3":null,"4":null},"data3":{"0":753,"1":"LONG_N_D","2":"Longtitude Deg","3":"Degree","4":null},"data4":{"0":754,"1":"LONG_N_M","2":"Longtitude Min","3":"Minutes","4":null},"data5":{"0":755,"1":"LONG_N_S","2":"Longtitude Sec","3":"Second","4":null},"data6":{"0":756,"1":"LONG_E_D","2":"Lagtitude Deg","3":"Degree","4":null},"data7":{"0":757,"1":"LONG_E_M","2":"Lagtitude Min","3":"Minutes","4":null},"data8":{"0":758,"1":"LONG_E_S","2":"Lagtitude Sec","3":"Second","4":null},"data9":{"0":761,"1":"SITE_NAME","2":"Site Name","3":null,"4":"4A4B Jalan Syed Putra"},"data10":{"0":771,"1":"SITE_DISTRICT","2":"Site District","3":null,"4":null},"data11":{"0":781,"1":"SITE_STATE","2":"Site State","3":null,"4":null},"data12":{"0":791,"1":"GSM_NO","2":"GSM Nomber","3":null,"4":null},"data13":{"0":794,"1":"GSM_SIG","2":"GSM Signal Strength","3":null,"4":null},"data14":{"0":801,"1":"CONT_SMS1","2":"SMS Contact 1","3":null,"4":"admin"},"data15":{"0":807,"1":"SMS_NO1","2":"SMS Contact Nomber 1","3":null,"4":"0167175208"},"data16":{"0":1,"1":"B1_COND","2":"Blower 1 Condition","3":null,"4":1},"data17":{"0":2,"1":"B1_MODE","2":"Blower 1 Mode","3":null,"4":1},"data18":{"0":3,"1":"B1_STAT","2":"Blower 1 Status","3":null,"4":1},"data19":{"0":9,"1":"B1_ENBLE","2":"Blower 1 Enable","3":"0/1(Int)","4":1},"data20":{"0":51,"1":"B2_COND","2":"Blower 2 Condition","3":null,"4":1},"data21":{"0":52,"1":"B2_MODE","2":"Blower 2 Mode","3":null,"4":1},"data22":{"0":53,"1":"B2_STAT","2":"Blower 2 Status","3":null,"4":1},"data23":{"0":59,"1":"B2_ENBLE","2":"Blower 2 Enable","3":"0/1(Int)","4":1}},"status":{"message":"Complete"}}

Here is the change node flow. Is hard for me to copy all 19 changes. Sorry for the inconvenient
change node flow.json (2.0 KB)

No problems.

I am looking at the change node and think there are problems in there.

You seem to have multiple enteries doing stuff on the payload.
That can't be good.
msg.payload can only every be one value.

I see @dceejay is replying and I think he will be better qualified to help you than me.

In general for the XML node I find the easiest way is to first take a known good piece of XML (eg the result you want) and feed it through the XML node to a debug. That will show you the correct format of the js object you need to pass in to convert the other way. It doesn't just accept a "normal" js object.

1 Like

@dceejay, so you mean that I need to GET xml from the URL using http node and pass through XML node to a debug to see js object I need izit?

you need an example of a working XML you need to send to the Infomech node .
Then send that through the xml node and inspect the js that comes out... then change the js coming out of your change node to match the format.

The 'Invalid Character in Name' error is coming from the "0", "1" etc key names under the output property:

"output": {
        "data1": {
            "0": 751,
            "1": "SITE_ID1",
            "2": "Site ID1 number",
            "3": "null",
            "4": "4A4B001"

XML tag names cannot start with a number.

You say this flow works on the EPIC but not on Windows. What version of Node-RED are you using in each place? It may be the underlying XML library has tightened up its validation.

We had a similar post a few months ago I seem to remember when a malformed xml document that had previously parsed ok started failing following and upgrade. There was debate about whether this was a bug, but the conclusion I think was that the bug was the fact that it parsed ok in the first place.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.