ticofab / android-gpx-parser

A library to parse XML Gpx files, built for Android.
Apache License 2.0
123 stars 44 forks source link

not sucessed #25

Closed Chenshuai770 closed 4 years ago

Chenshuai770 commented 4 years ago
2020-03-02 2020 etx365.cn LAVEN 2020-03-02 2020 etx365.cn LAVEN

I use java code like :

Metadata metadata = parsedGpx2.getMetadata(); String name = metadata.getName(); String desc = metadata.getDesc(); Copyright copyright = metadata.getCopyright(); String author = copyright.getAuthor(); String license = copyright.getLicense(); Log.d(TAG, author + license);

D/TTT: etx365.cn etx365.cn it succed like D/TTT: LAVEN etx365.cn How could I do something ? Thank you

ticofab commented 4 years ago

Hey @Chenshuai770 , thanks for opening this issue. The copyright XML in your example is malformed according to the Topografix 1.1 standard. If you open the link and search for Complex Type: copyrightType, you will find that the author is only allowed in the attributes of copyright and not in sub-tags:

<...
  author="xsd:string [1] ?">
    <year> xsd:gYear </year> [0..1] ?
    <license> xsd:anyURI </license> [0..1] ?
</...>

So the behavior of the parser is correct when reading your example XML :)