- The DTD should allow for future server capabilities whenever possible - new metadata, new security levels, etc.
- The DTD should be capable of representing posts that have not yet been submitted to the LiveJournal server. (Client offline mode, possible XML protocol, etc.)
- The resulting files should be readable and editable by humans.
"3 < 4" should not be represented as"3 &lt; 4" . Possibly we should use CDATA blocks and conventionally escape" as]]( *)>
"" ; inelegant, but nowhere near as ugly as double-escaping characters. Suggestions welcome.]]$1 >
" - When keywords in the existing protocol and terminology in common usage differ, we should use the latter for tag names.
Update: Fixed typo. This originally had two ATTLISTs for option and none for meta.
<!-- itemid is optional, in case the server hasn't seen this post yet --> <!ELEMENT entry (subject?, date, security, (option | meta)*, body)> <!ATTLIST entry itemid CDATA #IMPLIED journal CDATA #REQUIRED> <!-- ime short one-line text bits make better attributes than tag contents --> <!ELEMENT subject EMPTY> <!ATTLIST subject text CDATA #REQUIRED> <!-- format for date is "yyyy-mm-dd hh:mm:ss", as is used elsewhere in LJ seconds-since-epoch would be nice, but fails outside 1970-2038 range allow empty date value, with tz, to let server do the timestamp --> <!ELEMENT date EMPTY> <!ATTLIST date value CDATA #IMPLIED tz CDATA #IMPLIED> <!-- use CDATA attribute, not enum, in case we add security types --> <!ELEMENT security (group+ | mask)?> <!ELEMENT group EMPTY> <!ELEMENT mask EMPTY> <!ATTLIST security type CDATA #REQUIRED> <!ATTLIST group name CDATA #REQUIRED> <!ATTLIST mask name CDATA #REQUIRED> <!-- options are booleans; metas are values associated with predefined keys --> <!ELEMENT option EMPTY> <!ATTLIST option name CDATA #REQUIRED> <!ELEMENT meta EMPTY> <!ATTLIST meta name CDATA #REQUIRED value CDATA #REQUIRED> <!-- body of the entry --> <!ELEMENT body (#PCDATA)>Example entry, using this DTD:
<entry itemid="4758836" journal="alanj"> <subject text="Subject of my post"/> <date value="2001-06-01 21:41:08"/> <security type="custom"> <group name="Some friends"/> <group name="Other friends"/> </security> <option name="nocomments"/> <meta name="userpic" value="dazed"/> <meta name="mood" value="confused"/> <meta name="weather" value="63'F, mostly cloudy"/> <body><![CDATA[ This is my post body. It has <b>bold</b> and <i>italics</i>. :-> It also has a CDATA close sequence ]] >, but that got escaped. ]]></body> </entry>