I tried to get null value from my xml file such below
<top:kadastroParselFeature gml:id="KADASTRO_PARSEL.1">
<top:olcek xsi:nil="true" />
</top:kadastroParselFeature>
but my parser throws such an exception :
java.lang.RuntimeException: Parsing failed for kadastroParselFeature: java.lang.NullPointerException
at org.geotools.xml.impl.ParseExecutor.visit(ParseExecutor.java:164)
at org.geotools.xml.impl.BindingWalker$BindingExecutionChain.execute(BindingWalker.java:220)
at org.geotools.xml.impl.BindingWalker.walk(BindingWalker.java:186)
at org.geotools.xml.impl.ElementHandlerImpl.endElement(ElementHandlerImpl.java:236)
at org.geotools.xml.impl.ParserHandler.endElement(ParserHandler.java:719)
My parser configuration like this :
org.geotools.xml.Configuration configuration = new org.geotools.gml2.GMLConfiguration();
org.geotools.xml.Parser parser = new org.geotools.xml.Parser( configuration );
parser.setFailOnValidationError(false);
HashMap<Object, Object> parsedMap = (HashMap<Object, Object>) parser.parse( isx);
if I remove xsi:nill="true"
from element it returns ""(empty string) but i need null .
there is a usage of my parser at http://docs.geotools.org/stable/userguide/library/xml/geometry.html
I found a solution for my work the problem at my gml writer version if i changed the version from gml2 to gml3 the problem not seen. and ı changed my parser config. like this