[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Harmonising RSS-* and Atom - solving interoperability problems with mode
All, It seems to me that modern schema languages such as RelaxNG and W3C XML schema, have a significant role to play in simplifying data inter-operability and helping us move away from incessant disagreements about data models that plagued the DTD years. As an example of what can be achieved, and as a discussion piece, I have created a schema that allows *all* versions of RSS and the newer Atom notation to all conform to a single, simple schema. I'm convinced that this harmonization will make life a lot easier for syndication tool creators and feed creators alike. I have included Relax NG compact syntax, Relax NG and W3C XML Schema versions. (The is no DTD version because DTDs lack the all important attribute wild carding capability of modern schema languages. A capability that is vital to the power of this technique - especially in the namespace-centric world we live in.) Here is a fragment of RSS 1.0 for example: <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <items> <rdf:Seq><rdf:li rdf:resource="http://localhost:8080/DrRoryOHanlon/000013.html" /> <rdf:li rdf:resource="http://localhost:8080/DrRoryOHanlon/000012.html" /> <rdf:li rdf:resource="http://localhost:8080/DrRoryOHanlon/000004.html" /> <rdf:li rdf:resource="http://localhost:8080/DrRoryOHanlon/000003.html" /> </rdf:Seq> </items> </rdf:RDF> and here is the same document, cross-translated to my interoperability schema: <tag type="rdf:RDF" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <tag type="items"> <tag type="rdf:Seq"><tag type="rdf:li" rdf:resource="http://localhost:8080/foo/000013.html" /> <tag type="rdf:li" rdf:resource="http://localhost:8080/foo/000012.html" /> <tag type="rdf:li" rdf:resource="http://localhost:8080/foo/000004.html" /> <tag type="rdf:li" rdf:resource="http://localhost:8080/foo/000003.html" /> </tag> </tag> </tag> Here is the schema. Comments welcome. -- W3C XML schema -- <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="tag"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" maxOccurs="unbounded" ref="tag"/> </xs:sequence> <xs:anyAttribute processContents="skip"/> </xs:complexType> </xs:element> </xs:schema> -- Relax NG -- <?xml version="1.0" encoding="UTF-8"?> <grammar xmlns="http://relaxng.org/ns/structure/1.0"> <start> <ref name="TAG"/> </start> <define name="TAG"> <element name="tag"> <zeroOrMore> <attribute> <anyName/> </attribute> </zeroOrMore> <zeroOrMore> <ref name="TAG"/> </zeroOrMore> </element> </define> </grammar> -- Relax NG Compact Syntax -- start = TAG TAG = element tag { attribute * { text }*, TAG * } Sean Sean McGrath http://seanmcgrath.blogspot.com
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|