Skip to main content
Solved

If sentence not working

  • September 7, 2018
  • 2 replies
  • 20 views

Forum|alt.badge.img

Hallo! My problem is that i try to start a simple template with just an "Root Template". The code is like:

<OpenDRIVE>
    <header>revMajor="1" revMinor="1" name="" version="1.00" 
    date="Fri Jul 27 14:52:00 2018" 
    north="0.0000000000000000e+00" south="0.0000000000000000e+00" 
    east="0.0000000000000000e+00" west="0.0000000000000000e+00"</header>
{
    if (fme:has-attribute("id"))
    then
        <road>
            r="road works"
        </road>
}
</OpenDRIVE>

The console give me that output:

XMLTemplater(XMLTemplaterFactory): The following error occurred near line 7, column 32 of the query:
XMLTemplater(XMLTemplaterFactory): invalid expression: syntax error, unexpected ExprSingle (missing comma "," between expressions?)

XMLTemplater(XMLTemplaterFactory): An error occurred while parsing the ROOT template

XMLTemplater(XMLTemplaterFactory): A fatal error has occurred. Check the logfile above for details

A fatal error has occurred. Check the logfile above for details

I have no idea why my if sentence doesn't work, i do completely the same as in this question described: 

https://knowledge.safe.com/questions/40027/convert-json-to-xml.html

I hope anyone can help me pls.

Best answer by david_r

Try adding an empty else clause:

<OpenDRIVE>
    <header>revMajor="1" revMinor="1" name="" version="1.00" 
    date="Fri Jul 27 14:52:00 2018" 
    north="0.0000000000000000e+00" south="0.0000000000000000e+00" 
    east="0.0000000000000000e+00" west="0.0000000000000000e+00"</header>
{
    if (fme:has-attribute("id"))
    then
        <road>
            r="road works"
        </road>
    else ()
}
</OpenDRIVE>
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

david_r
Celebrity
  • 8394 replies
  • Best Answer
  • September 7, 2018

Try adding an empty else clause:

<OpenDRIVE>
    <header>revMajor="1" revMinor="1" name="" version="1.00" 
    date="Fri Jul 27 14:52:00 2018" 
    north="0.0000000000000000e+00" south="0.0000000000000000e+00" 
    east="0.0000000000000000e+00" west="0.0000000000000000e+00"</header>
{
    if (fme:has-attribute("id"))
    then
        <road>
            r="road works"
        </road>
    else ()
}
</OpenDRIVE>

Forum|alt.badge.img

Try adding an empty else clause:

<OpenDRIVE>
    <header>revMajor="1" revMinor="1" name="" version="1.00" 
    date="Fri Jul 27 14:52:00 2018" 
    north="0.0000000000000000e+00" south="0.0000000000000000e+00" 
    east="0.0000000000000000e+00" west="0.0000000000000000e+00"</header>
{
    if (fme:has-attribute("id"))
    then
        <road>
            r="road works"
        </road>
    else ()
}
</OpenDRIVE>
Thx it works!