1、INCITS/ISO/IEC 19757-2:2003/Amd.1:20062008 (ISO/IEC 19757-2:2003/Amd.1:2006, IDT) Information technology Document Schema DefinitionLanguage (DSDL) Part 2: Regular-grammar-based validation RELAX NG,Amendment 1: Compact SyntaxINCITS/ISO/IEC 19757-2:2003/Amd.1:20062008(ISO/IEC 19757-2:2003/Amd.1:2006,
2、IDT)INCITS/ISO/IEC 19757-2:2003/Amd.1:20062008 ii ITIC 2008 All rights reserved PDF disclaimer This PDF file may contain embedded typefaces. In accordance with Adobes licensing policy, this file may be printed or viewed but shall not be edited unless the typefaces which are embedded are licensed to
3、and installed on the computer performing the editing. In downloading this file, parties accept therein the responsibility of not infringing Adobes licensing policy. The ISO Central Secretariat accepts no liability in this area. Adobe is a trademark of Adobe Systems Incorporated. Details of the softw
4、are products used to create this PDF file can be found in the General Info relative to the file; the PDF-creation parameters were optimized for printing. Every care has been taken to ensure that the file is suitable for use by ISO member bodies. In the unlikely event that a problem relating to it is
5、 found, please inform the Central Secretariat at the address given below. Adopted by INCITS (InterNational Committee for Information Technology Standards) as an American National Standard. Date of ANSI Approval: 7/1/2008 Published by American National Standards Institute, 25 West 43rd Street, New Yo
6、rk, New York 10036 Copyright 2008 by Information Technology Industry Council (ITI). All rights reserved. These materials are subject to copyright claims of International Standardization Organization (ISO), International Electrotechnical Commission (IEC), American National Standards Institute (ANSI),
7、 and Information Technology Industry Council (ITI). Not for resale. No part of this publication may be reproduced in any form, including an electronic retrieval system, without the prior written permission of ITI. All requests pertaining to this standard should be submitted to ITI, 1250 Eye Street N
8、W, Washington, DC 20005. Printed in the United States of America INCITS/ISO/IEC 19757-2:2003/Amd.1:20062008 ITIC 2008 All rights reserved iiiForeword ISO (the International Organization for Standardization) and IEC (the International Electrotechnical Commission) form the specialized system for world
9、wide standardization. National bodies that are members of ISO or IEC participate in the development of International Standards through technical committees established by the respective organization to deal with particular fields of technical activity. ISO and IEC technical committees collaborate in
10、 fields of mutual interest. Other international organizations, governmental and non-governmental, in liaison with ISO and IEC, also take part in the work. In the field of information technology, ISO and IEC have established a joint technical committee, ISO/IEC JTC 1. International Standards are draf
11、ted in accordance with the rules given in the ISO/IEC Directives, Part 2. The main task of the joint technical committee is to prepare International Standards. Draft International Standards adopted by the joint technical committee are circulated to national bodies for voting. Publication as an Inter
12、national Standard requires approval by at least 75 % of the national bodies casting a vote. Attention is drawn to the possibility that some of the elements of this document may be the subject of patent rights. ISO and IEC shall not be held responsible for identifying any or all such patent rights. A
13、mendment 1 to ISO/IEC 19757-2:2003 was prepared by Joint Technical Committee ISO/IEC JTC 1, Information technology, Subcommittee SC 34, Document description and processing languages. 1Information technology Document Schema Definition Language (DSDL) Part 2: Regular-grammar-based validation RELAX NG
14、AMENDMENT 1: Compact Syntax Page 8, Clause 5Add the following sentence at the end of Clause 5:An alternative compact syntax is described in Annex C.Page 34Add Annex C before the Bibliography.Annex C(normative)RELAX NG Compact SyntaxC.1 IntroductionThis Annex describes a compact, non-XML syntax for R
15、ELAX NG.The goals of the compact syntax are to: maximize readability support all features of RELAX NG; it must be possible to translate a schema from the XML syntax to the compactsyntax and back without losing significant information support separate translation; a RELAX NG schema may be spread amon
16、gst multiple files; it must be possible torepresent each of the files separately in the compact syntax; the representation of each file must not depend onthe other filesC.2 SyntaxThe following is a summary of the syntax in EBNF. Square brackets are used to indicate optionality. The start symbolis to
17、pLevel. ITIC 2008 All rights reserved INCITS/ISO/IEC 19757-2:2003/Amd.1:200620082 topLevel :=decl* (pattern | grammarContent*)decl :=(“namespace“ identifierOrKeyword “=“ namespaceURILiteral)| (“default“ “namespace“ identifierOrKeyword “=“ namespaceURILiteral)| (“datatypes“ identifierOrKeyword “=“ li
18、teral)pattern :=(“element“ nameClass “ pattern “)| (“attribute“ nameClass “ pattern “)| (pattern (“,“ pattern)+)| (pattern (“ instead, either (foo | bar),baz or foo | (bar, baz) must be used. A similar restriction applies to name classes and the use of the | and - operators.These restrictions are no
19、t expressed in the above EBNF.The value of an anyURILiteral specified with include or external is a URI reference to a grammar in the compactsyntax.C.3 Lexical structureWhitespace is allowed between tokens. Tokens are the strings occurring in double quotes in the EBNF in C.2, exceptthat literalSegme
20、nt, nsName, CName, identifier and quotedIdentifer are single tokens.Comments are also allowed between tokens. Comments start with a # and continue to the end of the line. Commentsstarting with # are treated specially; see C.5.A Unicode character with hex code N can be represented by the escape seque
21、nce xN. Using such an escapesequence is completely equivalent to the entering the corresponding character directly. For example,element x66x6fx6f empty is equivalent toelement foo empty ITIC 2008 All rights reserved INCITS/ISO/IEC 19757-2:2003/Amd.1:20062008 5C.4 DeclarationsA datatypes declaration
22、declares a prefix used in a QName identifying a datatype. For example,datatypes xsd = “http:/www.w3.org/2001/XMLSchema-datatypes“element height xsd:double In fact, in the above example, the datatypes declaration is not required: the xsd prefix is predeclared to the aboveURI.A namespace declaration d
23、eclares a prefix used in a QName specifying the name of an element or attribute. Forexample,namespace rng = “http:/relaxng.org/ns/structure/1.0“element rng:text empty As in XML, the xml prefix is predeclared.A default namespace declaration declares the namespace used for unprefixed names specifying
24、the name of anelement (but not of an attribute). For example,default namespace = “http:/“element foo attribute bar string is equivalent tonamespace ex = “http:/“element ex:foo attribute bar string A default namespace declaration may have a prefix as well. For example,default namespace ex = “http:/“i
25、s equivalent todefault namespace = “http:/“namespace ex = “http:/“The URI may be empty. This makes the prefix stand for the absent namespace URI. This is necessary for specifyinga name class that matches any name with an absent namespace URI. For example,namespace local = “element foo attribute * -
26、local:* string * is equivalent to ITIC 2008 All rights reserved INCITS/ISO/IEC 19757-2:2003/Amd.1:20062008 6 RELAX NG has the feature that if a file does not specify an ns attribute then the ns attribute can be inherited from theincluding file. To support this feature, the keyword inherit can be spe
27、cified in place of the namespace URI in anamespace declaration. For example,default namespace this = inheritelement foo element * - this:* string * is equivalent toIn addition, the include and external patterns can specify inherit = prefix to specify the namespace to be inherited bythe referenced fi
28、le. For example,namespace x = “http:/“external “foo.rng“ inherit = xis equivalent toIn the absence of an inherit parameter on include or external, the default namespace will be inherited by the referencedfile.In the absence of a default namespace declaration, a declaration ofdefault namespace = inhe
29、ritis assumed.C.5 AnnotationsC.5.1 Support for annotationsThe RELAX NG XML syntax allows foreign elements and attributes to be used to annotate a RELAX NG schema.A schema in the compact syntax can also have annotations, which will turn into foreign elements and attributes whenthe schema is translate
30、d into XML syntax. The way these annotations are specified depends on where the foreignelements and attributes are to appear in the translated schema. There is also a special shorthand syntax when theforeign element is a documentation element. ITIC 2008 All rights reserved INCITS/ISO/IEC 19757-2:200
31、3/Amd.1:20062008 7C.5.2 Initial annotationsAn annotation in square brackets can be inserted immediately before a pattern, param, nameClass, grammarContentor includeContent. It has the following syntax:annotation :=“ annotationAttribute* annotationElement* “annotationAttribute :=name “=“ literalannot
32、ationElement :=name “ annotationAttribute* (annotationElement | literal)* “Each of the annotationAttributes will turn into attributes on the corresponding RELAX NG element. Each of theannotationElements will turn into initial children of the corresponding RELAX NG element, except in the case whereth
33、e RELAX NG element cannot have children, in which case they will turn into following elements.C.5.3 Documentation shorthandComments starting with # are used to specify documentation elements from the http:/relaxng.org/ns/compatibility/annotations/1.0 namespace. For example,# Represents a languageele
34、ment lang # English“en“ |# Japanese“jp“turns intoRepresents a languageenEnglishjpJapanese# comments can only be used immediately before a pattern, nameClass, grammarContent or includeContent. Multiple# comments are allowed. Multiple adjacent # comments without any intervening blank lines are merged
35、into a singledocumentation element. Any # comments must precede any annotation in square brackets.C.5.4 Following annotationsA pattern or nameClass may be followed by any number of followAnnotations with the following syntax:followAnnotation :=“ annotationElementEach such annotationElement turns int
36、o a following sibling of the RELAX NG element representing the pattern ornameClass. ITIC 2008 All rights reserved INCITS/ISO/IEC 19757-2:2003/Amd.1:20062008 8 C.5.5 Grammar annotationsAn annotationElement may be used in any place where grammarContent or includeContent is allowed. For example,namespa
37、ce x = “http:/“start = foox:entity name=“picture“ systemId=“picture.jpeg“ notation=“jpeg“ foo = element foo empty turns intoIf the name of such an element is a keyword, then it must be quoted with .C.6 ConformanceC.6.1 Types of conformanceThere are three types of conformant implementation of the com
38、pact syntax.C.6.2 ValidatorA validator conforming to this specification must be able to determine whether a textual object is a correct RELAXNG Compact Syntax schema as specified in this Annex. It must also be able to determine for any XML document andfor any correct RELAX NG Compact Syntax schema w
39、hether the document is valid (as defined in Clause 9) withrespect to the translation of the schema into XML syntax. It need not be able to output a representation of the translationof the schema into XML syntax.The requirements in the preceding paragraph are subject to the provisions of the second p
40、aragraph of Clause 11.C.6.3 Structure preserving translatorA structure preserving translator must be able to translate any correct RELAX NG Compact Syntax schema into anXML document whose data model is strictly equivalent to the translation specified in this Annex. For this purpose,two instances of
41、the data model (as specified in Clause 5) are considered strictly equivalent if they are identical afterapplying the simplifications specified in Sections 7.2, 7.3, 7.4, 7.8, 7.9 and 7.10, with the exception that the base URIin the context of elements may differ.NOTE 1: The RELAX NG compact syntax i
42、s not a representation of the XML syntax of a RELAX NG schema; rather it is arepresentation of the semantics of a RELAX NG schema. Details of the XML syntax that were judged to be insignificantare not captured in the compact syntax. For example, in the XML syntax if the name class for an element or
43、attributepattern consists of just a single name, it can be expressed either as a name attribute or as a name element; however,in the compact syntax, there is only one way to express such a name class. The simplifications listed in the previousparagraph correspond to those syntactic details that are
44、not captured in the compact syntax.When comparing two include or externalRef patterns in the XML source for strict equivalence, the value of the hrefattributes are not compared; instead the referenced XML documents are compared for strict equivalence. ITIC 2008 All rights reserved INCITS/ISO/IEC 197
45、57-2:2003/Amd.1:20062008 9C.6.4 Non-structure preserving translatorA non-structure preserving translator must be able to translate any correct RELAX NG Compact Syntax schema intoan XML document whose data model is loosely equivalent to the translation specified in this Annex. For this purpose,two in
46、stances of the data model (as specified in Clause 5) are considered loosely equivalent if they are such that,after applying all the simplifications specified in Section 7 of this part of ISO/IEC 19757, one can be transformed intothe other merely by reordering and renaming definitions. After the simp
47、lifications have been applied, the context ofelements is ignored when comparing the two instances.NOTE 2: A validator for the compact syntax can be implemented as a combination of a non-structure preserving translator forthe compact syntax and a validator for the XML syntax.C.7 Media type registrati
48、on template for the RELAX NG Compact SyntaxThis registration template is being reviewed by the IESG.MIME media type name: applicationMIME subtype name: relax-ng-compact-syntaxRequired parameters: noneOptional parameters: noneEncoding considerations: UTF-8 or UTF-16 shall be used for this media type.
49、Security considerations: When the RELAX NG validator retrieves a schema in the RELAX NG compact syntax, it may further retrieve external schemas that are referenced from the schema directly or indirectly. Although the RELAX NG validator is required not to retrieve an infinite number of schemas, a large number of external schemas may be retrieved,
copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
备案/许可证编号:苏ICP备17064731号-1