Skip to content

Attributes with length 1 are rejected by parser #14

@awmross

Description

@awmross

I am parsing XML from OpenStreetMap. It looks like this:

<tag k="highway" v="residential"/>

The parser chokes when parsing the "k" attribute.

I set up my rule as:

IRule wayTagRule=new DefaultRule(IRule.Type.ATTRIBUTE, "/osm/way/tag","k","v") 

I get

com.thebuzzmedia.sjxp.XMLParserException: local name for rule looks to be missing for IRule: scamsoft.randomwalk.mapfetch.MapBuilder$4[type=ATTRIBUTE, locationPath=/osm/way/tag, attributeNames=k,v]
    at com.thebuzzmedia.sjxp.XMLParser.doStartTag(XMLParser.java:714)
    at com.thebuzzmedia.sjxp.XMLParser.doParse(XMLParser.java:579)
    at com.thebuzzmedia.sjxp.XMLParser.parse(XMLParser.java:457)
    at com.thebuzzmedia.sjxp.XMLParser.parse(XMLParser.java:297)

I think this is a simple "off by 1" error.
XMLParser.java at line 713 should be:

if (attrName.length() - startIndex <= 0)
    throw new XMLParserException(
         "local name for rule looks to be missing for IRule: "
        + rule);

I am using the current stable version (2.2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions