@Test public void testLineWithBorder() throws Exception { YamlMap style = transform("line", "border.sld"); YamlMap rule = style.seq("feature-styles").map(0).seq("rules").map(0); YamlMap line = rule.seq("symbolizers").map(0).map("line"); assertEquals("#333333", line.str("stroke-color")); assertEquals(5, line.integer("stroke-width").intValue()); assertEquals("round", line.str("stroke-linecap")); rule = style.seq("feature-styles").map(1).seq("rules").map(0); line = rule.seq("symbolizers").map(0).map("line"); assertEquals("#6699FF", line.str("stroke-color")); assertEquals(3, line.integer("stroke-width").intValue()); assertEquals("round", line.str("stroke-linecap")); }
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();  }