@Test public void testRasterWithThreeColorGradient() throws Exception { YamlMap obj = transform("raster", "three-color-gradient.sld"); YamlMap raster = obj.seq("feature-styles") .map(0) .seq("rules") .map(0) .seq("symbolizers") .map(0) .map("raster"); assertEquals("(#0000FF,,150,)", raster.map("color-map").seq("entries").str(0)); assertEquals("(#FFFF00,,200,)", raster.map("color-map").seq("entries").str(1)); assertEquals("(#FF0000,,250,)", raster.map("color-map").seq("entries").str(2)); }
public void transform() throws IOException, XMLStreamException { context.stream().document().push(new RootHandler()); boolean root = true; Integer next = xml.hasNext() ? xml.next() : null; while (next != null) { context.reset(); SldTransformHandler h = context.handlers.peek(); switch (next) { case PROCESSING_INSTRUCTION: case COMMENT: case SPACE: break; case START_DOCUMENT: break; case START_ELEMENT: if (root) { String ver = xml.getAttributeValue(null, "version"); if (ver != null) { context.version(ver); } } root = false; h.element(xml, context); break; case ATTRIBUTE: h.attribute(xml, context); break; case CHARACTERS: h.characters(xml, context); break; case END_ELEMENT: h.endElement(xml, context); break; case END_DOCUMENT: break; } if (context.moveToNext) { next = xml.hasNext() ? xml.next() : null; } } context.endDocument().endStream(); }
SldTransformer { public void transform() throws IOException, XMLStreamException { context.stream().document().push(new RootHandler()); boolean root = true; Integer next = xml.hasNext() ? xml.next() : null; while (next != null) { context.reset(); SldTransformHandler h = context.handlers.peek(); switch (next) { case PROCESSING_INSTRUCTION: case COMMENT: case SPACE: break; case START_DOCUMENT: break; case START_ELEMENT: if (root) { String ver = xml.getAttributeValue(null, "version"); if (ver != null) { context.version(ver); } } root = false; h.element(xml, context); break; case ATTRIBUTE: h.attribute(xml, context); break; case CHARACTERS: h.characters(xml, context); break; case END_ELEMENT: h.endElement(xml, context); break; case END_DOCUMENT: break; } if (context.moveToNext) { next = xml.hasNext() ? xml.next() : null; } } context.endDocument().endStream(); } }
SldTransformer { public void transform() throws IOException, XMLStreamException { context.stream().document().push(new RootHandler()); boolean root = true; Integer next = xml.hasNext() ? xml.next() : null; while (next != null) { context.reset(); SldTransformHandler h = context.handlers.peek(); switch (next) { case PROCESSING_INSTRUCTION: case COMMENT: case SPACE: break; case START_DOCUMENT: break; case START_ELEMENT: if (root) { String ver = xml.getAttributeValue(null, "version"); if (ver != null) { context.version(ver); } } root = false; h.element(xml, context); break; case ATTRIBUTE: h.attribute(xml, context); break; case CHARACTERS: h.characters(xml, context); break; case END_ELEMENT: h.endElement(xml, context); break; case END_DOCUMENT: break; } if (context.moveToNext) { next = xml.hasNext() ? xml.next() : null; } } context.endDocument().endStream(); } SldTransformer(XMLStreamReader xml, Writer yaml); }
SldTransformer { public void transform() throws IOException, XMLStreamException { context.stream().document().push(new RootHandler()); boolean root = true; Integer next = xml.hasNext() ? xml.next() : null; while (next != null) { context.reset(); SldTransformHandler h = context.handlers.peek(); switch (next) { case PROCESSING_INSTRUCTION: case COMMENT: case SPACE: break; case START_DOCUMENT: break; case START_ELEMENT: if (root) { String ver = xml.getAttributeValue(null, "version"); if (ver != null) { context.version(ver); } } root = false; h.element(xml, context); break; case ATTRIBUTE: h.attribute(xml, context); break; case CHARACTERS: h.characters(xml, context); break; case END_ELEMENT: h.endElement(xml, context); break; case END_DOCUMENT: break; } if (context.moveToNext) { next = xml.hasNext() ? xml.next() : null; } } context.endDocument().endStream(); } SldTransformer(XMLStreamReader xml, Writer yaml); SldTransformContext context(); void transform(); }
SldTransformer { public void transform() throws IOException, XMLStreamException { context.stream().document().push(new RootHandler()); boolean root = true; Integer next = xml.hasNext() ? xml.next() : null; while (next != null) { context.reset(); SldTransformHandler h = context.handlers.peek(); switch (next) { case PROCESSING_INSTRUCTION: case COMMENT: case SPACE: break; case START_DOCUMENT: break; case START_ELEMENT: if (root) { String ver = xml.getAttributeValue(null, "version"); if (ver != null) { context.version(ver); } } root = false; h.element(xml, context); break; case ATTRIBUTE: h.attribute(xml, context); break; case CHARACTERS: h.characters(xml, context); break; case END_ELEMENT: h.endElement(xml, context); break; case END_DOCUMENT: break; } if (context.moveToNext) { next = xml.hasNext() ? xml.next() : null; } } context.endDocument().endStream(); } SldTransformer(XMLStreamReader xml, Writer yaml); SldTransformContext context(); void transform();  }