Skip to main content

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.

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>

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!

 

 


Reply