Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

found 2 bugs #112

Closed
SeekMyCosmic opened this issue Oct 27, 2018 · 6 comments
Closed

found 2 bugs #112

SeekMyCosmic opened this issue Oct 27, 2018 · 6 comments

Comments

@SeekMyCosmic
Copy link

SeekMyCosmic commented Oct 27, 2018

First, thanks for your work ,it's great!
Second, there are 2 bugs found these days:

  1. tikxml cannot parse xml file with format utf-8 with bom, while do well on utf-8 no bom fomat.
    If i want to parse utf-8 with bom xml file, I have to remove the bom whose bytes are EF BB BF.
  2. compatiable problem
    After model class is fixed, if xml add new ..., tikxml will not parse it and throw an exception ,and my app will crash. I think tikxml just parse what model class has and give Some Detail Log Infomation without throwing an exception. You know the server-end is likely to change xml file without any notification at any time, so it's very dangerous.
    Hope to correct the bugs as soon as quickly.
    And I hope you can post your work at https://github.com/square/retrofit/tree/master/retrofit-converters, and I think many people will like it.
    Thanks a lot!
@WeaponMan
Copy link
Contributor

WeaponMan commented Oct 27, 2018

  1. utf-8 bom is fixed in latest snapshot (Still waiting for new release, because @sockeqwe has problem with singing keys)
  2. You can use exceptionOnUnreadXml(false) if I am not mistaken and if you interested in logging info look at Collect information about skipped elements / text contents / attributes while parsing #72

@SeekMyCosmic
Copy link
Author

SeekMyCosmic commented Oct 27, 2018

Thank you very much!

  1. It's a good news, and I hope new version will be released soon.
  2. I saw the Collect information about skipped elements / text contents / attributes while parsing #72 and exceptionOnUnreadXml(false) really solved my problem.
    To some point of view, exceptionOnUnreadXml is a very good choice because we can check our code in debug stage.

I still have a another question, that is whether or not we can parse the item with html tag in it, for example:
<description> A nice kind of flowers, <br> Please see the link...</description>
It's commonly that we will meet exception when we parse it abover, but my question is that we ONLY
just concerned about how to parse the file according to the annotation, instead of throwing an exception because the syntax is not our focus.
So is there a function switch, similar to exceptionOnUnreadXml(), when we set it as FALSE, we can ignore all Html TAGs in . I often encounter such xml files with a lot of Html Tags. My current choice is to add CDATA arount it by myself.
Thanks again.

@sockeqwe
Copy link
Contributor

sockeqwe commented Oct 27, 2018 via email

@WeaponMan
Copy link
Contributor

There isn't switch for that, unfortunately, but interesting use case.
Maybe there is way to implement in custom adapter TypeConverter, but expect you will be using XmlReader. You can learn from already generated TypeConverters how to to use it.

@SeekMyCosmic
Copy link
Author

Thanks!
At present I write a new TikXmlResponseBodyConverter to process the problem.
I will see XmlReader and learn TypeConverter.
Thank you for your help!

@sockeqwe
Copy link
Contributor

It should work, therefore closing this (See latest SNAPSHOT and also include utf8 bom support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants