1. I have corrected the e-mail settings so that outgoing e-mails from these forums should be sent now. If you tried to Register or Reset your Password, please try again!
    Dismiss Notice

[XML] Issue with newlines in character['bio']

Discussion in 'Census: General Discussion' started by Lantis, Feb 9, 2012.

  1. DanKinney

    DanKinney Guest

    Understood.

    The problem is not actually in the API itself, but in the transport from the game team to our database.  They provide data to our system in XML.  The native storage format of data used by the API is in JSON.  If the game team encodes the new line properly (with an entity), it should be handled properly and everyone is happy.

    -dan

     
  2. Quicktiger

    Quicktiger Guest

    Sounds perfect.

    Does that mean we can fix those item.displayname and other strings?  :)

     
  3. Quicktiger

    Quicktiger Guest

    Wait a sec though.

    The newlines ARE coming through the API, which means your XML parser is working properly from the game team to you.  The problem seems to be in the generation of the XML output by the API server itself then?

    Here's the JSON:

    <span style="font-family: Times; font-size: medium;">
    Code:
    {"seconds": 0.0045628547668457031, "limit": 1, "returned": 1, "character_list": [{"bio": "Tell me what you thinknTell me what you knownDid you really thinknThat there would be an everafter?nnDo you think I'm scared?nTell me does it show?nWhen inside this deafnessnI can always hear his whispering!n", "id": 446676947772}]}
     
  4. Dethdlr

    Dethdlr Guest

    Here's that same bio in XML (or as close as I could get with this forum software):

    Code:
    <?xml version='1.0' encoding='UTF-8'?> <character_list limit="1" returned="1" seconds="0.004695"> <character bio="Tell me what you think Tell me what you know Did you really think That there would be an everafter? Do you think I'm scared? Tell me does it show? When inside this deafness I can always hear his whispering! " id="446676947772" /></character_list>
     
  5. DanKinney

    DanKinney Guest

    Yeah...that's what we are seeing as we debug it.  If you look at the XML in the debugger, you will see that the XML already contains
    for the newlines.  We just added it to the game export and tested it and the entity *did* leak through.  We are not going to make this change.

    -dan

     
  6. Lantis

    Lantis Guest

    Hi Dan,

    Just wondering if this issue was still on the radar (replacing linefeeds with their corresponding HTML entities)?

     
  7. DanKinney

    DanKinney Guest

    Not really.  We determined that our potential solution was worse than the problem.

    This needs to have a XML-specific solution as the YAML and JSON renderers are correct.  Do you have an opinion on what we should do?

    -dan

     
  8. Lantis

    Lantis Guest

    I guess a solution would have to be XML-specific then if it doesn't happen with JSON.  I noticed today how some characters were already replaced by entities in the feed  (> and &lt;), just not the carriage returns:

    census.daybreakgames.com/xml/get/eq2/character/446676908718

    I assume those were pushed like this by the game team?

    If so, replacing any carriage returns/linefeed by a
    entity would have to be done on the data feed's side, when generating the XML.

    From my end, I see no good workaround that I could implement, short of sending a separate query just for the bio, process it separately (without using an XML parser which would strip the carriage returns as those are not valid in an XML structure), and insert it into my local data.

     
  9. DanKinney

    DanKinney Guest

    If those are in there, it was put by someone else - either the game team or by direct typing (I'm assuming you didn't do the latter<img src="/station/images/smilies/3b63d1616c5dfcf29f8a7a031aaa7cad.gif" border="0" />).

    That's how we got to this state - no clear winner of a solution.

    -dan

     
  10. Lantis

    Lantis Guest

    I assume you get the data from the game team in some format (SQL or otherwise), and that the REST API servers are the ones responsible for formatting this into a JSON/XML/YAML format before pushing it to us, correct?  If so, can't you handle replacing those n with the correct entity at the moment you generate the XML (which would leave all other formats untouched)?

    I feel like I'm misunderstanding something in the actual process here, sorry if I'm looking at it all wrong :)

     

Share This Page