Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ Error from ImportXML
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Ksajal
(17 posts) Bio
|
Date
| Tue 04 May 2010 09:15 PM (UTC) |
Message
| This is really weird, I am trying to import a trigger and I can't seem to get to the bottom of this error:
Line 44: Element name must start with letter or underscore, but starts with "3" (problem in this file)
I've defined the trigger in Mushclient first (triggers -> add), copied it, then pasted in the file I am trying to load it from.
Here's how it looks when I paste it directly from mush:
<triggers>
<trigger
group="System_Pipel"
match="^Total Pipes\: (\d+)$"
name="pipes_assign"
regexp="y"
send_to="12"
sequence="100"
>
<!--the line below is the troublesome line-->
<send>if (tonumber("%1")<3) then
	display.warning("not enough pipes")
else
	pipes:assign()
end--if
EnableTriggerGroup("System_Pipel", false)
</send>
</trigger>
</triggers>
I've deleted the weird symbols (and replaced the one near "3" with "<") and this is how it looks after that:
<trigger
group="System_Pipel"
match="^Total Pipes\: (\d+)$"
name="pipes_assign"
regexp="y"
send_to="12"
sequence="100"
>
<!--the line below is the troublesome line-->
<send>if (tonumber ("%1")<3) then
display.warning("not enough pipes")
else
pipes:assign()
end--if
EnableTriggerGroup("System_Pipel", false)</send>
</trigger>
Can anyone please tell me what is wrong it it?
| Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #1 on Tue 04 May 2010 09:32 PM (UTC) Amended on Tue 04 May 2010 09:34 PM (UTC) by Twisol
|
Message
| < is the XML 'entity' for <, a bit like an escape sequence. Just like you can't have " on its own in a lua string ("I say "this""), you can't have < on its own in an XML document. I changed the < to < in your second snippet and it worked fine.
I think the 	 comes from you using the TAB key in your code (because the TAB character has ASCII code 9). It shouldn't hurt anything by being there though, because it should be translated back to a TAB character when MUSHclient loads the XML. (Just like how < is turned back into < when it's loaded.)
EDIT: I had to add <triggers></triggers> around the second snippet too. You seem to have removed that compared to the first snippet.
EDIT 2: I copied the first snippet and Imported it without making any changes, and it worked fine. Are you just bothered by the weird symbols? :) |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
Posted by
| Nick Gammon
Australia (23,159 posts) Bio
Forum Administrator |
Date
| Reply #2 on Tue 04 May 2010 09:54 PM (UTC) |
Message
|
Ksajal said:
I've deleted the weird symbols (and replaced the one near "3" with "<") ...
I don't understand the problem here. What you pasted (the first one) can be imported back in (by hitting the paste button in the trigger list). Naturally if you change it, you will have problems.
Also, ImportXML works fine too:
ImportXML [[
<triggers>
<trigger
group="System_Pipel"
match="^Total Pipes\: (\d+)$"
name="pipes_assign"
regexp="y"
send_to="12"
sequence="100"
>
<!--the line below is the troublesome line-->
<send>if (tonumber("%1")<3) then
	display.warning("not enough pipes")
else
	pipes:assign()
end--if
EnableTriggerGroup("System_Pipel", false)
</send>
</trigger>
</triggers>
]]
As Twisol said, since it is using <xxx> for XML entities, it has to change any "<" symbols in your code to < - the same as in an XML document. So, leave them as is.
If that troubles you, use the addxml module. Read about it here:
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #3 on Wed 05 May 2010 02:28 AM (UTC) |
Message
|
Nick Gammon said: If that troubles you, use the addxml module. Read about it here:
(post=7123)
*cough* Or Reflex! *cough*
|
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
Posted by
| Ksajal
(17 posts) Bio
|
Date
| Reply #4 on Wed 05 May 2010 12:05 PM (UTC) Amended on Wed 05 May 2010 12:15 PM (UTC) by Ksajal
|
Message
| I've tried using it exactly as it was pasted from mushclient, and it worked.
Thanks for the help!
EDIT: yes, Twisol, it kind of bothered me a bit because I didn't know what it was. Now I do! | Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #5 on Wed 05 May 2010 06:13 PM (UTC) |
Message
|
Ksajal said:
I've tried using it exactly as it was pasted from mushclient, and it worked.
Thanks for the help!
EDIT: yes, Twisol, it kind of bothered me a bit because I didn't know what it was. Now I do!
No worries. :) Glad you got it sorted. |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
17,476 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top