← Prev in month ← Prev in thread

Updated RelaxNG schema proposal

From
Gabe Wachob <>
Date
2007-10-26T23:29:56+00:00
ID
00f401c81828$14b89a20$6801a8c0@AMSOFTWachob
Thread
Updated RelaxNG schema proposal
Probably should submit these as uploaded documents, but hey,
they are so simple so I’ll just paste them here. One (xrds.rnc)
references the other, so they should be saved as separate files – one for
validating XRDS documents (including nested XRD and XRDS elements) and one for
XRD documents. These will need to be cleaned up slightly even if we find NO
problems (just style and removing some comments, etc). 

 

Everyone (esp Wil) should go through this and check against
documents they are creating, consuming. I use jing and trang (trang to convert
to RNG so that xmllint can be used with the –relaxng option). Jing needs
to be called with the –i option e.g.:

 

java -jar jing-20030619/bin/jing.jar
-i xrd.rng  xrd/extension.xrd

 

You convert the following RNC to RNG (xml form) for use by
xmllint: 

 

java -jar
trang-20030619/trang.jar xrds.rnc xrds.rng

 

xmllint works pretty much out of the box:

 

xmllint --relaxng xrds.rng
xrd/extensions.xrds

 

Tools: 

 
Jing can be found at: http://www.thaiopensource.com/relaxng/jing.html

 
Trang can be found at: http://www.thaiopensource.com/relaxng/trang.html

 
Xmllint (comes with libxml2) is
     usually installed on linux – can be downloaded for many platforms
     here: http://xmlsoft.org/downloads.html

 

            -Gabe

 

 

xrds.rnc:

 

namespace xrds = "xri://$xrds"

namespace xrd =
"xri://$xrd*($v*2.0)"

namespace local = ""

datatypes xs =
"http://www.w3.org/2001/XMLSchema-datatypes"

 

any.element =

  element *  {

    (attribute * { text } *

     | text

     | any.element)*

  }

  

any.external.element =

  element * - (xrd:XRD | xrds:XRDS)  {

    (attribute * { text } *

     | text

     | any.element)*

  }

  

other.attribute = attribute * - (local:*) {text}

 

start = XRDS

 

XRDS= element xrds:XRDS {

    other.attribute *,

    attribute ref { xs:anyURI }?,

    (any.external.element  |
XRDS | external "xrd.rnc" )*

}

 

xrd.rnc

 

default namespace = "xri://$xrd*($v*2.0)"

namespace xrd = "xri://$xrd*($v*2.0)"

namespace saml =
"urn:oasis:names:tc:SAML:2.0:assertion"

namespace ds =
"http://www.w3.org/2000/09/xmldsig#"

namespace local = ""

 

datatypes xs = "http://www.w3.org/2001/XMLSchema-datatypes"

 

start=XRD

 

anyelementbody = 

    (attribute * {text} 

    | text

    | element * {anyelementbody} )* 

    

non.xrd.element = element * - xrd:* { 

    anyelementbody

}

    

other.attribute = attribute * - (local:* | xrd:* )
{text}

 

# XRD Element

# XXX Need to confirm order of the following

XRD=element XRD {

    other.attribute *,

#    attribute xml:id {xs:ID} ?, ##
This isn't neccesary - xml:id always allowed anyway

    attribute
idref {xs:IDREF} ?, 

    attribute
version { "2.0" } ?,

    Query
?,

    ServerStatus ?,

    Status ?,

    Expires ?,

    ProviderID ?,

    (Redirect | Ref) ?,

    LocalID *,

    EquivID *,

    CanonicalID ?,

    CanonicalEquivID ?, 

    Service *,

    element saml:Assertion
{anyelementbody} ?, 

    non.xrd.element *

}

 

Query=element Query {

    other.attribute *, 

    text

}

 

statuspattern = 

    other.attribute *,

    attribute code {xs:integer}, 

    attribute cid {
"absent" | "off" | "verified" |
"failed" } ?,

    attribute ceid {
"absent" | "off" | "verified" |
"failed" } ?,

    text

    

Status=element Status {

    statuspattern

}

 

ServerStatus = element ServerStatus {

    statuspattern

}

 

Expires = element Expires {

    other.attribute *,

    xs:dateTime

}

 

Redirect = element Redirect {

    other.attribute *,

    attribute priority {xs:integer}?,

    xs:anyURI

}

 

 

Ref = element Ref{

    other.attribute *,

    attribute priority {xs:integer}?,

    xs:anyURI

}

 

 

ProviderID = element ProviderID {

    other.attribute *,

    xs:anyURI

}

 

# not specifying pattern for saml:Assertion - maybe
we should? 

 

LocalID = element LocalID {

    other.attribute *,

    attribute priority {xs:integer}
?,

    xs:anyURI

}

 

EquivID = element EquivID {

    other.attribute *,

    attribute priority {xs:integer}
?,

    xs:anyURI

}

 

CanonicalID = element CanonicalID {

    other.attribute *,

    xs:anyURI

}

 

CanonicalEquivID = element CanonicalEquivID {

    other.attribute *,

    xs:anyURI

}

 

Service = element Service {

    other.attribute *,

    attribute priority {xs:integer}?,

    ProviderID?,

    Type *,

    Path *,

    MediaType *,

    (URI+|Redirect+|Ref+)?,

    LocalID *,

    element ds:KeyInfo
{anyelementbody}?,

    non.xrd.element
*

}

 

URI = element URI {

    other.attribute
*,

    attribute priority {xs:integer}?,

    attribute append
{"none" | "local" | "authority" |
"path" | "query" | "qxri"} ?,

    xs:anyURI

}

 

selection.attributes = attribute match
{"any" | "default" | "non-null" |
"null" } ?,

                       
attribute select { xs:boolean} ?

Type = element Type {

    other.attribute *,

    selection.attributes,

    xs:anyURI

}

 

Path = element Path {

    other.attribute *,

    selection.attributes,

    xs:string

}

 

MediaType = element MediaType {

    other.attribute *,

    selection.attributes,

    xs:string

}
← Prev in month ← Prev in thread