XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] Micro XSD for Micro XML?

I think you're mixing several things here, and that makes the exercise 
confusing. I would start by trying to define an XML 1.0 syntax for a 
subset of XSD that can be used to describe XML 1.0 documents, namespaces 
and all.

I think you've thrown out some babies with the bathwater. I think you 
need simple types including restrictions with facets, you need 
mixed="true|false", and you need complex-types-with-simple-content - 
though if we could avoid calling them that, we would be doing the world 
a favour! You also need to define optionality/repeatability for elements 
and attributes, and you need wildcards or open content.

There are some strange things in your grammar: an empty choice, a 
singleton choice. So it's not always clear what you're trying to say.

(Iit depends on your objectives of course. If you're just trying to 
reproduce the validation that's possible with DTDs, then it's true you 
don't need all the above - though you do still need enumeration types 
for attributes. But I've never seen any point in carefully defining a 
grammar for the markup, and saying nothing about the content.)

Michael Kay
Saxonica

On 21/12/2010 12:05, Stephen Green wrote:
> Perhaps the idea is still unpopular but I've experimented some more with a
> minimalistic 'Micro XSD' for MicroXML and come up with two possibilities.
>
> The first is as useful a subset of XSD I could produce which can pretty much
> be defined using itself (might not be error-free):
>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
> 	<xs:element name="schema">
> 		<xs:complexType>
> 			<xs:group ref="general_group" minOccurs="0" maxOccurs="unbounded"/>
> 		</xs:complexType>
> 	</xs:element>
> 	<xs:element name="element">
> 		<xs:complexType>
> 			<xs:group ref="element_group" minOccurs="0" maxOccurs="unbounded"/>
> 			<xs:attribute name="ref" type="xs:string"/>
> 			<xs:attribute name="name" type="xs:string"/>
> 			<xs:attribute name="type" type="xs:string"/>
> 		</xs:complexType>
> 	</xs:element>
> 	<xs:element name="attribute">
> 		<xs:complexType>
> 			<xs:group ref="attribute_group" minOccurs="0" maxOccurs="unbounded"/>
> 			<xs:attribute name="name" type="xs:string"/>
> 			<xs:attribute name="type" type="xs:string"/>
> 		</xs:complexType>
> 	</xs:element>
> 	<xs:element name="choice">
> 		<xs:complexType>
> 			<xs:group ref="choice_group" minOccurs="0" maxOccurs="unbounded"/>
> 		</xs:complexType>
> 	</xs:element>
> 	<xs:element name="group">
> 		<xs:complexType>
> 			<xs:group ref="group_group" minOccurs="0" maxOccurs="unbounded"/>
> 			<xs:attribute name="ref" type="xs:string"/>
> 			<xs:attribute name="name" type="xs:string"/>
> 		</xs:complexType>
> 	</xs:element>
> 	<xs:group name="general_group">
> 		<xs:choice>
> 			<xs:element ref="element"/>
> 			<xs:element ref="group"/>
> 		</xs:choice>
> 	</xs:group>
> 	<xs:group name="element_group">
> 		<xs:choice>
> 			<xs:element name="complexType">
> 				<xs:complexType>
> 					<xs:group ref="complexType_group" minOccurs="0" maxOccurs="unbounded"/>
> 				</xs:complexType>
> 			</xs:element>
> 		</xs:choice>
> 	</xs:group>
> 	<xs:group name="attribute_group">
> 		<xs:choice/>
> 	</xs:group>
> 	<xs:group name="group_group">
> 		<xs:choice>
> 			<xs:element ref="choice"/>
> 		</xs:choice>
> 	</xs:group>
> 	<xs:group name="choice_group">
> 		<xs:choice>
> 			<xs:element ref="element"/>
> 			<xs:element ref="group"/>
> 		</xs:choice>
> 	</xs:group>
> 	<xs:group name="complexType_group">
> 		<xs:choice>
> 			<xs:element ref="attribute"/>
> 			<xs:element ref="group"/>
> 		</xs:choice>
> 	</xs:group>
> </xs:schema>
>
> But this still has a namespace/prefix.
>
> The second tries to do the above while keeping it to what I think
> we so far understand as MicroXML by removing the namespace
> prefix while keeping the 'xmlns' attribute (pointing it at the XSD
> namespace as a kind of namespace hint).
>
> <schema xmlns="http://www.w3.org/2001/XMLSchema";>
> 	<element name="schema">
> 		<complexType>
> 			<group ref="general_group" minOccurs="0" maxOccurs="unbounded"/>
> 		</complexType>
> 	</element>
> 	<element name="element">
> 		<complexType>
> 			<group ref="element_group" minOccurs="0" maxOccurs="unbounded"/>
> 			<attribute name="ref" type="string"/>
> 			<attribute name="name" type="string"/>
> 			<attribute name="type" type="string"/>
> 		</complexType>
> 	</element>
> 	<element name="attribute">
> 		<complexType>
> 			<group ref="attribute_group" minOccurs="0" maxOccurs="unbounded"/>
> 			<attribute name="name" type="string"/>
> 			<attribute name="type" type="string"/>
> 		</complexType>
> 	</element>
> 	<element name="choice">
> 		<complexType>
> 			<group ref="choice_group" minOccurs="0" maxOccurs="unbounded"/>
> 		</complexType>
> 	</element>
> 	<element name="group">
> 		<complexType>
> 			<group ref="group_group" minOccurs="0" maxOccurs="unbounded"/>
> 			<attribute name="ref" type="string"/>
> 			<attribute name="name" type="string"/>
> 		</complexType>
> 	</element>
> 	<group name="general_group">
> 		<choice>
> 			<element ref="element"/>
> 			<element ref="group"/>
> 		</choice>
> 	</group>
> 	<group name="element_group">
> 		<choice>
> 			<element name="complexType">
> 				<complexType>
> 					<group ref="complexType_group" minOccurs="0" maxOccurs="unbounded"/>
> 				</complexType>
> 			</element>
> 		</choice>
> 	</group>
> 	<group name="attribute_group">
> 		<choice/>
> 	</group>
> 	<group name="group_group">
> 		<choice>
> 			<element ref="choice"/>
> 		</choice>
> 	</group>
> 	<group name="choice_group">
> 		<choice>
> 			<element ref="element"/>
> 			<element ref="group"/>
> 		</choice>
> 	</group>
> 	<group name="complexType_group">
> 		<choice>
> 			<element ref="attribute"/>
> 			<element ref="group"/>
> 		</choice>
> 	</group>
> </schema>
>
>
> I note that this does seem to break things in that an older XML editor
> won't accept it.
> The first XML Schema does at least work in an XML Editor while the
> second is deemed
> to be invalid XML and will not save. Is that correct? Does the way I'm
> trying to implement
> MicroXML (as it stands today) break XML compatibility?
>
> Regards
>
> ----
> Stephen D Green
>
>
>
> On 17 December 2010 20:39, Stephen Green<stephengreenubl@gmail.com>  wrote:
>> I agree that people might want a non-XML syntax for
>> merely defining their Micro-markup but if there is going
>> to be any validation in the Micro-parser I'd reckon they
>> wouldn't want to go to the trouble of implementing two
>> syntaxes (they will just have implemented MicroXML)
>> - unless the schema syntax is incredibly simple or
>> exists already (like JSON perhaps :-)
>>
>> I did some more rough work on a reduced 'XSD-like'
>> language (defined using its own schema language)
>> which could probably be mapped to XSD, to compact
>> relaxN, etc
>>
>> <schema name="MicroSchema-draft" version="draft2">
>>         <element name="schema">
>>                 <group>
>>                         <element ref="element" maxOccurs="unbounded" />
>>                         <element ref="group" maxOccurs="unbounded">
>>                 </group>
>>                 <attribute name="name" type="string" />
>>                 <attribute name="version" type="string" />
>>         </element>
>>         <element name="element">
>>                 <group maxOccurs="unbounded">
>>                         <element ref="element" />
>>                         <element ref="group" />
>>                 </group>
>>                 <attribute name="ref" type="string" />
>>                 <attribute name="name" type="string" />
>>                 <attribute name="type" type="string">
>>                         <!-- enumeration = string | integer | decimal | date | sequence -->
>>                 </attribute>
>>         </element>
>>         <element name="attribute">
>>                 <attribute name="ref" type="string" />
>>                 <attribute name="name" type="string" />
>>                 <attribute name="type" type="string">
>>                         <!-- enumeration = string | integer | decimal | date | sequence -->
>>                 </attribute>
>>         </element>
>> </schema>
>>
>>
>>
>>
>> ----
>> Stephen D Green
>>
>>
>>
> _______________________________________________________________________
>
> XML-DEV is a publicly archived, unmoderated list hosted by OASIS
> to support XML implementation and development. To minimize
> spam in the archives, you must subscribe before posting.
>
> [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
> Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
> subscribe: xml-dev-subscribe@lists.xml.org
> List archive: http://lists.xml.org/archives/xml-dev/
> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
>
>



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS