| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
|
| 19 | |
|
| 20 | |
|
| 21 | |
|
| 22 | |
|
| 23 | |
|
| 24 | |
package org.dishevelled.graph.io.ygraphml; |
| 25 | |
|
| 26 | |
import java.io.File; |
| 27 | |
import java.io.InputStream; |
| 28 | |
import java.io.IOException; |
| 29 | |
|
| 30 | |
import java.net.URL; |
| 31 | |
|
| 32 | |
import javax.xml.parsers.SAXParserFactory; |
| 33 | |
import javax.xml.parsers.ParserConfigurationException; |
| 34 | |
|
| 35 | |
import net.sf.stax.StAXContentHandlerBase; |
| 36 | |
import net.sf.stax.StAXContext; |
| 37 | |
import net.sf.stax.StAXDelegationContext; |
| 38 | |
import net.sf.stax.StringElementHandler; |
| 39 | |
|
| 40 | |
import org.xml.sax.XMLReader; |
| 41 | |
import org.xml.sax.Attributes; |
| 42 | |
import org.xml.sax.SAXException; |
| 43 | |
|
| 44 | |
import org.dishevelled.graph.Graph; |
| 45 | |
|
| 46 | |
import org.dishevelled.graph.io.GraphReader; |
| 47 | |
|
| 48 | |
import org.dishevelled.graph.io.graphml.GraphMLReader; |
| 49 | |
|
| 50 | |
|
| 51 | |
|
| 52 | |
|
| 53 | |
|
| 54 | |
|
| 55 | |
|
| 56 | |
|
| 57 | |
|
| 58 | |
public final class YGraphMLReader |
| 59 | |
implements GraphReader<ShapeNode, PolyLineEdge> |
| 60 | |
{ |
| 61 | |
|
| 62 | |
private final GraphMLReader<ShapeNode, PolyLineEdge> reader; |
| 63 | |
|
| 64 | |
|
| 65 | |
|
| 66 | |
|
| 67 | |
|
| 68 | |
public YGraphMLReader() |
| 69 | 6 | { |
| 70 | 6 | XMLReader xmlReader = null; |
| 71 | |
try |
| 72 | |
{ |
| 73 | 6 | xmlReader = SAXParserFactory.newInstance().newSAXParser().getXMLReader(); |
| 74 | |
} |
| 75 | 0 | catch (SAXException e) |
| 76 | |
{ |
| 77 | |
|
| 78 | |
} |
| 79 | 0 | catch (ParserConfigurationException e) |
| 80 | |
{ |
| 81 | |
|
| 82 | 6 | } |
| 83 | 6 | reader = new GraphMLReader<ShapeNode, PolyLineEdge>(xmlReader); |
| 84 | 6 | reader.setNodeValueHandler(new ShapeNodeHandler()); |
| 85 | 6 | reader.setEdgeValueHandler(new PolyLineEdgeHandler()); |
| 86 | 6 | } |
| 87 | |
|
| 88 | |
|
| 89 | |
|
| 90 | |
public Graph<ShapeNode, PolyLineEdge> read(final File file) |
| 91 | |
throws IOException |
| 92 | |
{ |
| 93 | 2 | return reader.read(file); |
| 94 | |
} |
| 95 | |
|
| 96 | |
|
| 97 | |
public Graph<ShapeNode, PolyLineEdge> read(final InputStream inputStream) |
| 98 | |
throws IOException |
| 99 | |
{ |
| 100 | 4 | return reader.read(inputStream); |
| 101 | |
} |
| 102 | |
|
| 103 | |
|
| 104 | |
public Graph<ShapeNode, PolyLineEdge> read(final URL url) |
| 105 | |
throws IOException |
| 106 | |
{ |
| 107 | 0 | return reader.read(url); |
| 108 | |
} |
| 109 | |
|
| 110 | |
|
| 111 | |
|
| 112 | |
|
| 113 | 12 | private class ShapeNodeHandler |
| 114 | |
extends StAXContentHandlerBase |
| 115 | |
{ |
| 116 | |
|
| 117 | |
private Fill fill; |
| 118 | |
|
| 119 | |
|
| 120 | |
private NodeLabel nodeLabel; |
| 121 | |
|
| 122 | |
|
| 123 | |
private BorderStyle borderStyle; |
| 124 | |
|
| 125 | |
|
| 126 | |
private Shape shape; |
| 127 | |
|
| 128 | |
|
| 129 | 6 | private final FillHandler fillHandler = new FillHandler(); |
| 130 | |
|
| 131 | |
|
| 132 | 6 | private final NodeLabelHandler nodeLabelHandler = new NodeLabelHandler(); |
| 133 | |
|
| 134 | |
|
| 135 | 6 | private final BorderStyleHandler borderStyleHandler = new BorderStyleHandler(); |
| 136 | |
|
| 137 | |
|
| 138 | 6 | private final ShapeHandler shapeHandler = new ShapeHandler(); |
| 139 | |
|
| 140 | |
|
| 141 | |
|
| 142 | |
public void startElement(final String nsURI, |
| 143 | |
final String localName, |
| 144 | |
final String qName, |
| 145 | |
final Attributes attrs, |
| 146 | |
final StAXDelegationContext dctx) |
| 147 | |
throws SAXException |
| 148 | |
{ |
| 149 | |
|
| 150 | |
|
| 151 | 48 | if ("y:Fill".equals(qName)) |
| 152 | |
{ |
| 153 | 8 | dctx.delegate(fillHandler); |
| 154 | |
} |
| 155 | 40 | else if ("y:NodeLabel".equals(qName)) |
| 156 | |
{ |
| 157 | 8 | dctx.delegate(nodeLabelHandler); |
| 158 | |
} |
| 159 | 32 | else if ("y:BorderStyle".equals(qName)) |
| 160 | |
{ |
| 161 | 8 | dctx.delegate(borderStyleHandler); |
| 162 | |
} |
| 163 | 24 | else if ("y:Shape".equals(qName)) |
| 164 | |
{ |
| 165 | 8 | dctx.delegate(shapeHandler); |
| 166 | |
} |
| 167 | 48 | } |
| 168 | |
|
| 169 | |
|
| 170 | |
public void endElement(final String nsURI, |
| 171 | |
final String localName, |
| 172 | |
final String qName, |
| 173 | |
final Object result, |
| 174 | |
final StAXContext context) |
| 175 | |
throws SAXException |
| 176 | |
{ |
| 177 | 48 | if ("y:Fill".equals(qName)) |
| 178 | |
{ |
| 179 | 8 | fill = (Fill) result; |
| 180 | |
} |
| 181 | 40 | else if ("y:NodeLabel".equals(qName)) |
| 182 | |
{ |
| 183 | 8 | nodeLabel = (NodeLabel) result; |
| 184 | |
} |
| 185 | 32 | else if ("y:BorderStyle".equals(qName)) |
| 186 | |
{ |
| 187 | 8 | borderStyle = (BorderStyle) result; |
| 188 | |
} |
| 189 | 24 | else if ("y:Shape".equals(qName)) |
| 190 | |
{ |
| 191 | 8 | shape = (Shape) result; |
| 192 | |
} |
| 193 | 48 | } |
| 194 | |
|
| 195 | |
|
| 196 | |
public Object endTree(final StAXContext context) |
| 197 | |
throws SAXException |
| 198 | |
{ |
| 199 | 8 | return new ShapeNode(fill, nodeLabel, borderStyle, shape); |
| 200 | |
} |
| 201 | |
|
| 202 | |
|
| 203 | |
|
| 204 | |
|
| 205 | 12 | private class FillHandler |
| 206 | |
extends StAXContentHandlerBase |
| 207 | |
{ |
| 208 | |
|
| 209 | |
private String color; |
| 210 | |
|
| 211 | |
|
| 212 | |
private boolean transparent; |
| 213 | |
|
| 214 | |
|
| 215 | |
|
| 216 | |
public void startElement(final String nsURI, |
| 217 | |
final String localName, |
| 218 | |
final String qName, |
| 219 | |
final Attributes attrs, |
| 220 | |
final StAXDelegationContext dctx) |
| 221 | |
throws SAXException |
| 222 | |
{ |
| 223 | 8 | if ("y:Fill".equals(qName)) |
| 224 | |
{ |
| 225 | 8 | color = attrs.getValue("color"); |
| 226 | 8 | transparent = "true".equals(attrs.getValue("transparent")); |
| 227 | |
} |
| 228 | 8 | } |
| 229 | |
|
| 230 | |
|
| 231 | |
public Object endTree(final StAXContext context) |
| 232 | |
throws SAXException |
| 233 | |
{ |
| 234 | 8 | return new Fill(color, transparent); |
| 235 | |
} |
| 236 | |
} |
| 237 | |
|
| 238 | |
|
| 239 | |
|
| 240 | |
|
| 241 | 12 | private class NodeLabelHandler |
| 242 | |
extends StAXContentHandlerBase |
| 243 | |
{ |
| 244 | |
|
| 245 | |
private boolean visible; |
| 246 | |
|
| 247 | |
|
| 248 | |
private String alignment; |
| 249 | |
|
| 250 | |
|
| 251 | |
private String fontFamily; |
| 252 | |
|
| 253 | |
|
| 254 | |
private int fontSize; |
| 255 | |
|
| 256 | |
|
| 257 | |
private String fontStyle; |
| 258 | |
|
| 259 | |
|
| 260 | |
private String textColor; |
| 261 | |
|
| 262 | |
|
| 263 | |
private String modelName; |
| 264 | |
|
| 265 | |
|
| 266 | |
private String modelPosition; |
| 267 | |
|
| 268 | |
|
| 269 | |
private String autoSizePolicy; |
| 270 | |
|
| 271 | |
|
| 272 | |
private String text; |
| 273 | |
|
| 274 | |
|
| 275 | 6 | private StringElementHandler textHandler = new StringElementHandler(); |
| 276 | |
|
| 277 | |
|
| 278 | |
|
| 279 | |
public void startElement(final String nsURI, |
| 280 | |
final String localName, |
| 281 | |
final String qName, |
| 282 | |
final Attributes attrs, |
| 283 | |
final StAXDelegationContext dctx) |
| 284 | |
throws SAXException |
| 285 | |
{ |
| 286 | 8 | if ("y:NodeLabel".equals(qName)) |
| 287 | |
{ |
| 288 | 8 | visible = "true".equals(attrs.getValue("visible")); |
| 289 | 8 | alignment = attrs.getValue("alignment"); |
| 290 | 8 | fontFamily = attrs.getValue("fontFamily"); |
| 291 | 8 | fontSize = Integer.valueOf(attrs.getValue("fontSize")); |
| 292 | 8 | fontStyle = attrs.getValue("fontStyle"); |
| 293 | 8 | textColor = attrs.getValue("textColor"); |
| 294 | 8 | modelName = attrs.getValue("modelName"); |
| 295 | 8 | modelPosition = attrs.getValue("modelPosition"); |
| 296 | 8 | autoSizePolicy = attrs.getValue("autoSizePolicy"); |
| 297 | 8 | dctx.delegate(textHandler); |
| 298 | |
} |
| 299 | 8 | } |
| 300 | |
|
| 301 | |
|
| 302 | |
public void endElement(final String nsURI, |
| 303 | |
final String localName, |
| 304 | |
final String qName, |
| 305 | |
final Object result, |
| 306 | |
final StAXContext context) |
| 307 | |
throws SAXException |
| 308 | |
{ |
| 309 | 8 | if ("y:NodeLabel".equals(qName)) |
| 310 | |
{ |
| 311 | 8 | text = (String) result; |
| 312 | |
} |
| 313 | 8 | } |
| 314 | |
|
| 315 | |
|
| 316 | |
public Object endTree(final StAXContext context) |
| 317 | |
throws SAXException |
| 318 | |
{ |
| 319 | 8 | return new NodeLabel(visible, alignment, fontFamily, fontSize, fontStyle, textColor, |
| 320 | |
modelName, modelPosition, autoSizePolicy, text); |
| 321 | |
} |
| 322 | |
} |
| 323 | |
|
| 324 | |
|
| 325 | |
|
| 326 | |
|
| 327 | 12 | private class BorderStyleHandler |
| 328 | |
extends StAXContentHandlerBase |
| 329 | |
{ |
| 330 | |
|
| 331 | |
private String type; |
| 332 | |
|
| 333 | |
|
| 334 | |
private double width; |
| 335 | |
|
| 336 | |
|
| 337 | |
private String color; |
| 338 | |
|
| 339 | |
|
| 340 | |
|
| 341 | |
public void startElement(final String nsURI, |
| 342 | |
final String localName, |
| 343 | |
final String qName, |
| 344 | |
final Attributes attrs, |
| 345 | |
final StAXDelegationContext dctx) |
| 346 | |
throws SAXException |
| 347 | |
{ |
| 348 | 8 | if ("y:BorderStyle".equals(qName)) |
| 349 | |
{ |
| 350 | 8 | type = attrs.getValue("type"); |
| 351 | 8 | width = Double.valueOf(attrs.getValue("width")); |
| 352 | 8 | color = attrs.getValue("color"); |
| 353 | |
} |
| 354 | 8 | } |
| 355 | |
|
| 356 | |
|
| 357 | |
public Object endTree(final StAXContext context) |
| 358 | |
throws SAXException |
| 359 | |
{ |
| 360 | 8 | return new BorderStyle(type, width, color); |
| 361 | |
} |
| 362 | |
} |
| 363 | |
|
| 364 | |
|
| 365 | |
|
| 366 | |
|
| 367 | 12 | private class ShapeHandler |
| 368 | |
extends StAXContentHandlerBase |
| 369 | |
{ |
| 370 | |
|
| 371 | |
private String type; |
| 372 | |
|
| 373 | |
|
| 374 | |
|
| 375 | |
public void startElement(final String nsURI, |
| 376 | |
final String localName, |
| 377 | |
final String qName, |
| 378 | |
final Attributes attrs, |
| 379 | |
final StAXDelegationContext dctx) |
| 380 | |
throws SAXException |
| 381 | |
{ |
| 382 | 8 | if ("y:Shape".equals(qName)) |
| 383 | |
{ |
| 384 | 8 | type = attrs.getValue("type"); |
| 385 | |
} |
| 386 | 8 | } |
| 387 | |
|
| 388 | |
|
| 389 | |
public Object endTree(final StAXContext context) |
| 390 | |
throws SAXException |
| 391 | |
{ |
| 392 | 8 | return new Shape(type); |
| 393 | |
} |
| 394 | |
} |
| 395 | |
} |
| 396 | |
|
| 397 | |
|
| 398 | |
|
| 399 | |
|
| 400 | 12 | private class PolyLineEdgeHandler |
| 401 | |
extends StAXContentHandlerBase |
| 402 | |
{ |
| 403 | |
|
| 404 | |
private LineStyle lineStyle; |
| 405 | |
|
| 406 | |
|
| 407 | |
private Arrows arrows; |
| 408 | |
|
| 409 | |
|
| 410 | |
private EdgeLabel edgeLabel; |
| 411 | |
|
| 412 | |
|
| 413 | |
private BendStyle bendStyle; |
| 414 | |
|
| 415 | |
|
| 416 | 6 | private final LineStyleHandler lineStyleHandler = new LineStyleHandler(); |
| 417 | |
|
| 418 | |
|
| 419 | 6 | private final ArrowsHandler arrowsHandler = new ArrowsHandler(); |
| 420 | |
|
| 421 | |
|
| 422 | 6 | private final EdgeLabelHandler edgeLabelHandler = new EdgeLabelHandler(); |
| 423 | |
|
| 424 | |
|
| 425 | 6 | private final BendStyleHandler bendStyleHandler = new BendStyleHandler(); |
| 426 | |
|
| 427 | |
|
| 428 | |
|
| 429 | |
public void startElement(final String nsURI, |
| 430 | |
final String localName, |
| 431 | |
final String qName, |
| 432 | |
final Attributes attrs, |
| 433 | |
final StAXDelegationContext dctx) |
| 434 | |
throws SAXException |
| 435 | |
{ |
| 436 | 126 | if ("y:LineStyle".equals(qName)) |
| 437 | |
{ |
| 438 | 21 | dctx.delegate(lineStyleHandler); |
| 439 | |
} |
| 440 | 105 | else if ("y:Arrows".equals(qName)) |
| 441 | |
{ |
| 442 | 21 | dctx.delegate(arrowsHandler); |
| 443 | |
} |
| 444 | 84 | else if ("y:EdgeLabel".equals(qName)) |
| 445 | |
{ |
| 446 | 21 | dctx.delegate(edgeLabelHandler); |
| 447 | |
} |
| 448 | 63 | else if ("y:BendStyle".equals(qName)) |
| 449 | |
{ |
| 450 | 21 | dctx.delegate(bendStyleHandler); |
| 451 | |
} |
| 452 | 126 | } |
| 453 | |
|
| 454 | |
|
| 455 | |
public void endElement(final String nsURI, |
| 456 | |
final String localName, |
| 457 | |
final String qName, |
| 458 | |
final Object result, |
| 459 | |
final StAXContext context) |
| 460 | |
throws SAXException |
| 461 | |
{ |
| 462 | 126 | if ("y:LineStyle".equals(qName)) |
| 463 | |
{ |
| 464 | 21 | lineStyle = (LineStyle) result; |
| 465 | |
} |
| 466 | 105 | else if ("y:Arrows".equals(qName)) |
| 467 | |
{ |
| 468 | 21 | arrows = (Arrows) result; |
| 469 | |
} |
| 470 | 84 | else if ("y:EdgeLabel".equals(qName)) |
| 471 | |
{ |
| 472 | 21 | edgeLabel = (EdgeLabel) result; |
| 473 | |
} |
| 474 | 63 | else if ("y:BendStyle".equals(qName)) |
| 475 | |
{ |
| 476 | 21 | bendStyle = (BendStyle) result; |
| 477 | |
} |
| 478 | 126 | } |
| 479 | |
|
| 480 | |
|
| 481 | |
public Object endTree(final StAXContext context) |
| 482 | |
throws SAXException |
| 483 | |
{ |
| 484 | 21 | return new PolyLineEdge(lineStyle, arrows, edgeLabel, bendStyle); |
| 485 | |
} |
| 486 | |
|
| 487 | |
|
| 488 | |
|
| 489 | |
|
| 490 | 12 | private class LineStyleHandler |
| 491 | |
extends StAXContentHandlerBase |
| 492 | |
{ |
| 493 | |
|
| 494 | |
private String type; |
| 495 | |
|
| 496 | |
|
| 497 | |
private double width; |
| 498 | |
|
| 499 | |
|
| 500 | |
private String color; |
| 501 | |
|
| 502 | |
|
| 503 | |
|
| 504 | |
public void startElement(final String nsURI, |
| 505 | |
final String localName, |
| 506 | |
final String qName, |
| 507 | |
final Attributes attrs, |
| 508 | |
final StAXDelegationContext dctx) |
| 509 | |
throws SAXException |
| 510 | |
{ |
| 511 | 21 | if ("y:LineStyle".equals(qName)) |
| 512 | |
{ |
| 513 | 21 | type = attrs.getValue("type"); |
| 514 | 21 | width = Double.valueOf(attrs.getValue("width")); |
| 515 | 21 | color = attrs.getValue("color"); |
| 516 | |
} |
| 517 | 21 | } |
| 518 | |
|
| 519 | |
|
| 520 | |
public Object endTree(final StAXContext context) |
| 521 | |
throws SAXException |
| 522 | |
{ |
| 523 | 21 | return new LineStyle(type, width, color); |
| 524 | |
} |
| 525 | |
} |
| 526 | |
|
| 527 | |
|
| 528 | |
|
| 529 | |
|
| 530 | 12 | private class ArrowsHandler |
| 531 | |
extends StAXContentHandlerBase |
| 532 | |
{ |
| 533 | |
|
| 534 | |
private String source; |
| 535 | |
|
| 536 | |
|
| 537 | |
private String target; |
| 538 | |
|
| 539 | |
|
| 540 | |
|
| 541 | |
public void startElement(final String nsURI, |
| 542 | |
final String localName, |
| 543 | |
final String qName, |
| 544 | |
final Attributes attrs, |
| 545 | |
final StAXDelegationContext dctx) |
| 546 | |
throws SAXException |
| 547 | |
{ |
| 548 | 21 | if ("y:Arrows".equals(qName)) |
| 549 | |
{ |
| 550 | 21 | source = attrs.getValue("source"); |
| 551 | 21 | target = attrs.getValue("target"); |
| 552 | |
} |
| 553 | 21 | } |
| 554 | |
|
| 555 | |
|
| 556 | |
public Object endTree(final StAXContext context) |
| 557 | |
throws SAXException |
| 558 | |
{ |
| 559 | 21 | return new Arrows(source, target); |
| 560 | |
} |
| 561 | |
} |
| 562 | |
|
| 563 | |
|
| 564 | |
|
| 565 | |
|
| 566 | 12 | private class EdgeLabelHandler |
| 567 | |
extends StAXContentHandlerBase |
| 568 | |
{ |
| 569 | |
|
| 570 | |
private boolean visible; |
| 571 | |
|
| 572 | |
|
| 573 | |
private String alignment; |
| 574 | |
|
| 575 | |
|
| 576 | |
private String fontFamily; |
| 577 | |
|
| 578 | |
|
| 579 | |
private int fontSize; |
| 580 | |
|
| 581 | |
|
| 582 | |
private String fontStyle; |
| 583 | |
|
| 584 | |
|
| 585 | |
private String textColor; |
| 586 | |
|
| 587 | |
|
| 588 | |
private String modelName; |
| 589 | |
|
| 590 | |
|
| 591 | |
private String modelPosition; |
| 592 | |
|
| 593 | |
|
| 594 | |
private String preferredPlacement; |
| 595 | |
|
| 596 | |
|
| 597 | |
private double distance; |
| 598 | |
|
| 599 | |
|
| 600 | |
private double ratio; |
| 601 | |
|
| 602 | |
|
| 603 | |
private String text; |
| 604 | |
|
| 605 | |
|
| 606 | 6 | private StringElementHandler textHandler = new StringElementHandler(); |
| 607 | |
|
| 608 | |
|
| 609 | |
|
| 610 | |
public void startElement(final String nsURI, |
| 611 | |
final String localName, |
| 612 | |
final String qName, |
| 613 | |
final Attributes attrs, |
| 614 | |
final StAXDelegationContext dctx) |
| 615 | |
throws SAXException |
| 616 | |
{ |
| 617 | 21 | if ("y:EdgeLabel".equals(qName)) |
| 618 | |
{ |
| 619 | 21 | visible = "true".equals(attrs.getValue("visible")); |
| 620 | 21 | alignment = attrs.getValue("alignment"); |
| 621 | 21 | fontFamily = attrs.getValue("fontFamily"); |
| 622 | 21 | fontSize = Integer.valueOf(attrs.getValue("fontSize")); |
| 623 | 21 | fontStyle = attrs.getValue("fontStyle"); |
| 624 | 21 | textColor = attrs.getValue("textColor"); |
| 625 | 21 | modelName = attrs.getValue("modelName"); |
| 626 | 21 | modelPosition = attrs.getValue("modelPosition"); |
| 627 | 21 | preferredPlacement = attrs.getValue("preferredPlacement"); |
| 628 | 21 | distance = Double.valueOf(attrs.getValue("distance")); |
| 629 | 21 | ratio = Double.valueOf(attrs.getValue("ratio")); |
| 630 | 21 | dctx.delegate(textHandler); |
| 631 | |
} |
| 632 | 21 | } |
| 633 | |
|
| 634 | |
|
| 635 | |
public void endElement(final String nsURI, |
| 636 | |
final String localName, |
| 637 | |
final String qName, |
| 638 | |
final Object result, |
| 639 | |
final StAXContext context) |
| 640 | |
throws SAXException |
| 641 | |
{ |
| 642 | 21 | if ("y:EdgeLabel".equals(qName)) |
| 643 | |
{ |
| 644 | 21 | text = (String) result; |
| 645 | |
} |
| 646 | 21 | } |
| 647 | |
|
| 648 | |
|
| 649 | |
public Object endTree(final StAXContext context) |
| 650 | |
throws SAXException |
| 651 | |
{ |
| 652 | 21 | return new EdgeLabel(visible, alignment, fontFamily, fontSize, fontStyle, textColor, |
| 653 | |
modelName, modelPosition, preferredPlacement, distance, ratio, text); |
| 654 | |
} |
| 655 | |
} |
| 656 | |
|
| 657 | |
|
| 658 | |
|
| 659 | |
|
| 660 | 12 | private class BendStyleHandler |
| 661 | |
extends StAXContentHandlerBase |
| 662 | |
{ |
| 663 | |
|
| 664 | |
private boolean smoothed; |
| 665 | |
|
| 666 | |
|
| 667 | |
|
| 668 | |
public void startElement(final String nsURI, |
| 669 | |
final String localName, |
| 670 | |
final String qName, |
| 671 | |
final Attributes attrs, |
| 672 | |
final StAXDelegationContext dctx) |
| 673 | |
throws SAXException |
| 674 | |
{ |
| 675 | 21 | if ("y:BendStyle".equals(qName)) |
| 676 | |
{ |
| 677 | 21 | smoothed = "true".equals(attrs.getValue("smoothed")); |
| 678 | |
} |
| 679 | 21 | } |
| 680 | |
|
| 681 | |
|
| 682 | |
public Object endTree(final StAXContext context) |
| 683 | |
throws SAXException |
| 684 | |
{ |
| 685 | 21 | return new BendStyle(smoothed); |
| 686 | |
} |
| 687 | |
} |
| 688 | |
} |
| 689 | |
} |