Skip to content

TypeError when trying to convert several SLDs #2

@sbsimo

Description

@sbsimo

Hello, I tried to run the script for working on several SLDs, but always get the same error (below).
I'm working with node v8.10.0 and Ubuntu 18.04.4 LTS.
Can it be due to the namespace (sld:) in front of the tags in my input SLDs?
Or the issue is related to compatibility with the dependency versions?
Thanks a lot!

sample of SLD input:
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?> <sld:StyledLayerDescriptor version="1.0.0" xmlns:sld="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink"> <sld:NamedLayer>...

events.js:183
throw er; // Unhandled 'error' event
^

TypeError: Cannot read property 'NamedLayer' of undefined
at /root/viewer/SLDexit/SLD_to_JSON.js:239:57
at Parser. (/root/viewer/SLDexit/node_modules/xml2js/lib/parser.js:304:18)
at emitOne (events.js:116:13)
at Parser.emit (events.js:211:7)
at SAXParser.onclosetag (/root/viewer/SLDexit/node_modules/xml2js/lib/parser.js:262:26)
at emit (/root/viewer/SLDexit/node_modules/sax/lib/sax.js:624:35)
at emitNode (/root/viewer/SLDexit/node_modules/sax/lib/sax.js:629:5)
at closeTag (/root/viewer/SLDexit/node_modules/sax/lib/sax.js:889:7)
at SAXParser.write (/root/viewer/SLDexit/node_modules/sax/lib/sax.js:1436:13)
at Parser.exports.Parser.Parser.parseString (/root/viewer/SLDexit/node_modules/xml2js/lib/parser.js:323:31)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions