ticofab/android-gpx-parser

not sucessed

Chenshuai770 opened this issue · 1 comments

<name>2020-03-02</name>
<copyright author="etx365.cn">
  <year>2020</year>
  <license>etx365.cn</license>
  <author>LAVEN</author>
</copyright>
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

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 :)