Log in

No account? Create an account
I have an xml handling question for the XMLRPC interface in C#… - LiveJournal Client Discussions — LiveJournal [entries|archive|friends|userinfo]
LiveJournal Client Discussions

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

[Jul. 5th, 2002|02:22 am]
LiveJournal Client Discussions

I have an xml handling question for the XMLRPC interface in C#

How do I handle < (left angle bracket)and > (right angle bracket)within the text of an entry when posting it to the server? do I use &lt and &gt? do I XmlEncode the entire entry (with the _xFFFF etc)?

I must... or I can see the following problem happening.

<value>This is my entry <livejournal-cut text="this is why its a problem">. This is some more of my entry </value>

Unless I'm mistaken, that is invalid XML. And obviously I have no control over the user having well formed XML in the text of the entry. The same sort of problem applies to other characters that are reserved like an _x**** sequence. Any ideas?


From: ekto
2002-07-05 01:32 am (UTC)
Have you tried using a block for the contents of the post? (I think that's the right syntax).
(Reply) (Thread)
From: ekto
2002-07-05 01:32 am (UTC)

And, this time using HTML entities (my bad)

I do of course mean a <![CDATA[...]]> block.
(Reply) (Parent) (Thread)
From: erin
2002-07-05 07:32 am (UTC)
If using the above suggestion with a CDATA section doesn't work The only other suggestion that comes to mind for me would be declaring an entity, with the entity value being the lj-cut tag. It would take a while to mangle, though
(Reply) (Thread)
From: piman
2002-07-05 09:28 am (UTC)
&lt;, &gt; and &amp; are predefined XML entities; if you don't use a CDATA block, you should use those.
(Reply) (Thread)
[User Picture]From: mart
2002-07-08 07:39 am (UTC)

It's better to entitify the text rather than use a CDATA block because there's no decent way to escape the end-block sequence (]]<) short of introducing a zero-width non-joiner into the middle of it or something.

If a user puts the end-block sequence in an entry and you're relying on a CDATA block, it'll break because the CDATA block will end prematurely.

Also, remember that in XML the semicolons on the end of entity references are required.

(Reply) (Thread)
[User Picture]From: ljnp4u
2002-07-13 04:42 pm (UTC)
Use the &#xx; equivalent of the ] character to ensure that you can never break out of the CDATA prematurely ? I can't think of any valid html tag at the moment that would need a ] coded in it. Sure you can do alt="[something]" but even then I don't think browsers would display it differently since they usually accept the &#xx; as well in those occasions.
(Reply) (Parent) (Thread)
From: joelau
2002-07-18 06:57 pm (UTC)


Maybe I havent searched hard enough, but is there a xml-rpc or soap interface to livejournal? Thanks.
(Reply) (Thread)