Recent changesContact the site administrator
Home
XmlConversie

Context

Ik (Walter) ben een stuk text aan het maken dat ik aan potentiele lezers wil gaan presenteren. Liefst tegelijkertijd in HTML (statische website) en PDF (boek) formaat. Nou vertellen alle goeroes me dat ik een scheiding tussen inhoud en presentatie moet maken, dus loop ik maar braaf achter de goeroes aan.

Deze text wil ik vervolgens omzetten in een statische website, zodat ik zo min mogelijk afhankelijk ben van m'n provider. Hiervoor zijn nogal wat verschillende conversie-stappen nodig. Denk aan invoegen van het "title"-attribuut binnen <chapter> als een <h1> in de pagina, afhandeling van links (intern en extern), 1 aparte pagina per <chapter>, een printer-friendly variant, enzovoort, enzovoort.

Wat valt er te hacken? Je raadt het al: De XML structuur omzetten naar een lading HTML pagina's. Diverse mogelijkheden, die allemaal claimen het beste te werken: XSLT, Anakia, Ruby (de kans om het te promoten), CSS, ...

Voor de PairProgrammingParty zou ik zeggen: Zoveel mogelijkheden, zoveel pairs.


Update: de site is er inmiddels: http://javamatch.sourceforge.net
Ter illustratie: De text tot nog toe:
<?xml version="1.0" encoding="UTF-8"?>
<document>
<chapter title="introduction">
<intro>
    JavaMatch is an engine that can search inside a runtime Java data structures, 
    and look for objects that best match the criteria that you specify. JavaMatch 
    is a generic match engine, not targeted at a specific domain. It can be applied
    to any runtime data structure, and the extensive query mechanism allows for
    highly customizable tuning of your searches.

It is the intention to combine JavaMatch with object-relational mapping tools, such as Hibernate and JDO. This allows to matching within databases. See <link target="JavaMatch/JDO">JavaMatch/JDO</link> and <link target="JavaMatch/Hibernate"> JavaMatch/Hibernate</link> for more information about the integration with these object-relational mapping tools. </intro> Nice those stories, but how does it work in practice? Let me give you an example: <example> <source description="Simple match query"> </source> </example> </chapter> <chapter name="Frequently asked questions" fileBase="faq"> <category name="What is JavaMatch, compared to..."> <question> <q>What is JavaMatch, compared to a search engine?</q> <a> A <keyword>search engine</keyword> is typically used to search on the internet / intranet for documents with a certain text or image. JavaMatch searches inside the Java Virtual Machine for classes that match certain criteria.

The query language supported by a search engine (such as <external-link target="http://www.google.com/help/operators.html"> Google</link>) is typically fixed, and limited to a small set of operations. JavaMatch, as an engine, provides a more extensive set of search options. An application may provide a user interface that reduces the vast amount of options to the subset that is relevant for its target domain, or to those queries that are easily understood by the applications' target audience. </a> </question> <question> <q>What is JavaMatch, compared to SQL?</q> <a></a> </question> <question> <q>What is JavaMatch, compared to my own search algorithm?</q> <a></a> </question> </category> <category name="How, when and where to use"> <question> <q>Why hasn't this been implemented before?</q> <a></a> </question> <question> <q>How about performance?</q> <a></a> </question> <question> <q>I only want exact matches. How can I get them?</q> <a> Exact matches can be specified using an AndList-query. However, if you only want exact results from your database, plain SQL might be a better alternative, as it is integrated inside the database </a> </question> </category> </chapter> </document>

Informatie Brains4all