Skip to content

Instantly share code, notes, and snippets.

@bogn
Last active December 11, 2015 13:38
Show Gist options
  • Save bogn/4608234 to your computer and use it in GitHub Desktop.
Save bogn/4608234 to your computer and use it in GitHub Desktop.
example.xml is the desired output, but the schema has to repeat the locales for the anyURI variant. Is there any alternative to repeating them?
<?xml version="1.0" encoding="UTF-8"?>
<application>
<title>
<text xml:lang="de"><![CDATA[]]></text>
<text xml:lang="en"><![CDATA[]]></text>
<text xml:lang="fr"><![CDATA[]]></text>
</title>
<picture>
<uri xml:lang="de">file://example1.jpg</uri>
<uri xml:lang="en">file://example2.jpg</uri>
<uri xml:lang="fr">file://example3.jpg</uri>
</picture>
</application>
namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
namespace xml = "http://www.w3.org/XML/1998/namespace"
namespace xsd = "http://www.w3.org/2001/XMLSchema-datatypes"
start =
element application {
element title { _text },
element picture { _uri },
}
_text =
element text {
attribute xml:lang { 'de' },
xsd:string
},
element text {
attribute xml:lang { 'en' },
xsd:string
},
element text {
attribute xml:lang { 'fr' },
xsd:string
}
_uri =
element uri {
attribute xml:lang { 'de' },
xsd:anyURI
},
element uri {
attribute xml:lang { 'en' },
xsd:anyURI
},
element uri {
attribute xml:lang { 'fr' },
xsd:anyURI
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment