?

Log in

No account? Create an account
LiveJournal Client Discussions [entries|archive|friends|userinfo]
LiveJournal Client Discussions

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

XML - LJ.XMLRPC.postevent - props member [May. 18th, 2004|08:31 pm]
LiveJournal Client Discussions

lj_clients

[krolain]
[mood |confusedconfused]

Evening everyone.

I got another question (I hope I'm not bugging anyone too much) regarding the postevent through XML this time.

So far, it seems whenever I use this member I get an LJ XML parsing issue. So, I'm rather confused on how to use this member to set the various properties. Based on the document, I tried it these way so far:

<MEMBER>
  <NAME>props</NAME>
  <VALUE>
    <ARRAY>
      <DATA>
        <VALUE>
          <STRUCT>
            <MEMBER>
              <NAME>current_mood</NAME>
              <VALUE><STRING>curious</STRING><VALUE>
            </MEMBER>
           </STRUCT>
         </VALUE>
        <VALUE>
          <STRUCT>
            <MEMBER>
              <NAME>current_music</NAME>
              <VALUE><STRING>music</STRING><VALUE>
            </MEMBER>
           </STRUCT>
         </VALUE>
       </DATA>
     </ARRAY>
   </VALUE>
</MEMBER>


and I also tried it in this way:

<MEMBER>
  <NAME>props

So, both these things seems to get me a parsing error from LJ.  Are both these correct, or is there another way?  Is the document up to date on this?  I'm just a bit confused about this and getting a tad furstrated.  I even tried with just one prop and it fails.  I know my XML code work because I can do other things like log in and view, add, remove and edit my LJ groups and LJ friend lists.

Help would be appreciated.

Thanks everyone!
linkReply

Comments:
[User Picture]From: krolain
2004-05-22 06:39 pm (UTC)
Ah... well I use the version number in all my protocol right now. So I don't have problems with any of them so far.

However, there is something I found that I tried to find answers to but it wasn't done. It appears that music and moods doesn't support non-english characters. If I use the character 'é' for example, I can post it in the subject or entry field, but it won't appear on the music or mood field. It only happens in XML-RPC protocol... not flat. Am I the only one having this issue? o.O

At this rate, I may have to keep support for both flat and XML, flat for multi-lingual. Or is there something undocumented for supporting special characters like that in music/emotion fields?
(Reply) (Parent) (Thread)
From: m_leprae
2004-05-23 04:05 am (UTC)
I had problems with posting certain character values > 127. I believe you need to convert them into %XX, where XX is the hexidemical value of the character. You can do that for the flat protocol as well. The Semagic client seems to do it.

(Reply) (Parent) (Thread)
[User Picture]From: krolain
2004-05-23 06:16 pm (UTC)
Hi.

Thanks for the tip, but I tried it and it didn't work. It just doesn't like using special characters. I dunno why.

So, after many trials and error, I managed to figure it out how to do it. The best way is to encode the text into base64-encoded binary. I stumbled upon this answer when one of my post ended up being sent to me in binary. I knew it was text since it was a post that I used the same special character. Once I decoded the binary into bytes, then UTF-8 decoded that, the text appeared correctly.

So, the way to do it is:
1. UTF-8 byte encode the text
2. Encode the bytes into base64-encoded binary

That seems to work! :-) I may use base64 binary for all my text posting onto LJ.
(Reply) (Parent) (Thread)