Changeset 336 in josm


Ignore:
Timestamp:
2007-10-02T23:23:09+02:00 (17 years ago)
Author:
framm
Message:
  • added patch from Ted Mielczarek <ted.mielczarek@…> to handle <link> tags in GPX nodes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branch/0.5/src/org/openstreetmap/josm/io/RawGpsReader.java

    r319 r336  
    9494                                }
    9595                                tags.push(tag);
    96                         }
     96                        } else if (peek.equals("text")) {
     97                            String tag = tags.pop();
     98                            if (tags.empty() || !tags.peek().equals("link")) {
     99                                tags.push(tag);
     100                                return;
     101                            }
     102                            String contents = new String(ch, start, length);
     103                            // we just want the contents of <link><text></text></link> to
     104                            // all be stored under link.
     105                            String oldContents = currentTagValues.get("link");
     106                            if (oldContents == null) {
     107                                currentTagValues.put("link", contents);
     108                            } else {
     109                                currentTagValues.put("link", oldContents + contents);
     110                            }
     111                            tags.push(tag);
     112                        }
    97113                }
    98114
     
    109125                                newTrack();
    110126                                currentTagValues.clear();
    111                         }
     127                        } else if (qName.equals("link")) {
     128                            String contents = currentTagValues.get(qName);
     129                            if (contents != null) {
     130                                // strip off leading and trailing whitespace
     131                                currentTagValues.put(qName,
     132                                                     contents
     133                                                      .replaceFirst("^\\s+", "")
     134                                                      .replaceFirst("\\s+$", ""));
     135                            }
     136                        }
    112137                        tags.pop();
    113138                }
Note: See TracChangeset for help on using the changeset viewer.