Quick Search
Browse
Pages
Blog
Labels
Attachments
Mail
Advanced
What’s New
Space Directory
Feed Builder
Keyboard Shortcuts
Confluence Gadgets
Log In
Sign Up
Dashboard
data.xml
Copy Page
You are not logged in. Any changes you make will be marked as
anonymous
. You may want to
Log In
if you already have an account. You can also
Sign Up
for a new account.
This page is being edited by
.
Paragraph
Paragraph
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Preformatted
Quote
Bold
Italic
Underline
Colour
More colours
Strikethrough
Subscript
Superscript
Monospace
Clear Formatting
Bullet list
Numbered list
Outdent
Indent
Align left
Align center
Align right
Link
Table
Insert
Insert Content
Image
Link
Attachment
Symbol
Emoticon
Wiki Markup
Horizontal rule
tinymce.confluence.insert_menu.macro_desc
Info
JIRA Issue
Status
Gallery
Tasklist
Table of Contents
Other Macros
Undo
Redo
Keyboard Shortcuts Help
<p>This design document covers a superset of the clojure.xml schema.</p><p>All metadata are optional, parsers SHOULD provide them and serializers MAY leverage it: metadata is not required to be kept in sync with their data so it's up to the serializers heuristics to use or ignore them.</p><h1>Namespaces</h1><p>A namespace aware XML parser produces a datastructure following these representations, this representation is designed as a superset of the clojure.xml representation:</p><table class="confluenceTable"><tbody><tr><th class="confluenceTh">XML</th><th colspan="1" class="confluenceTh">Clojure</th><th class="confluenceTh">Notes</th></tr><tr><td class="confluenceTd">Element</td><td colspan="1" class="confluenceTd"><pre>^{::xml/ns {"" "http://..."<br /> "x" "http://..."}<br /> ::xml/prefix "x"}<br />{:tag :foo<br /> :uri "http://..."<br /> :attrs {...}<br /> :content [...]}</pre></td><td class="confluenceTd"><p>A map with keys: :tag (local name keywordized), :attrs (attribute map), :content (nil, sequence, sequential collection of nodes), :uri (namespace URI as string).</p><p>Metadata: under the ::xml/ns key, a map of prefixes (strings) to URIs (strings), under the ::xml/prefix a string of the original prefix.</p><p>(where xml is an alias for data.xml)</p></td></tr><tr><td class="confluenceTd">Attribute</td><td colspan="1" class="confluenceTd"><pre>^{::xml/ns {"" "http://..."<br /> "x" "http://..."}<br /> ::xml/prefix "x"}<br />[:href "http://..."]</pre></td><td class="confluenceTd"><p>A map entry whose key is either a keyword (no prefix) or a [:kw "uri"] pair; the value is a string.</p><p>In the case of [:kw "uri"] keys, ::xml/prefix SHOULD be present</p><p>the uri MUST NOT be nil or the empty string</p></td></tr><tr><td class="confluenceTd">Text nodes</td><td colspan="1" class="confluenceTd"><pre> "text"</pre></td><td class="confluenceTd"> </td></tr><tr><td colspan="1" class="confluenceTd">Comment</td><td colspan="1" class="confluenceTd"><pre> {:comment "text"}</pre></td><td colspan="1" class="confluenceTd"> </td></tr><tr><td colspan="1" class="confluenceTd">...</td><td colspan="1" class="confluenceTd"> </td><td colspan="1" class="confluenceTd">TBD</td></tr></tbody></table><h1>Default serialization strategy suggestion</h1><p>The default serialization strategy is conservative.</p><p>When serializing an element: add missing namespaces declarations.</p><p>For each name (elements or attributes name):</p><ol><li>If the ::xml/prefix matches the :uri then use it,</li><li>if the uri is mapped to another alias, use it, (Should we rather map the url to the new alias?)</li><li>if the uri is not mapped then map it under the specified alias (if present) or a gensymed alias.</li></ol><p>For elements:</p><p>emit xmlns and xmlns:* attributes for new mappings (generated by attributes serialization and by new entries under the ::xml/ns key – new when compared to the state maintained by the serializer).</p><p> </p><h1>Custom serialization strategies</h1><p>To please broken consumers, XML serialization has to be tweaked. It may be interesting to have emit or *xml-emitter* or somethieng to be a dynamic var.</p><p> </p><p>Less than half-baked idea:</p><p>Defining a full serializer is tiresome so it may be interesting to provide a factory.</p><table class="wysiwyg-macro" data-macro-name="code" data-macro-parameters="title=serializer" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGU6dGl0bGU9c2VyaWFsaXplcn0&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre>(serializer init ; internal state of the serializer, initial value (fn [state xmlns] state') ; fn to update internal state given a new xmlns map (fn [state local-name uri prefix] prefix')) ; fn which decides which prefix to use for a given name</pre></td></tr></table><p>All serialization quirks can't be solved by emitters produced by such a factory but if it covers a good chunk it may be worthy.</p><p>There must be a better abstraction.</p>
Attachments
Labels
Location
< Edit
Preview >
Loading…
Save
Cancel
Next hint
search
attachments
weblink
advanced