xupl - ˈsəpəl
Equivalent structure to XML.
Can look like sentences or programming language text.
If you can write XML, you already know xupl.
Reduce the verbosity of XML.
Provide a more natural, readable, less verbose means of manually creating structured documents.
Similar to writing programming language text and leverage existing programming IDEs.
Facilitate creating Domain Specific Languages (DSLs).
Here is a xupl document
note:
to: "Tove"
from: "Jani"
heading: "Reminder"
body: "Don't forget me this weekend!"
For this XML
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
Not only is the xupl less verbose, it's far easier to read. This becomes much more evident when namespaces are used.
note: to: "Tove". from: "Jani". heading: "Reminder". body: "Don't forget me this weekend!".
note {
to {"Tove"}
from {"Jani"}
heading: "Reminder"
body: "Don't forget me this weekend!"
}
This enables tools capable of matching braces.
Attributes are specified as name "value"
or "value" name
.
e.g.
a "/nicerobot/xupl/wiki/xupl" href:"xupl"
and
a href "/nicerobot/xupl/wiki/xupl":"xupl"
and
a href "/nicerobot/xupl/wiki/xupl"{"xupl"}
all produce:
<a href="/nicerobot/xupl/wiki/xupl">xupl</a>
Numeric values, including floats, can omit surrounding quotes.
e.g.
size 100 width, 100 height
produces:
<size width="100" height="100" />
Attribute values can remain unquoted for native types:
numbers
: decimal int, float, base 2,8,10,16,32, and 64 constants- sizes: n
px
nem
n%
URLs
mailto:
#
tags|rgb@
names~
durations^
date!
priority
html:
head{title:"My xupl"}
body:
a "/nicerobot/xupl/wiki/xupl":"xupl"
This example demonstrates a couple points.
- When using
tag:
syntax, EOF will close all open tags. - Certain tags have default attribute names. e.g.
a
tag's default attribute name ishref
.
<html>
<head><title>My xupl</title></head>
<body>
<a href="/nicerobot/xupl/wiki/xupl">xupl</a>
</body>
</html>
A Metal Control (Flickr Query #cat)
control@metal "flickrquery" name {
form@metal http://query.yahooapis.com/v1/public/yql action, "get" method {
input@metal "q" name,
"select * from flickr.photos.search where text='${queryText}' limit 10" value.
input@metal "format" name, "json" value.
input@metal "env" name,
http://datatables.org/alltables.env value
}
control@metal "photo" name, "this.query.results.photo" data {
a "photo-${parent.index}.${index}" id, http://flickr.com/photo.gne?id=${this.id} href {
img "20%" width, "20%" height, src
http://farm${this.farm}.static.flickr.com/${this.server}/${this.id}_${this.secret}.jpg
}
}
}
Produces this Metal Control.
xupl for a Sequence Diagram
sequence{
actors{
user "User"
participant view ":View"
participant controller ":Controller"
participant model ":Model"
}
messages{
user "request()" view
view "handleEvent()" controller
controller "queryInformation()" model
controller "doValidation()" controller
view "updateView()" controller
user "notifyUser()" view
}
}
<sequence>
<actors>
<user id="User"/>
<participant view=":View"/>
<participant controller=":Controller"/>
<participant entity=":Model"/>
</actors>
<messages>
<user view="request()"/>
<view controller="handleEvent()"/>
<controller model="queryInformation()"/>
<controller controller="doValidation()"/>
<view controller="updateView()"/>
<user view="notifyUser()"/>
</messages>
</sequence>
For this XML
<painting>
<img src="madonna.jpg" alt="Foligno Madonna, by Raphael"></img>
<caption>This is Raphael's "Foligno" Madonna, painted in
<date>1511</date>-<date>1512</date>.
</caption>
</painting>
painting:
img "madonna.jpg" src, "Foligno Madonna, by Raphael" alt
caption:
"""This is Raphael's "Foligno" Madonna, painted in """
date: "1511". "-"
date: "1512". "."
For this XML
<?xml version="1.1"?>
<iCalendar xmlns="urn:ietf:params:xml:ns:xcal">
<vcalendar>
<version>2.0</version>
<prodid>-//hacksw/handcal//NONSGML v1.0//EN</prodid>
<vevent>
<dtstart>19970714T170000Z</dtstart>
<dtend>19970715T035959Z</dtend>
<summary xml:lang="en_US">Bastille Day Party</summary>
</vevent>
</vcalendar>
</iCalendar>
?xml "1.1" version.
iCalendar "urn:ietf:params:xml:ns:xcal" xmlns{
vcalendar{
version: "2.0"
prodid: "-//hacksw/handcal//NONSGML v1.0//EN"
vevent{
dtstart: "19970714T170000Z"
dtend: "19970715T035959Z"
summary "en_US" lang/xml: "Bastille Day Party"
}
}
}
<ivy-module version="2.0">
<info organisation="org"
module="standalone"
revision="working"
/>
<dependencies>
<dependency org="apache" name="commons-lang" rev="2.0" conf="default->*"/>
</dependencies>
</ivy-module>
ivy-module version 2.0 {
info "org" organisation, "standalone" module, "working" revision
dependencies {
dependency "apache" org, "commons-lang" name, rev 2.0, "default->*" conf
}
}
<xsl:stylesheet version="2.0"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="*">
[<xsl:value-of select="." />]
</xsl:template>
</xsl:stylesheet>
stylesheet/xsl 2.0 version,
"http://www.w3.org/1999/xhtml" xhtml@xmlns,
"http://www.w3.org/1999/XSL/Transform" xsl@xmlns
{
template/xsl match "*": "[" value-of/xsl select ".". "]"
}
<![CDATA[<greeting>Hello, world!</greeting>]]>
'["<greeting>Hello, world!</greeting>"]
<!-- declarations for <head> & <body> -->
Multi-line comment
/* declarations for <head> & <body> */
Single-line comment
// declarations for <head> & <body>
<?xml version="1.1"?>
<greeting>Hello, world!</greeting>
?xml "1.1" version.
greeting: "Hello, world!"
Anything not directly supported above can be included verbatim with #|"""..."""
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
!!!plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"!!!
<?xml version="1.1" encoding="UTF-8" ?>
<!DOCTYPE greeting [
<!ELEMENT greeting (#PCDATA)>
]>
<greeting>Hello, world!</greeting>
?xml with "1.1" version, and "UTF-8" encoding
!!!greeting [
<!ELEMENT greeting (#PCDATA)>
]>!!!
greeting: "Hello, world!"