@Test public void testPolygonWithGraphicFill() throws Exception { YamlMap obj = transform("poly", "graphic-fill.sld"); YamlMap poly = obj.seq("feature-styles") .map(0) .seq("rules") .map(0) .seq("symbolizers") .map(0) .map("polygon"); YamlMap g = poly.map("fill-graphic").seq("symbols").map(0).map("external"); assertEquals("colorblocks.png", g.str("url")); assertEquals("image/png", g.str("format")); assertEquals(93, poly.map("fill-graphic").integer("size").intValue()); }
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();  }