# Invalid Character in Name

**URL:** <https://discourse.nodered.org/t/invalid-character-in-name/24498>\
**Category:** General\
**Created:** [9 April 2020 04:25 UTC](https://discourse.nodered.org/t/invalid-character-in-name/24498 "2020-04-09T04:25:07Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steven](https://avatars.discourse-cdn.com/v4/letter/s/94ad74/32.png) [@Steven](https://discourse.nodered.org/u/Steven)\
**Post date:** [9 April 2020 04:25 UTC](https://discourse.nodered.org/t/invalid-character-in-name/24498/1 "2020-04-09T04:25:07Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/7/779fcb75f6d09960051bc31fbba9641e0eaa5a24.png)  
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:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/d/dd09de5006f57806f96b50e7e348b95a6ef7b6b8.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/b/8b48537db6adb9e66f408fc83793db78aafa4f0a.png)  
XML Node:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/d/0d16742be7d53ec93c715aa10993c9fab0eb0e16.png)

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [9 April 2020 05:47 UTC](https://discourse.nodered.org/t/invalid-character-in-name/24498/2 "2020-04-09T05:47:57Z")

</div>

> [@Steven](#):
>
> Error:Invalid Character in Name

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

**OR!**

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.

---

<div class="post-metadata">

**Author:** ![Steven](https://avatars.discourse-cdn.com/v4/letter/s/94ad74/32.png) [@Steven](https://discourse.nodered.org/u/Steven)\
**Post date:** [9 April 2020 06:22 UTC](https://discourse.nodered.org/t/invalid-character-in-name/24498/3 "2020-04-09T06:22:24Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/d/ad6aad3d19b74b6acece6b55a2401e427624af7c.png)  
Here is the result:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/6/a677fcbb7ddcc4f9b47fbabe2b2b1e3e8eae1572.png)

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [9 April 2020 06:32 UTC](https://discourse.nodered.org/t/invalid-character-in-name/24498/4 "2020-04-09T06:32:04Z")

</div>

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](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/c/3c9c4444902c85f651d6e9137e2f4fe60e28c6b2.png)

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.

**also**

(sorry)

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

---

<div class="post-metadata">

**Author:** ![Steven](https://avatars.discourse-cdn.com/v4/letter/s/94ad74/32.png) [@Steven](https://discourse.nodered.org/u/Steven)\
**Post date:** [9 April 2020 07:14 UTC](https://discourse.nodered.org/t/invalid-character-in-name/24498/5 "2020-04-09T07:14:18Z")

</div>

```auto
{"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](https://discourse.nodered.org/uploads/short-url/uTGktKPAF0fjUiZOXybq578Q5qB.json) (2.0 KB)

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [9 April 2020 07:21 UTC](https://discourse.nodered.org/t/invalid-character-in-name/24498/6 "2020-04-09T07:21:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [9 April 2020 07:21 UTC](https://discourse.nodered.org/t/invalid-character-in-name/24498/7 "2020-04-09T07:21:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Steven](https://avatars.discourse-cdn.com/v4/letter/s/94ad74/32.png) [@Steven](https://discourse.nodered.org/u/Steven)\
**Post date:** [9 April 2020 08:13 UTC](https://discourse.nodered.org/t/invalid-character-in-name/24498/8 "2020-04-09T08:13:46Z")

</div>

@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?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [9 April 2020 08:28 UTC](https://discourse.nodered.org/t/invalid-character-in-name/24498/9 "2020-04-09T08:28:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [9 April 2020 10:09 UTC](https://discourse.nodered.org/t/invalid-character-in-name/24498/10 "2020-04-09T10:09:38Z")

</div>

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

```auto
"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.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [9 April 2020 12:39 UTC](https://discourse.nodered.org/t/invalid-character-in-name/24498/11 "2020-04-09T12:39:18Z")

</div>

> [@knolleary](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [8 June 2020 12:39 UTC](https://discourse.nodered.org/t/invalid-character-in-name/24498/12 "2020-06-08T12:39:36Z")

</div>

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