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