- From: Boris Kolpackov <boris@codesynthesis.com>
- Date: Mon, 14 Jul 2008 09:05:18 +0200
- To: Mark Hansen <mark@agileitinc.com>
- Cc: xmlschema-dev@w3.org
Hi Mark, Mark Hansen <mark@agileitinc.com> writes: > > Is there a standard syntax for generating references to anonymous > types? I know that XML Schema 1.0 does not provide such a standard. > Will there be one in XML Schema 1.1 - or in some other, related, > standard? I don't think so. An anonymous type is used when the schema author believes that it won't be used anywhere else so there is no point in providing a reference mechanism. If the type is used in more that one place then it should be named. > If the answer is "No", can anyone provide a link to a proprietary > schema type naming syntax that is commonly used? The validating > parsers, like Xerces, must use some internal mechanism to generate > names. I don't think it is a requirement for an implementation to use some generated names for anonymous types though I know Xerces-C++ does that. The naming scheme would normally depend on whether the name is user-visible or not. If it's not then any name that is guaranteed to be unique (e.g., UUID) will do. If the name is expected to be used by the user then you would want to assign some meaningful names to anonymous types. Here is what we do in CodeSynthesis XSD: 1. Use the name of enclosing element/attribute. 2. If it conflicts with existing global types, escape it (e.g., Person1, Person2). 3. Provide a regex-based mechanism for the user to transform anonymous type names. For example, the user can add the 'Type' suffix to anonymous type names (e.g., PersonType). We have a separate pass over the schema graph that morphs all anonymous types into named ones. This way our backends don't have to worry about anonymous types. Boris -- Boris Kolpackov, Code Synthesis Tools http://codesynthesis.com/~boris/blog Open source XML data binding for C++: http://codesynthesis.com/products/xsd Mobile/embedded validating XML parsing: http://codesynthesis.com/products/xsde
Received on Monday, 14 July 2008 07:10:16 UTC