From 2057dc8357b9686197ddb79d7e7b8a641b024410 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 14 Nov 2013 09:16:12 +0200 Subject: Remove schema authoring guide --- documentation/makefile | 2 - documentation/schema-authoring-guide.xhtml | 187 ----------------------------- 2 files changed, 189 deletions(-) delete mode 100644 documentation/schema-authoring-guide.xhtml diff --git a/documentation/makefile b/documentation/makefile index be1824e..ecbb3f4 100644 --- a/documentation/makefile +++ b/documentation/makefile @@ -103,7 +103,6 @@ $(install): $(out_base)/cxx/.install \ $(out_base)/xsd.xhtml \ $(out_base)/xsd.1 $(call install-data,$(src_base)/default.css,$(install_doc_dir)/xsd/default.css) - $(call install-data,$(src_base)/schema-authoring-guide.xhtml,$(install_doc_dir)/xsd/schema-authoring-guide.xhtml) $(call install-data,$(out_base)/xsd.xhtml,$(install_doc_dir)/xsd/xsd.xhtml) $(call install-data,$(src_base)/custom-literals.xsd,$(install_doc_dir)/xsd/custom-literals.xsd) $(call install-data,$(out_base)/xsd.1,$(install_man_dir)/man1/xsd.1) @@ -117,7 +116,6 @@ $(dist-common): $(out_base)/xsd.xhtml \ $(call install-data,$(src_base)/default.css,$(dist_prefix)/documentation/default.css) $(call install-data,$(out_base)/xsd.xhtml,$(dist_prefix)/documentation/xsd.xhtml) $(call install-data,$(out_base)/xsd.1,$(dist_prefix)/documentation/xsd.1) - $(call install-data,$(src_base)/schema-authoring-guide.xhtml,$(dist_prefix)/documentation/schema-authoring-guide.xhtml) $(call install-data,$(src_base)/custom-literals.xsd,$(dist_prefix)/documentation/custom-literals.xsd) $(dist): $(dist-common) $(out_base)/cxx/.dist diff --git a/documentation/schema-authoring-guide.xhtml b/documentation/schema-authoring-guide.xhtml deleted file mode 100644 index 69a8082..0000000 --- a/documentation/schema-authoring-guide.xhtml +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - XML Schema Authoring Guide - - - - - - - - - - - - - -
-
- -

Table of Contents

- - - -

Introduction

- -

Making it possible to cleanly map W3C XML Schema to programming languages - was never a goal of the XML Schema Working Group. As a result there - is a number of Schema constructs, techniques, and styles that don't - have appropriate counterparts in C++. This document presents a list - of do's and don'ts that will help ensure your schemas, when translated - by XSD, result in C++ code that is enjoyable to work with.

- - -

Don't define a global element which is not - a valid document root

- -

Instead of

- -
-<xsd:element name="author" type="Author"/>
-
-<xsd:complexType name="Book">
-  <xsd:sequence>
-    <xsd:element ref="author"/>
-  </xsd:sequence>
-</xsd:complexType>
-  
- -

Write

- -
-<xsd:complexType name="Book">
-  <xsd:sequence>
-    <xsd:element name="author" type="Author"/>
-  </xsd:sequence>
-</xsd:complexType>
-  
- -

Any globally-defined element is a potential document root. For every - such element XSD generates a set of overloaded parsing - functions. If you cannot change your schema, consider using the - --root-element-* options to specify which global - element(s) are actual document root(s).

- - - -

Don't name a type and an element/attribute of - this type with the same name

- -

Instead of

- -
-<xsd:complexType name="name">
-  <xsd:sequence>
-    <xsd:element name="name" type="xsd:string"/>
-  </xsd:sequence>
-  <xsd:attribute name="lang" type="xsd:language"/>
-</xsd:complexType>
-  
- -

Write

- -
-<xsd:complexType name="Name">
-  <xsd:sequence>
-    <xsd:element name="name" type="xsd:string"/>
-  </xsd:sequence>
-  <xsd:attribute name="lang" type="xsd:language"/>
-</xsd:complexType>
-  
- -

Use of a class name as a member function name within this class is - illegal in C++. XSD will resolve such conflicts by renaming - the conflicting member function. In the example above, you will end - up with the following generated code:

- -
-  class name
-  {
-  public:
-    string
-    name1 () const;
-
-    language
-    lang () const;
-
-    ...
-
-  };
-  
- -

Don't use xsd:integer and - friends

- -

XML Schema built-in types integer, - nonPositiveInteger, nonNegativeInteger, - positiveInteger, and negativeInteger - are arbitrary-length integral types. XSD maps them to the - long long and unsigned long long C++ - types. In most cases you would prefer to use either - xsd:int/xsd:unsignedInt (32 bit, maps to C++ - int/unsigned int) or - xsd:long/xsd:unsignedLong (64 bit, maps to C++ - long long/unsigned long long). -

- -

Use xsd:int/xsd:unsignedInt for 32 bit - integers

- -

XML Schema built-in types long and - unsignedLong are 64 bit wide so use 32 bit int - and unsignedInt unless you meant 64 bit.

- -
- - -
- - - - -- cgit v1.1