From FedoraProject

Jump to: navigation, search
This content and the entirety of the project are now maintained directly through the Moin Moin Wiki at [1]

This page is outdated and is only retained for historical reference
This content is no longer maintained on this Wiki. The Moin DocBook pages are canonical.

I got an idea of how to embed "inline" xml in to the wikisyntax (step 5 of the plan of attack).

In moinmoin there are custom parsers for highlighting program snippets and irclogs. The way to call these is to write

{ { {#java
public static void main(String args[] ) {
System.out.println("Hello world");
} } }

The "#java" will result in the wikiparser invoking the syntax highligher (aka parser) for java.

My idea would use a similar strategy, but the wikiparser would invoke a "parser" that would simply pass xml to the formatter. It would be invoked in a similar manner:

{ { {#xmlpassthrough
} } }

This would get parsed by a real xml parser. The parser would then check if the formatter has support for a namespace, and if it does, it would start passing the info by, calling a special formatter method for each xml-element. A simplistic sax interface would be perfect, since each formatter could just implement the sax methods they are interested in.

My plan is to have every xml-element namespaced, and xmlpassthrough would have a hardcoded namespace list. This way there would be a single canonical list of the namespace keywords.

The xmlpassthrough would do the following before passing the result to the real xml parser:

  • gather the whole xml string
  • wrap it in <passthrough> </passthrough> so that there will be a single root element, as required by xml spec
  • prepend the required declarations and namespaces