| 389 | | parseId(current, getLong("id")); |
| 390 | | parseTimestamp(current, parser.getAttributeValue(null, "timestamp")); |
| 391 | | parseUser(current, parser.getAttributeValue(null, "user"), parser.getAttributeValue(null, "uid")); |
| 392 | | parseVisible(current, parser.getAttributeValue(null, "visible")); |
| 393 | | parseVersion(current, parser.getAttributeValue(null, "version")); |
| 394 | | parseAction(current, parser.getAttributeValue(null, "action")); |
| 395 | | parseChangeset(current, parser.getAttributeValue(null, "changeset")); |
| | 403 | boolean addedUser = false; |
| | 404 | for (int i = 0; i < parser.getAttributeCount(); i++) { |
| | 405 | switch (parser.getAttributeLocalName(i)) { |
| | 406 | case "id": |
| | 407 | parseId(current, getLong("id")); |
| | 408 | break; |
| | 409 | case "timestamp": |
| | 410 | parseTimestamp(current, parser.getAttributeValue(null, "timestamp")); |
| | 411 | break; |
| | 412 | case "user": |
| | 413 | case "uid": |
| | 414 | if (!addedUser) { |
| | 415 | parseUser(current, parser.getAttributeValue(null, "user"), parser.getAttributeValue(null, "uid")); |
| | 416 | addedUser = true; |
| | 417 | } |
| | 418 | break; |
| | 419 | case "visible": |
| | 420 | parseVisible(current, parser.getAttributeValue(null, "visible")); |
| | 421 | break; |
| | 422 | case "version": |
| | 423 | parseVersion(current, parser.getAttributeValue(null, "version")); |
| | 424 | break; |
| | 425 | case "action": |
| | 426 | parseAction(current, parser.getAttributeValue(null, "action")); |
| | 427 | break; |
| | 428 | case "changeset": |
| | 429 | parseChangeset(current, parser.getAttributeValue(null, "changeset")); |
| | 430 | break; |
| | 431 | case "lat": |
| | 432 | case "lon": |
| | 433 | break; |
| | 434 | default: |
| | 435 | if (convertUnknownToTags) { |
| | 436 | parseTag(current, parser.getAttributeLocalName(i), parser.getAttributeValue(i)); |
| | 437 | } |
| | 438 | } |
| | 439 | } |
| | 506 | |
| | 507 | /** |
| | 508 | * Parse the given input source and return the dataset. |
| | 509 | * |
| | 510 | * @param source the source input stream. Must not be null. |
| | 511 | * @param progressMonitor the progress monitor. If null, {@link NullProgressMonitor#INSTANCE} is assumed |
| | 512 | * @param convertUnknownToTags true if unknown xml attributes should be kept as tags |
| | 513 | * |
| | 514 | * @return the dataset with the parsed data |
| | 515 | * @throws IllegalDataException if an error was found while parsing the data from the source |
| | 516 | * @throws IllegalArgumentException if source is null |
| | 517 | * @since xxx |
| | 518 | */ |
| | 519 | public static DataSet parseDataSet(InputStream source, ProgressMonitor progressMonitor, boolean convertUnknownToTags) |
| | 520 | throws IllegalDataException { |
| | 521 | return new OsmReader(convertUnknownToTags).doParseDataSet(source, progressMonitor); |
| | 522 | } |