<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://knowledgebase.pirho.net/index.php?action=history&amp;feed=atom&amp;title=Parsing_WADL_%E2%80%93_From_Specification_to_Opportunity</id>
	<title>Parsing WADL – From Specification to Opportunity - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://knowledgebase.pirho.net/index.php?action=history&amp;feed=atom&amp;title=Parsing_WADL_%E2%80%93_From_Specification_to_Opportunity"/>
	<link rel="alternate" type="text/html" href="https://knowledgebase.pirho.net/index.php?title=Parsing_WADL_%E2%80%93_From_Specification_to_Opportunity&amp;action=history"/>
	<updated>2026-07-11T12:59:54Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://knowledgebase.pirho.net/index.php?title=Parsing_WADL_%E2%80%93_From_Specification_to_Opportunity&amp;diff=380&amp;oldid=prev</id>
		<title>Dex: Created page with &quot;&#039;&#039;&#039;Summary:&#039;&#039;&#039;   This article explores the practical journey of turning WADL from a static XML document into a fully executable API contract. It covers DOM parsing, XPointer limitations, method dereferencing, parameter inheritance, multi-pass processing, and the surprising architectural opportunities unlocked once WADL becomes machine‑actionable.   == What WADL Actually Is ==  WADL (Web Application Description Language) is an XML-based format for describing RESTful HTT...&quot;</title>
		<link rel="alternate" type="text/html" href="https://knowledgebase.pirho.net/index.php?title=Parsing_WADL_%E2%80%93_From_Specification_to_Opportunity&amp;diff=380&amp;oldid=prev"/>
		<updated>2026-04-06T09:39:07Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;#039;&amp;#039;&amp;#039;Summary:&amp;#039;&amp;#039;&amp;#039;   This article explores the practical journey of turning WADL from a static XML document into a fully executable API contract. It covers DOM parsing, XPointer limitations, method dereferencing, parameter inheritance, multi-pass processing, and the surprising architectural opportunities unlocked once WADL becomes machine‑actionable.   == What WADL Actually Is ==  WADL (Web Application Description Language) is an XML-based format for describing RESTful HTT...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;Summary:&amp;#039;&amp;#039;&amp;#039;  &lt;br /&gt;
This article explores the practical journey of turning WADL from a static XML&lt;br /&gt;
document into a fully executable API contract. It covers DOM parsing, XPointer&lt;br /&gt;
limitations, method dereferencing, parameter inheritance, multi-pass processing,&lt;br /&gt;
and the surprising architectural opportunities unlocked once WADL becomes&lt;br /&gt;
machine‑actionable. &lt;br /&gt;
&lt;br /&gt;
== What WADL Actually Is ==&lt;br /&gt;
&lt;br /&gt;
WADL (Web Application Description Language) is an XML-based format for&lt;br /&gt;
describing RESTful HTTP services.  &lt;br /&gt;
A WADL document typically defines:&lt;br /&gt;
* &amp;lt;resources&amp;gt; and nested &amp;lt;resource&amp;gt; elements  &lt;br /&gt;
* &amp;lt;method&amp;gt; definitions  &lt;br /&gt;
* &amp;lt;request&amp;gt; and &amp;lt;response&amp;gt; blocks  &lt;br /&gt;
* &amp;lt;param&amp;gt; definitions (template, matrix, query, header, plain)  &lt;br /&gt;
* &amp;lt;representation&amp;gt; types  &lt;br /&gt;
* Resource types and method references (via @type and @href)&lt;br /&gt;
&lt;br /&gt;
Although WADL never reached mainstream popularity, it remains one of the most&lt;br /&gt;
structured and precise ways to describe RESTful endpoints. Once parsed&lt;br /&gt;
semantically, it becomes a highly expressive API contract. &lt;br /&gt;
&lt;br /&gt;
== Why Parsing WADL Is Surprisingly Hard ==&lt;br /&gt;
&lt;br /&gt;
WADL appears simple at first glance, but real-world documents introduce deep&lt;br /&gt;
structural complexity:&lt;br /&gt;
* Resources can be deeply nested  &lt;br /&gt;
* Parameters inherit differently depending on style  &lt;br /&gt;
* Methods may reference other methods using @href  &lt;br /&gt;
* Resource types can inject methods into resources  &lt;br /&gt;
* Representations may include &amp;lt;doc&amp;gt;, &amp;lt;param&amp;gt; or even nested &amp;lt;representation&amp;gt;  &lt;br /&gt;
* Faults (error responses) must be merged like any other response  &lt;br /&gt;
* External fragments may be included  &lt;br /&gt;
&lt;br /&gt;
These are not edge cases—they are core WADL features.  &lt;br /&gt;
Handling them correctly requires a full structural model, not just XML parsing. &lt;br /&gt;
&lt;br /&gt;
== XPointer vs DOM: The Early Realisation ==&lt;br /&gt;
&lt;br /&gt;
=== Where XPointer Helps ===&lt;br /&gt;
XPointer gives precise, declarative mappings such as  &lt;br /&gt;
&amp;lt;code&amp;gt;resource/wadl:param[@style=&amp;quot;matrix&amp;quot;]&amp;lt;/code&amp;gt;.  &lt;br /&gt;
It is excellent at:&lt;br /&gt;
* Defining mappings  &lt;br /&gt;
* Providing documentation clarity  &lt;br /&gt;
* Addressing nodes symbolically  &lt;br /&gt;
* Spec-level modelling  &lt;br /&gt;
&lt;br /&gt;
=== Where XPointer Fails ===&lt;br /&gt;
XPointer is &amp;#039;&amp;#039;&amp;#039;not&amp;#039;&amp;#039;&amp;#039; a processing model.  &lt;br /&gt;
It cannot:&lt;br /&gt;
* Walk parents, children, or siblings  &lt;br /&gt;
* Merge inherited context  &lt;br /&gt;
* Split or combine path segments  &lt;br /&gt;
* Build a router or a tree  &lt;br /&gt;
* Resolve includes or fragments  &lt;br /&gt;
* Perform multipass analysis  &lt;br /&gt;
&lt;br /&gt;
It tells you ‘‘what’’ to pick, but never ‘‘how’’ to process it.  &lt;br /&gt;
This is where DOM becomes essential. &lt;br /&gt;
&lt;br /&gt;
=== Why DOM Became the Backbone ===&lt;br /&gt;
&lt;br /&gt;
Parsing WADL as a DOM unlocks:&lt;br /&gt;
* True hierarchical navigation (parents/children/siblings)  &lt;br /&gt;
* Path building (&amp;quot;/Users/{id}&amp;quot;) from nested &amp;lt;resource&amp;gt; nodes  &lt;br /&gt;
* Parameter inheritance by walking upward  &lt;br /&gt;
* Resource-type merging  &lt;br /&gt;
* Multi-pass processing  &lt;br /&gt;
* Safe inclusion of external documents   &lt;br /&gt;
* Accurate debugging with file/line provenance&lt;br /&gt;
&lt;br /&gt;
DOM is mandatory for constructing an accurate execution model.  &lt;br /&gt;
Every mature WADL implementation uses this pattern. &lt;br /&gt;
&lt;br /&gt;
== Designing a Real Parser: A Multi‑Pass Architecture ==&lt;br /&gt;
&lt;br /&gt;
The journey revealed that WADL requires a multi-stage processing pipeline.&lt;br /&gt;
&lt;br /&gt;
=== Pass 1 — Parse WADL → DOM ===&lt;br /&gt;
* Namespace-aware parsing (use localName, not tagName)  &lt;br /&gt;
* Capture every node: resources, methods, params, faults, representations  &lt;br /&gt;
* Resolve &amp;lt;include&amp;gt; fragments  &lt;br /&gt;
* Build the raw tree structure faithfully &lt;br /&gt;
&lt;br /&gt;
=== Pass 2 — Build the Method Registry ===&lt;br /&gt;
* Collect every &amp;lt;method&amp;gt; with an @id  &lt;br /&gt;
* Registry works across application, resource_type, and resource scopes  &lt;br /&gt;
* Provides canonical method definitions for dereferencing  &lt;br /&gt;
* Handles duplicates, cycles, and external references defensively &lt;br /&gt;
&lt;br /&gt;
=== Pass 3 — Dereference @href (Method Linking) ===&lt;br /&gt;
Many WADL documents use:&lt;br /&gt;
&amp;lt;code&amp;gt;#globalGetJson&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dereferencing performs:&lt;br /&gt;
* Lookup → clone canonical method  &lt;br /&gt;
* Merge → overlay local attributes (locals win)  &lt;br /&gt;
* Recursion → resolve chained references (#A → #B → #C)  &lt;br /&gt;
* Cycle detection  &lt;br /&gt;
* Remove @href  &lt;br /&gt;
* Add provenance (_resolvedFrom) &lt;br /&gt;
&lt;br /&gt;
After this pass, all methods are fully materialised.&lt;br /&gt;
&lt;br /&gt;
=== Pass 4 — Parameter Inheritance ===&lt;br /&gt;
&lt;br /&gt;
Only &amp;#039;&amp;#039;&amp;#039;resource-level&amp;#039;&amp;#039;&amp;#039; params inherit.  &lt;br /&gt;
Method/request/representation params remain local.&lt;br /&gt;
&lt;br /&gt;
Two inheritance domains:&lt;br /&gt;
&lt;br /&gt;
; Path-bound  &lt;br /&gt;
: template, matrix  &lt;br /&gt;
&lt;br /&gt;
; Context-bound  &lt;br /&gt;
: query, header  &lt;br /&gt;
&lt;br /&gt;
Rules:&lt;br /&gt;
* Inheritance flows top‑down  &lt;br /&gt;
* Local definitions override inherited ones (by style:name)  &lt;br /&gt;
* Required flags propagate unless locally overridden  &lt;br /&gt;
* Resource-type params merge into the chain  &lt;br /&gt;
* Effective params are stamped onto each resource and method  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Pass 5 — Normalisation &amp;amp; Stable Output ===&lt;br /&gt;
* De-duplicate  &lt;br /&gt;
* Sort keys for deterministic builds  &lt;br /&gt;
* Strip debug fields when not in debug mode  &lt;br /&gt;
* Validate no unresolved @href remain  &lt;br /&gt;
* Validate no cycles or missing refs  &lt;br /&gt;
* Finalise effective parameter sets  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Pass 6 — Emit the Router Model ===&lt;br /&gt;
Once fully resolved, the WADL becomes a runtime construct:&lt;br /&gt;
* A &amp;#039;&amp;#039;&amp;#039;Route Register&amp;#039;&amp;#039;&amp;#039; (flat list of routes)  &lt;br /&gt;
* A &amp;#039;&amp;#039;&amp;#039;Trie&amp;#039;&amp;#039;&amp;#039; (for high-speed matching)  &lt;br /&gt;
* Complete produces[] and consumes[] lists  &lt;br /&gt;
* Required parameter indexes  &lt;br /&gt;
* Handler binding metadata  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This transforms WADL from “XML config” into “router-ready instruction set”.&lt;br /&gt;
&lt;br /&gt;
== Unexpected Lessons Learned ==&lt;br /&gt;
&lt;br /&gt;
Several insights emerged:&lt;br /&gt;
&lt;br /&gt;
* XPointer is for modelling, not execution.  &lt;br /&gt;
* Resource-type inheritance can create multi-layer method injection.  &lt;br /&gt;
* Dereferencing must occur before inheritance.  &lt;br /&gt;
* Only resource-level params inherit; others never bubble up.  &lt;br /&gt;
* Some WADLs use &amp;lt;link&amp;gt; or nested &amp;lt;representation&amp;gt;, requiring flexible parsing.  &lt;br /&gt;
* Faults must be merged predictably with standard responses.  &lt;br /&gt;
* Deterministic output is vital for debugging and CI.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== A Fully-Featured Test WADL ==&lt;br /&gt;
Our comprehensive WADL example included:&lt;br /&gt;
* Global methods (HTML/JSON GET, JSON POST)  &lt;br /&gt;
* Resource types (htmlView, jsonView, editableCollection)  &lt;br /&gt;
* Nested resources (Items → {ItemID} → Versions → {VersionID})  &lt;br /&gt;
* Parameter overrides at every level  &lt;br /&gt;
* Request/response bodies and media types  &lt;br /&gt;
* Fault definitions  &lt;br /&gt;
* Link elements  &lt;br /&gt;
* External @href stub  &lt;br /&gt;
This allowed testing every major WADL feature end‑to‑end. &lt;br /&gt;
&lt;br /&gt;
== What You Gain Once WADL Becomes Executable ==&lt;br /&gt;
&lt;br /&gt;
=== 1. A Complete Machine‑Readable Contract ===&lt;br /&gt;
WADL becomes a canonical, unambiguous API description with:&lt;br /&gt;
* No missing methods  &lt;br /&gt;
* No unresolved references  &lt;br /&gt;
* No ambiguity in inheritance or defaults  &lt;br /&gt;
* All parameters and types fully resolved  &lt;br /&gt;
&lt;br /&gt;
=== 2. Automatic Router Generation ===&lt;br /&gt;
The resolved model directly produces:&lt;br /&gt;
* Path patterns  &lt;br /&gt;
* Trie nodes  &lt;br /&gt;
* Required parameters  &lt;br /&gt;
* Media-type negotiation rules  &lt;br /&gt;
* Handler binding metadata  &lt;br /&gt;
&lt;br /&gt;
=== 3. API Introspection &amp;amp; Documentation ===&lt;br /&gt;
Once WADL is executable, you can automatically derive:&lt;br /&gt;
* Human-readable API documentation  &lt;br /&gt;
* Capability discovery  &lt;br /&gt;
* Linting and contract validation  &lt;br /&gt;
* Regression tests  &lt;br /&gt;
* Contract drift detection  &lt;br /&gt;
&lt;br /&gt;
=== 4. Multi‑Format Output ===&lt;br /&gt;
From the resolved tree, it becomes trivial to generate:&lt;br /&gt;
* OpenAPI  &lt;br /&gt;
* RAML  &lt;br /&gt;
* GraphQL schemas  &lt;br /&gt;
* SDKs  &lt;br /&gt;
* Client libraries  &lt;br /&gt;
* Server stubs  &lt;br /&gt;
* Static documentation sites  &lt;br /&gt;
&lt;br /&gt;
=== 5. Component-Level Integration ===&lt;br /&gt;
In a Component/Neurone ecosystem:&lt;br /&gt;
* Each component declares a WADL  &lt;br /&gt;
* The system integrates capabilities automatically  &lt;br /&gt;
* Routing, validation, and schema handling emerge organically  &lt;br /&gt;
&lt;br /&gt;
== Final Thoughts ==&lt;br /&gt;
WADL is often overlooked, but when paired with:&lt;br /&gt;
* A DOM parser  &lt;br /&gt;
* Multi-pass processing  &lt;br /&gt;
* Dereferencing  &lt;br /&gt;
* Inheritance resolution  &lt;br /&gt;
* A stable, deterministic output model  &lt;br /&gt;
&lt;br /&gt;
…it becomes a powerful and expressive API definition language.  &lt;br /&gt;
This approach yields an API contract that is precise, introspectable, &lt;br /&gt;
automatable, and deeply compatible with modern component-based architectures.&lt;/div&gt;</summary>
		<author><name>Dex</name></author>
	</entry>
</feed>