diff --git a/ChangeLog b/ChangeLog index 02075e73..0de0634f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Mon Oct 11 14:31:58 CEST 1999 Daniel Veillard + + * HTMLparser.c: fixed problems with some autoclose tags + * tree.c: fixed XML output problems. + * result/* SAXresult/*: update of the tests output + Sat Oct 9 11:02:57 CEST 1999 Daniel Veillard * Makefile.am: Arturo patch for xmlConf.sh version info diff --git a/HTMLparser.c b/HTMLparser.c index 6df21722..3c274732 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -334,13 +334,13 @@ char *htmlStartClose[] = { "TABLE", "P", "HEAD", "H1", "H2", "H3", "H4", "H5", "H6", "PRE", "LISTING", "XMP", "A", NULL, "TH", "TH", "TD", NULL, -"TD", "TH", "TD", NULL, -"TR", "TH", "TD", "TR", "CAPTION", "COL", "COLGROUP", NULL, +"TD", "TH", "TD", "P", NULL, +"TR", "TH", "TD", "TR", "CAPTION", "COL", "COLGROUP", "P", NULL, "THEAD", "CAPTION", "COL", "COLGROUP", NULL, "TFOOT", "TH", "TD", "TR", "CAPTION", "COL", "COLGROUP", "THEAD", - "TBODY", NULL, + "TBODY", "P", NULL, "TBODY", "TH", "TD", "TR", "CAPTION", "COL", "COLGROUP", "THEAD", - "TFOOT", "TBODY", NULL, + "TFOOT", "TBODY", "P", NULL, "OPTGROUP", "OPTION", NULL, "FIELDSET", "LEGEND", "P", "HEAD", "H1", "H2", "H3", "H4", "H5", "H6", "PRE", "LISTING", "XMP", "A", NULL, @@ -2245,7 +2245,7 @@ htmlParseElement(htmlParserCtxtPtr ctxt) { const xmlChar *openTag = CUR_PTR; xmlChar *name; xmlChar *oldname; - xmlChar *currentNode; + xmlChar *currentNode = NULL; htmlElemDescPtr info; htmlParserNodeInfo node_info; diff --git a/SAXresult/dtd1 b/SAXresult/dtd1 index 5f8cf03e..f7f21270 100644 --- a/SAXresult/dtd1 +++ b/SAXresult/dtd1 @@ -1,7 +1,6 @@ SAX.setDocumentLocator() SAX.startDocument() SAX.internalSubset(MEMO, -//SGMLSOURCE//DTD MEMO//EN, http://www.sgmlsource.com/dtds/memo.dtd) -SAX.resolveEntity(-//SGMLSOURCE//DTD MEMO//EN, http://www.sgmlsource.com/dtds/memo.dtd) SAX.startElement(MEMO) SAX.characters( , 1) diff --git a/SAXresult/ent1 b/SAXresult/ent1 index b3afa2ac..5198d428 100644 --- a/SAXresult/ent1 +++ b/SAXresult/ent1 @@ -1,17 +1,13 @@ SAX.setDocumentLocator() SAX.startDocument() SAX.internalSubset(EXAMPLE, (null), example.dtd) -SAX.resolveEntity( , example.dtd) SAX.entityDecl(xml, 1, (null), (null), Extensible Markup Language) SAX.getEntity(xml) SAX.startElement(EXAMPLE) SAX.characters( , 5) SAX.getEntity(xml) -SAX.isStandalone() -SAX.hasInternalSubset() -SAX.hasExternalSubset() -SAX.error: Entity 'xml' not defined +SAX.warning: Entity 'xml' not defined SAX.characters( , 1) SAX.endElement(EXAMPLE) diff --git a/SAXresult/ent2 b/SAXresult/ent2 index a5598850..28712443 100644 --- a/SAXresult/ent2 +++ b/SAXresult/ent2 @@ -1,26 +1,19 @@ SAX.setDocumentLocator() SAX.startDocument() SAX.internalSubset(EXAMPLE, (null), example.dtd) -SAX.resolveEntity( , example.dtd) SAX.entityDecl(xml, 1, (null), (null), Extensible Markup Language) SAX.getEntity(xml) SAX.entityDecl(title, 2, -//MY-TITLE//FR, title.xml, (null)) -SAX.entityDecl(image, 3, (null), img.gif, GIF) +SAX.unparsedEntityDecl(image, (null), img.gif, GIF) SAX.startElement(EXAMPLE) SAX.characters( , 3) SAX.getEntity(title) -SAX.isStandalone() -SAX.hasInternalSubset() -SAX.hasExternalSubset() -SAX.error: Entity 'title' not defined +SAX.warning: Entity 'title' not defined SAX.characters( This text is about XML, the, 31) SAX.getEntity(xml) -SAX.isStandalone() -SAX.hasInternalSubset() -SAX.hasExternalSubset() -SAX.error: Entity 'xml' not defined +SAX.warning: Entity 'xml' not defined SAX.characters( and this is an embedded , 25) SAX.startElement(IMG, src='image') SAX.endElement(IMG) diff --git a/SAXresult/ent3 b/SAXresult/ent3 index 8bf06895..f40273b6 100644 --- a/SAXresult/ent3 +++ b/SAXresult/ent3 @@ -1,10 +1,12 @@ SAX.setDocumentLocator() SAX.startDocument() SAX.internalSubset(EXAMPLE, (null), example.dtd) -SAX.resolveEntity( , example.dtd) SAX.entityDecl(xml, 1, (null), (null), Extensible Markup Language) SAX.getEntity(xml) -SAX.startElement(EXAMPLE, prop1='a&b', prop2='&xml;') +SAX.getEntity(amp) +SAX.getEntity(xml) +SAX.warning: Entity 'xml' not defined +SAX.startElement(EXAMPLE, prop1='a&b', prop2='') SAX.characters( Test of entities in attribu, 35) SAX.endElement(EXAMPLE) diff --git a/SAXresult/ent4 b/SAXresult/ent4 index a956632a..a6a7b4b3 100644 --- a/SAXresult/ent4 +++ b/SAXresult/ent4 @@ -1,7 +1,6 @@ SAX.setDocumentLocator() SAX.startDocument() SAX.internalSubset(EXAMPLE, (null), example.dtd) -SAX.resolveEntity( , example.dtd) SAX.entityDecl(xml, 1, (null), (null), Extensible Markup Language) SAX.getEntity(xml) SAX.startElement(EXAMPLE) diff --git a/SAXresult/ent5 b/SAXresult/ent5 index 318447f1..6f588579 100644 --- a/SAXresult/ent5 +++ b/SAXresult/ent5 @@ -2,12 +2,6 @@ SAX.setDocumentLocator() SAX.startDocument() SAX.startElement(EXAMPLE) SAX.characters( - This is an inverted excla, 42) -SAX.characters(¡, 1) -SAX.characters( - This is a space , 21) -SAX.characters( , 1) -SAX.characters( -, 2) + This is an inverted excla, 67) SAX.endElement(EXAMPLE) SAX.endDocument() diff --git a/SAXresult/p3p b/SAXresult/p3p index 5079c254..ff1b543f 100644 --- a/SAXresult/p3p +++ b/SAXresult/p3p @@ -41,6 +41,7 @@ SAX.characters( SAX.startElement(USES) SAX.characters( , 3) +SAX.getEntity(amp) SAX.startElement(STATEMENT, action='read&write', purp='0', recpnt='0', id='1') SAX.characters( , 5) diff --git a/SAXresult/rdf2 b/SAXresult/rdf2 index 076cc8ff..395be822 100644 --- a/SAXresult/rdf2 +++ b/SAXresult/rdf2 @@ -68,21 +68,13 @@ SAX.endElement(RPM:Summary) SAX.characters( , 5) SAX.startElement(RPM:Description) -SAX.characters(Diese Library stellt dem Progr, 57) -SAX.characters(ä, 1) -SAX.characters(ngige -Routinen zur Ansteuerung, 57) -SAX.characters(ü, 1) -SAX.characters(gung, die -speziell optimiert s, 57) +SAX.characters(Diese Library stellt dem Progr, 173) SAX.getEntity(apos) SAX.characters(', 1) SAX.characters(new curses, 10) SAX.getEntity(apos) SAX.characters(', 1) -SAX.characters( (ncurses) Variante und ist de, 51) -SAX.characters(ü, 1) -SAX.characters(r die klassische Curses-Librar, 70) +SAX.characters( (ncurses) Variante und ist de, 122) SAX.endElement(RPM:Description) SAX.characters( , 5) diff --git a/SAXresult/svg1 b/SAXresult/svg1 index 9f63da3b..a60acc9b 100644 --- a/SAXresult/svg1 +++ b/SAXresult/svg1 @@ -1,7 +1,6 @@ SAX.setDocumentLocator() SAX.startDocument() SAX.internalSubset(svg, -//W3C//DTD SVG April 1999//EN, http://www.w3.org/Graphics/SVG/svg-19990412.dtd) -SAX.resolveEntity(-//W3C//DTD SVG April 1999//EN, http://www.w3.org/Graphics/SVG/svg-19990412.dtd) SAX.startElement(svg, width='242px', height='383px') SAX.characters( , 1) diff --git a/SAXresult/svg2 b/SAXresult/svg2 index a30fb92f..8075db6c 100644 --- a/SAXresult/svg2 +++ b/SAXresult/svg2 @@ -1,7 +1,6 @@ SAX.setDocumentLocator() SAX.startDocument() SAX.internalSubset(svg, -//W3C//DTD SVG April 1999//EN, http://www.w3.org/Graphics/SVG/svg-19990412.dtd) -SAX.resolveEntity(-//W3C//DTD SVG April 1999//EN, http://www.w3.org/Graphics/SVG/svg-19990412.dtd) SAX.startElement(svg, width='268px', height='207px') SAX.characters( , 1) diff --git a/SAXresult/xml1 b/SAXresult/xml1 index e509449c..88463f22 100644 --- a/SAXresult/xml1 +++ b/SAXresult/xml1 @@ -1,16 +1,14 @@ +xmlSAXUserParseFile returned error 26 SAX.setDocumentLocator() SAX.startDocument() SAX.internalSubset(test, (null), (null)) -SAX.getEntity(amp) SAX.entityDecl(example, 1, (null), (null),

An ampersand (&) may be escaped numerically (&) or with a general entity - (&).

) + (&).

) SAX.getEntity(example) SAX.startElement(test) SAX.getEntity(example) -SAX.isStandalone() -SAX.hasInternalSubset() -SAX.hasExternalSubset() SAX.error: Entity 'example' not defined SAX.endElement(test) SAX.endDocument() +xmlSAXUserParseFile returned error 26 diff --git a/SAXresult/xml2 b/SAXresult/xml2 index 453e784d..ba5ade7a 100644 --- a/SAXresult/xml2 +++ b/SAXresult/xml2 @@ -1,20 +1,19 @@ +xmlSAXUserParseFile returned error 27 SAX.setDocumentLocator() SAX.startDocument() SAX.internalSubset(test, (null), (null)) SAX.elementDecl(test, 3, ...) SAX.entityDecl(xx, 4, (null), (null), %zz;) -SAX.getEntity(xx) +SAX.getParameterEntity(xx) SAX.entityDecl(zz, 4, (null), (null), ) -SAX.getEntity(zz) -SAX.getEntity(xx) -SAX.warning: xmlParsePEReference: %xx; not found +SAX.getParameterEntity(zz) +SAX.getParameterEntity(xx) +SAX.error: PEReference: %xx; not found SAX.startElement(test) SAX.characters(This sample shows a , 20) SAX.getEntity(tricky) -SAX.isStandalone() -SAX.hasInternalSubset() -SAX.hasExternalSubset() -SAX.error: Entity 'tricky' not defined +SAX.warning: Entity 'tricky' not defined SAX.characters( method., 8) SAX.endElement(test) SAX.endDocument() +xmlSAXUserParseFile returned error 27 diff --git a/result/SVG/a-wf.xml b/result/SVG/a-wf.xml index c4301bb5..7facfd5c 100644 --- a/result/SVG/a-wf.xml +++ b/result/SVG/a-wf.xml @@ -2,7 +2,7 @@ This well formed svg document draws a triangle which is a hyperlink - +

diff --git a/result/SVG/bike.xml b/result/SVG/bike.xml index 9c5e0c6a..c702188d 100644 --- a/result/SVG/bike.xml +++ b/result/SVG/bike.xml @@ -1,5 +1,6 @@ + Kona Lavadome mountain bike @@ -12,27 +13,33 @@ 14/12 gauge double butted spoke - + + black anodised low torsion hub - + + twin wall, eyeletted rim - + + 8 speed, wide ratio gearing - + + double cross lacing of 32 spokes - + + Front wheel The front wheel provides grip, steering and some shock absorption - + + diff --git a/result/SVG/defs.xml b/result/SVG/defs.xml index 0ceee0bd..78c6beb6 100644 --- a/result/SVG/defs.xml +++ b/result/SVG/defs.xml @@ -10,4 +10,5 @@ Defining things for later use + the elements defined in the --> + diff --git a/result/SVG/desc.xml b/result/SVG/desc.xml index 7f65d2ae..6fde9660 100644 --- a/result/SVG/desc.xml +++ b/result/SVG/desc.xml @@ -9,5 +9,6 @@ This is a bar chart which shows company sales by region. - + + diff --git a/result/SVG/gradient.xml b/result/SVG/gradient.xml index 63f97f7c..4570b76d 100644 --- a/result/SVG/gradient.xml +++ b/result/SVG/gradient.xml @@ -6,7 +6,8 @@ - + + diff --git a/result/SVG/image-wf.xml b/result/SVG/image-wf.xml index 54c8df1a..e11a12f4 100644 --- a/result/SVG/image-wf.xml +++ b/result/SVG/image-wf.xml @@ -2,7 +2,7 @@ This links to an external image - + My image diff --git a/result/SVG/marker.xml b/result/SVG/marker.xml index f99b977f..1b41714c 100644 --- a/result/SVG/marker.xml +++ b/result/SVG/marker.xml @@ -10,11 +10,14 @@ + beginning of the path --> + - + + - + + diff --git a/result/SVG/mathswitch.xml b/result/SVG/mathswitch.xml index f7a95ebc..b2913840 100644 --- a/result/SVG/mathswitch.xml +++ b/result/SVG/mathswitch.xml @@ -5,16 +5,21 @@ MathML is not supported. + whose testing attributes evaluate to true.--> + - + embedded within SVG). --> + + + - + were testing attributes and they evaluated to true.--> + + + Formula goes here diff --git a/result/SVG/parentns.xml b/result/SVG/parentns.xml index 0b8ecdcd..5b2ed463 100644 --- a/result/SVG/parentns.xml +++ b/result/SVG/parentns.xml @@ -1,6 +1,9 @@ - + + - - + + + + diff --git a/result/SVG/patternfill.xml b/result/SVG/patternfill.xml index 0a425fd7..c520ae81 100644 --- a/result/SVG/patternfill.xml +++ b/result/SVG/patternfill.xml @@ -4,7 +4,8 @@ + such as paths, images, text and shapes --> + diff --git a/result/SVG/private.xml b/result/SVG/private.xml index e492a25d..edfe3663 100644 --- a/result/SVG/private.xml +++ b/result/SVG/private.xml @@ -7,10 +7,12 @@ - + + This chart includes private data in another namespace + draw the pie chart --> + diff --git a/result/SVG/richdesc.xml b/result/SVG/richdesc.xml index eee8fa33..eba1f058 100644 --- a/result/SVG/richdesc.xml +++ b/result/SVG/richdesc.xml @@ -3,10 +3,9 @@ This is an example SVG file The global description uses markup from the - - mydoc - namespace. + mydoc namespace. - + + diff --git a/result/SVG/script.xml b/result/SVG/script.xml index 133c0a0c..c98af0f7 100644 --- a/result/SVG/script.xml +++ b/result/SVG/script.xml @@ -2,10 +2,11 @@ - diff --git a/result/SVG/structure01.xml b/result/SVG/structure01.xml index bdac7423..46af5e80 100644 --- a/result/SVG/structure01.xml +++ b/result/SVG/structure01.xml @@ -1,6 +1,8 @@ - + + - + + diff --git a/result/SVG/style.xml b/result/SVG/style.xml index 80dfa422..7176912a 100644 --- a/result/SVG/style.xml +++ b/result/SVG/style.xml @@ -2,8 +2,9 @@ - Here is my title diff --git a/result/SVG/switch.xml b/result/SVG/switch.xml index 124e6139..87eb3646 100644 --- a/result/SVG/switch.xml +++ b/result/SVG/switch.xml @@ -3,11 +3,14 @@ + past all others. --> + - + render the file drawing.svg. --> + + + diff --git a/result/SVG/symbol-use.xml b/result/SVG/symbol-use.xml index f6e97a7b..a9b395c2 100644 --- a/result/SVG/symbol-use.xml +++ b/result/SVG/symbol-use.xml @@ -3,14 +3,20 @@ - + + Examples of inline and referenced content - - - - + + + + + + + + - + + diff --git a/result/SVG/template.xml b/result/SVG/template.xml index f844b482..607cd91f 100644 --- a/result/SVG/template.xml +++ b/result/SVG/template.xml @@ -2,7 +2,7 @@ This well formed svg document contains a hyperlink - +

diff --git a/result/SVG/toap01.xml b/result/SVG/toap01.xml index 778d92f5..fac024c0 100644 --- a/result/SVG/toap01.xml +++ b/result/SVG/toap01.xml @@ -4,7 +4,5 @@ Simple text on a path

-

This specification uses the term URI, which is defined by - -, a work in progress expected to update - and -. -

+at http://www.w3.org/TR. +

+

This specification uses the term URI, which is defined by , a work in progress expected to update and . +

The list of known errors in this specification is available at - - http://www.w3.org/XML/xml-19980210-errata -.

+http://www.w3.org/XML/xml-19980210-errata.

Please report errors in this document to - - xml-editor@w3.org -. -

+xml-editor@w3.org. +

Chicago, Vancouver, Mountain View, et al.: @@ -275,11 +264,9 @@ Terry Allen, Norbert Mikula, James Clark, Jon Bosak, Henry Thompson, Paul Grosso, and self. Among other things: give in on "well formed" (Terry is right), tentatively rename QuotedCData as AttValue and Literal as EntityValue to be more informative, since attribute -values are the - only - place QuotedCData was used, and +values are the only place QuotedCData was used, and vice versa for entity text and Literal. (I'd call it Entity Text, -but 8879 uses that name for both internal and external entities.) +but 8879 uses that name for both internal and external entities.) 1997-03-26 : CMSMcQ : resynch the two forks of this draft, reapply my changes dated 03-20 and 03-21. Normalize old 'may not' to 'must not' except in the one case where it meant 'may or may not'. @@ -333,13 +320,11 @@ Lots more cleanup. 1996-10-24 : CMSMcQ : quick tweaks, implement some ERB decisions. Characters are not integers. Comments are /* */ not //. Add bibliographic refs to 10646, HyTime, Unicode. -Rename old Cdata as MsData since it's - only - seen +Rename old Cdata as MsData since it's only seen in marked sections. Call them attribute-value pairs not name-value pairs, except once. Internal subset is optional, needs '?'. Implied attributes should be signaled to the app, not -have values supplied by processor. +have values supplied by processor. 1996-10-16 : TB : track down & excise all DSD references; introduce some EBNF for entity declarations. 1996-10-?? : TB : consistency check, fix up scraps so @@ -382,45 +367,30 @@ do some housekeeping Introduction

Extensible Markup Language, abbreviated XML, describes a class of -data objects called - XML documents - and +data objects called XML documents and partially describes the behavior of computer programs which process them. XML is an application profile or restricted form of SGML, the Standard Generalized Markup -Language -. +Language . By construction, XML documents are conforming SGML documents. -

-

XML documents are made up of storage units called - entities -, which contain either parsed +

+

XML documents are made up of storage units called entities, which contain either parsed or unparsed data. -Parsed data is made up of characters -, +Parsed data is made up of characters, some -of which form character data -, -and some of which form markup -. +of which form character data, +and some of which form markup. Markup encodes a description of the document's storage layout and logical structure. XML provides a mechanism to impose constraints on -the storage layout and logical structure.

-

- A software module -called an - XML processor - is used to read XML documents -and provide access to their content and structure. - It is assumed that an XML processor is +the storage layout and logical structure.

+

A software module +called an XML processor is used to read XML documents +and provide access to their content and structure. It is assumed that an XML processor is doing its work on behalf of another module, called the - - application -. - This specification describes the +application. This specification describes the required behavior of an XML processor in terms of how it must read XML -data and the information it must provide to the application.

+data and the information it must provide to the application.

Origin and Goals

XML was developed by an XML Working Group (originally known as the @@ -432,45 +402,12 @@ Interest Group (previously known as the SGML Working Group) also organized by the W3C. The membership of the XML Working Group is given in an appendix. Dan Connolly served as the WG's contact with the W3C.

-

The design goals for XML are: - - -

XML shall be straightforwardly usable over the -Internet.

- - -

XML shall support a wide variety of applications.

-
- -

XML shall be compatible with SGML.

-
- -

It shall be easy to write programs which process XML -documents.

-
- -

The number of optional features in XML is to be kept to the -absolute minimum, ideally zero.

-
- -

XML documents should be human-legible and reasonably -clear.

-
- -

The XML design should be prepared quickly.

-
- -

The design of XML shall be formal and concise.

-
- -

XML documents shall be easy to create.

-
- -

Terseness in XML markup is of minimal importance.

-
- - -

+

The design goals for XML are:

XML shall be straightforwardly usable over the +Internet.

XML shall support a wide variety of applications.

XML shall be compatible with SGML.

It shall be easy to write programs which process XML +documents.

The number of optional features in XML is to be kept to the +absolute minimum, ideally zero.

XML documents should be human-legible and reasonably +clear.

The XML design should be prepared quickly.

The design of XML shall be formal and concise.

XML documents shall be easy to create.

Terseness in XML markup is of minimal importance.

+

This specification, together with associated standards (Unicode and ISO/IEC 10646 for characters, @@ -481,10 +418,8 @@ provides all the information necessary to understand XML Version &XML.version; and construct computer programs to process it.

This version of the XML specification - - -&doc.distribution;.

+&doc.distribution;.

Terminology @@ -492,49 +427,17 @@ and construct computer programs to process it.

this specification. The terms defined in the following list are used in building those definitions and in describing the actions of an XML processor: - - - - - -

- Conforming documents and XML +

Conforming documents and XML processors are permitted to but need not behave as -described. -

-
-
- - - -

Conforming documents and XML processors +described.

Conforming documents and XML processors are required to behave as described; otherwise they are in error. - - -

-
-
- - - -

- A violation of the rules of this +

A violation of the rules of this specification; results are undefined. Conforming software may detect and report an error and may -recover from it. -

-
-
- - - -

- An error -which a conforming - XML processor - +recover from it.

An error +which a conforming XML processor must detect and report to the application. After encountering a fatal error, the processor may continue @@ -546,48 +449,16 @@ Once a fatal error is detected, however, the processor must not continue normal processing (i.e., it must not continue to pass character data and information about the document's logical structure to the application in the normal way). - -

-
-
- - - -

Conforming software may or must (depending on the modal verb in the +

Conforming software may or must (depending on the modal verb in the sentence) behave as described; if it does, it must provide users a means to enable or disable the behavior -described.

-
-
- - - -

A rule which applies to all - - valid - XML documents. +described.

A rule which applies to all +valid XML documents. Violations of validity constraints are errors; they must, at user option, be reported by - validating XML processors -.

-
-
- - - -

A rule which applies to all - well-formed - XML documents. +validating XML processors.

A rule which applies to all well-formed XML documents. Violations of well-formedness constraints are - fatal errors -.

-
-
- - - -

- (Of strings or names:) +fatal errors.

(Of strings or names:) Two strings or names being compared must be identical. Characters with multiple possible representations in ISO/IEC 10646 (e.g. characters with @@ -602,39 +473,16 @@ language generated by that production. (Of content and content models:) An element matches its declaration when it conforms in the fashion described in the constraint - - -. - - -

-
-
- - - -

- A feature of -XML included solely to ensure that XML remains compatible with SGML. +. -

-
-
- - - -

- A +

A feature of +XML included solely to ensure that XML remains compatible with SGML. +

A non-binding recommendation included to increase the chances that XML documents can be processed by the existing installed base of SGML processors which predate the -&WebSGML;. -

-
-
-
- -

+&WebSGML;.

+

@@ -643,24 +491,16 @@ processors which predate the

A data object is an - - XML document - if it is - well-formed -, as +XML document if it is +well-formed, as defined in this specification. A well-formed XML document may in addition be - valid - if it meets certain further -constraints. +valid if it meets certain further +constraints.

Each XML document has both a logical and a physical structure. -Physically, the document is composed of units called - entities -. An entity may refer - to other entities to cause their -inclusion in the document. A document begins in a "root" or document entity -. +Physically, the document is composed of units called entities. An entity may refer to other entities to cause their +inclusion in the document. A document begins in a "root" or document entity. Logically, the document is composed of declarations, elements, comments, character references, and @@ -668,163 +508,80 @@ processing instructions, all of which are indicated in the document by explicit markup. The logical and physical structures must nest properly, as described -in -. -

+in . +

Well-Formed XML Documents -

- +

A textual object is a well-formed XML document if: - - - -

Taken as a whole, it -matches the production labeled - document -.

- - -

It -meets all the well-formedness constraints given in this specification.

-
- -

Each of the - parsed entities - +

Taken as a whole, it +matches the production labeled document.

It +meets all the well-formedness constraints given in this specification.

Each of the parsed entities which is referenced directly or indirectly within the document is - well-formed -.

-
- -

+well-formed.

- - - Document - - document - - prolog - - element - - Misc -* - - - -

-

Matching the - document - production +Documentdocumentprolog +element +Misc* +

+

Matching the document production implies that: - - -

It contains one or more - - elements -.

- - - -

- There is exactly -one element, called the - root -, or document element, no -part of which appears in the content - of any other element. - +stronger. -MSM *-->

There is exactly +one element, called the root, or document element, no +part of which appears in the content of any other element. For all other elements, if the start-tag is in the content of another element, the end-tag is in the content of the same element. More simply stated, the elements, delimited by start- and end-tags, nest properly within each other. -

-
- - -

+

+

As a consequence of this, for each non-root element - - C - in the document, there is one other element P - +C in the document, there is one other element P in the document such that - C - is in the content of P -, but is not in +C is in the content of P, but is not in the content of any other element that is in the content of - P -. - P - is referred to as the - parent - of C -, and C - as a - child - of P -. +P. +P is referred to as the +parent of C, and C as a +child of P.

Characters -

- A parsed entity contains - - text -, a sequence of - characters -, -which may represent markup or character data. - - A - character - +

A parsed entity contains +text, a sequence of +characters, +which may represent markup or character data. +A character is an atomic unit of text as specified by -ISO/IEC 10646 -. +ISO/IEC 10646 . Legal characters are tab, carriage return, line feed, and the legal graphic characters of Unicode and ISO/IEC 10646. The use of "compatibility characters", as defined in section 6.8 -of -, is discouraged. - - - - Character Range - - - Char - #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] -| [#x10000-#x10FFFF] - any Unicode character, excluding the -surrogate blocks, FFFE, and FFFF. - - - - -

+of , is discouraged. + +Character RangeChar#x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] +| [#x10000-#x10FFFF]any Unicode character, excluding the +surrogate blocks, FFFE, and FFFF. +

The mechanism for encoding character code points into bit patterns may vary from entity to entity. All XML processors must accept the UTF-8 and UTF-16 encodings of 10646; the mechanisms for signaling which of the two is in use, or for bringing other encodings into play, are -discussed later, in - -. -

+discussed later, in . +

- If they are needed elsewhere, -they must be escaped - -using either numeric character references - +they must be escaped +using either numeric character references or the strings -" & -" and " < -" respectively. +"&" and "<" respectively. The right angle bracket (>) may be represented using the string -" > -", and must, for -compatibility -, +">", and must, for +compatibility, be escaped using -" > -" or a character reference +">" or a character reference when it appears in the string -" ]]> -" +"]]>" in content, when that string is not marking the end of -a CDATA section -. -

+a CDATA section. +

In the content of elements, character data is any string of characters which does not contain the start-delimiter of any markup. In a CDATA section, character data is any string of characters not including the CDATA-section-close -delimiter, " - ]]> -".

+delimiter, "]]>".

To allow attribute values to contain both single and double quotes, the apostrophe or single-quote character (') may be represented as -" - &apos; -", and the double-quote character (") as -" &quot; -". - - Character Data - - CharData - [^<&]* - ([^<&]* ']]>' [^<&]*) - - - -

+"&apos;", and the double-quote character (") as +"&quot;". +Character DataCharData[^<&]* - ([^<&]* ']]>' [^<&]*) +

Comments

- - Comments - may + Comments may appear anywhere in a document outside other - markup -; in addition, +markup; in addition, they may appear within the document type declaration at places allowed by the grammar. -They are not part of the document's character -data -; an XML +They are not part of the document's character +data; an XML processor may, but need not, make it possible for an application to retrieve the text of comments. - For compatibility -, the string -" -- -" (double-hyphen) must not occur within +For compatibility, the string +"--" (double-hyphen) must not occur within comments. - - Comments - - Comment - '<!--' -(( - Char - - '-') -| ('-' ( Char - - '-')))* -'-->' - - - - +CommentsComment'<!--' +((Char - '-') +| ('-' (Char - '-')))* +'-->' +

An example of a comment: - - <!&como; declarations for <head> & <body> &comc;> - -

+<!&como; declarations for <head> & <body> &comc;> +

Processing Instructions -

- - Processing -instructions - (PIs) allow documents to contain instructions +

Processing +instructions (PIs) allow documents to contain instructions for applications. - - Processing Instructions - - PI - '<?' - PITarget - -( S - -( Char -* - -( Char -* &pic; Char -*)))? -&pic; - - - PITarget - - Name - - -(('X' | 'x') ('M' | 'm') ('L' | 'l')) - - - - -PIs are not part of the document's character -data -, but must be passed through to the application. The -PI begins with a target ( PITarget -) used +Processing InstructionsPI'<?' PITarget +(S +(Char* - +(Char* &pic; Char*)))? +&pic;PITargetName - +(('X' | 'x') ('M' | 'm') ('L' | 'l')) +PIs are not part of the document's character +data, but must be passed through to the application. The +PI begins with a target (PITarget) used to identify the application to which the instruction is directed. -The target names " XML -", " xml -", and so on are +The target names "XML", "xml", and so on are reserved for standardization in this or future versions of this specification. The -XML Notation - mechanism +XML Notation mechanism may be used for formal declaration of PI targets. -

+

CDATA Sections -

- - CDATA sections - +

CDATA sections may occur anywhere character data may occur; they are used to escape blocks of text containing characters which would otherwise be recognized as markup. CDATA sections begin with the -string " <![CDATA[ -" and end with the string -" ]]> -": - - CDATA Sections - - CDSect - - CDStart - - CData - - CDEnd - - - - CDStart - '<![CDATA[' - - - CData - ( - Char -* - -( Char -* ']]>' Char -*)) - - - - CDEnd - ']]>' - - +string "<![CDATA[" and end with the string +"]]>": +CDATA SectionsCDSectCDStart +CData +CDEndCDStart'<![CDATA['CData(Char* - +(Char* ']]>' Char*)) +CDEnd']]>' - -Within a CDATA section, only the CDEnd - string is +Within a CDATA section, only the CDEnd string is recognized as markup, so that left angle brackets and ampersands may occur in their literal form; they need not (and cannot) be escaped using -" &lt; -" and " &amp; -". CDATA sections -cannot nest. - -

-

An example of a CDATA section, in which " - <greeting> -" and -" </greeting> -" -are recognized as character data -, not - markup -: - <![CDATA[<greeting>Hello, world!</greeting>]]> - -

+"&lt;" and "&amp;". CDATA sections +cannot nest. +

+

An example of a CDATA section, in which "<greeting>" and +"</greeting>" +are recognized as character data, not +markup: +<![CDATA[<greeting>Hello, world!</greeting>]]> +

Prolog and Document Type Declaration -

- XML documents +

XML documents may, and should, -begin with an - XML declaration - which specifies +begin with an XML declaration which specifies the version of -XML being used. - -For example, the following is a complete XML document, well-formed - but not - valid -: - - +XML being used. +For example, the following is a complete XML document, well-formed but not +valid: + Hello, world! -]]> - +]]> and so is this: - -Hello, world! -]]> - -

-

The version number " - 1.0 -" should be used to indicate +Hello, world! +]]> +

+

The version number "1.0" should be used to indicate conformance to this version of this specification; it is an error -for a document to use the value " 1.0 -" +for a document to use the value "1.0" if it does not conform to this version of this specification. It is the intent of the XML working group to give later versions of this specification -numbers other than " 1.0 -", but this intent does not +numbers other than "1.0", but this intent does not indicate a commitment to produce any future versions of XML, nor if any are produced, to use any particular numbering scheme. @@ -1340,513 +844,303 @@ as a means to allow the possibility of automatic version recognition, should it become necessary. Processors may signal an error if they receive documents labeled with versions they do not support. -

+

The function of the markup in an XML document is to describe its storage and logical structure and to associate attribute-value pairs -with its logical structures. XML provides a mechanism, the - document type declaration -, to define +with its logical structures. XML provides a mechanism, the document type declaration, to define constraints on the logical structure and to support the use of predefined storage units. - An XML document is - - valid - if it has an associated document type +An XML document is +valid if it has an associated document type declaration and if the document -complies with the constraints expressed in it. -

+complies with the constraints expressed in it.

The document type declaration must appear before -the first - element - in the document. - - Prolog - - - prolog - - XMLDecl -? - Misc -* -( doctypedecl - - Misc -*)? - - - XMLDecl - &xmlpio; - - VersionInfo - - EncodingDecl -? - SDDecl -? - S -? -&pic; - - - VersionInfo - - S - 'version' Eq - -(' VersionNum - ' -| " VersionNum - ") - - - Eq - - S -? '=' S -? - - - VersionNum - ([a-zA-Z0-9_.:] | '-')+ - - - Misc - - Comment - | PI - | - S - - - - -

-

- The XML - - document type declaration - +the first element in the document. +PrologprologXMLDecl? +Misc* +(doctypedecl +Misc*)?XMLDecl&xmlpio; +VersionInfo +EncodingDecl? +SDDecl? +S? +&pic;VersionInfoS 'version' Eq +(' VersionNum ' +| " VersionNum ")EqS? '=' S?VersionNum([a-zA-Z0-9_.:] | '-')+MiscComment | PI | +S

+

The XML +document type declaration contains or points to - markup declarations - +markup declarations that provide a grammar for a class of documents. This grammar is known as a document type definition, -or DTD -. +or DTD. The document type declaration can point to an external subset (a special kind of - external entity -) containing markup +external entity) containing markup declarations, or can contain the markup declarations directly in an internal subset, or can do both. The DTD for a document consists of both subsets taken -together. - -

-

- -A - markup declaration - is -an element type declaration -, -an attribute-list declaration -, -an entity declaration -, or -a notation declaration -. - - +together. +

+

+A markup declaration is +an element type declaration, +an attribute-list declaration, +an entity declaration, or +a notation declaration. + These declarations may be contained in whole or in part -within parameter entities -, +within parameter entities, as described in the well-formedness and validity constraints below. For fuller information, see - -.

+.

Document Type Definition doctypedecl - '<!DOCTYPE' - S - - Name - ( S - - ExternalID -)? - S -? ('[' -( markupdecl - -| PEReference - -| S -)* + '<!DOCTYPE' S +Name (S +ExternalID)? +S? ('[' +(markupdecl +| PEReference +| S)* ']' - S -?)? '>' +S?)? '>' markupdecl - - elementdecl - -| AttlistDecl - -| EntityDecl - -| NotationDecl - -| PI - -| Comment - - + elementdecl +| AttlistDecl +| EntityDecl +| NotationDecl +| PI +| Comment +

The markup declarations may be made up in whole or in part of -the - replacement text - of - parameter entities -. +the replacement text of +parameter entities. The productions later in this specification for -individual nonterminals ( elementdecl -, - AttlistDecl -, and so on) describe -the declarations after - all the parameter entities have been - included -.

+individual nonterminals (elementdecl, +AttlistDecl, and so on) describe +the declarations after all the parameter entities have been +included.

Root Element Type

-The - Name - in the document type declaration must -match the element type of the root element -. -

+The Name in the document type declaration must +match the element type of the root element. +

Proper Declaration/PE Nesting

Parameter-entity - - replacement text - must be properly nested +replacement text must be properly nested with markup declarations. That is to say, if either the first character or the last character of a markup -declaration ( markupdecl - above) +declaration (markupdecl above) is contained in the replacement text for a - parameter-entity reference -, -both must be contained in the same replacement text.

+parameter-entity reference, +both must be contained in the same replacement text.

PEs in Internal Subset

In the internal DTD subset, - - parameter-entity references - +parameter-entity references can occur only where markup declarations can occur, not within markup declarations. (This does not apply to references that occur in external parameter entities or to the external subset.) -

+

Like the internal subset, the external subset and any external parameter entities referred to in the DTD must consist of a series of complete markup declarations of the types allowed by the non-terminal symbol - - markupdecl -, interspersed with white space -or parameter-entity references -. +markupdecl, interspersed with white space +or parameter-entity references. However, portions of the contents of the external subset or of external parameter entities may conditionally be ignored by using -the conditional section - +the conditional section construct; this is not allowed in the internal subset. - - External Subset - - - extSubset - - TextDecl -? - extSubsetDecl - - - - extSubsetDecl - ( - - markupdecl - -| conditionalSect - -| PEReference - -| S - -)* - - - -

+External SubsetextSubsetTextDecl? +extSubsetDeclextSubsetDecl( +markupdecl +| conditionalSect +| PEReference +| S +)*

The external subset and external parameter entities also differ from the internal subset in that in them, - - parameter-entity references - -are permitted within - markup declarations, -not only between - markup declarations.

+parameter-entity references +are permitted within markup declarations, +not only between markup declarations.

An example of an XML document with a document type declaration: - - - + Hello, world! -]]> - -The system identifier - -" hello.dtd -" gives the URI of a DTD for the document.

+]]> +The system identifier +"hello.dtd" gives the URI of a DTD for the document.

The declarations can also be given locally, as in this example: - - - + ]> Hello, world! -]]> - +]]> If both the external and internal subsets are used, the internal subset is considered to occur before the external subset. - This has the effect that entity and attribute-list declarations in the internal subset take precedence over those in the external subset. -

+

Standalone Document Declaration

Markup declarations can affect the content of the document, -as passed from an - XML processor - +as passed from an XML processor to an application; examples are attribute defaults and entity declarations. The standalone document declaration, which may appear as a component of the XML declaration, signals whether or not there are such declarations which appear external to -the document entity -. - - Standalone Document Declaration - - - SDDecl - - - S - -'standalone' Eq - +the document entity. +Standalone Document DeclarationSDDecl +S +'standalone' Eq (("'" ('yes' | 'no') "'") | ('"' ('yes' | 'no') '"')) - - - - - -

+

-In a standalone document declaration, the value " - yes -" indicates +In a standalone document declaration, the value "yes" indicates that there -are no markup declarations external to the document -entity - (either in the DTD external subset, or in an +are no markup declarations external to the document +entity (either in the DTD external subset, or in an external parameter entity referenced from the internal subset) which affect the information passed from the XML processor to the application. -The value " no -" indicates that there are or may be such +The value "no" indicates that there are or may be such external markup declarations. Note that the standalone document declaration only -denotes the presence of external declarations -; the presence, in a +denotes the presence of external declarations; the presence, in a document, of -references to external entities -, when those entities are +references to external entities, when those entities are internally declared, -does not change its standalone status.

+does not change its standalone status.

If there are no external markup declarations, the standalone document declaration has no meaning. If there are external markup declarations but there is no standalone -document declaration, the value " - no -" is assumed.

-

Any XML document for which - standalone="no" - holds can +document declaration, the value "no" is assumed.

+

Any XML document for which standalone="no" holds can be converted algorithmically to a standalone document, -which may be desirable for some network delivery applications.

+which may be desirable for some network delivery applications.

Standalone Document Declaration

The standalone document declaration must have -the value " - no -" if any external markup declarations -contain declarations of:

+the value "no" if any external markup declarations +contain declarations of:

-

attributes with - default - values, if +

attributes with default values, if elements to which these attributes apply appear in the document without -specifications of values for these attributes, or

+specifications of values for these attributes, or

entities (other than &magicents;), -if - references - to those -entities appear in the document, or

+if references to those +entities appear in the document, or

attributes with values subject to - - normalization -, where the +normalization, where the attribute appears in the document with a value which will -change as a result of normalization, or

+change as a result of normalization, or

-

element types with - element content -, +

element types with element content, if white space occurs directly within any instance of those types. -

+

-

An example XML declaration with a standalone document declaration: - <?xml version="&XML.version;" standalone='yes'?> -

+

An example XML declaration with a standalone document declaration:<?xml version="&XML.version;" standalone='yes'?>

White Space Handling

In editing XML documents, it is often convenient to use "white space" (spaces, tabs, and blank lines, denoted by the nonterminal - - S - in this specification) to +S in this specification) to set apart the markup for greater readability. Such white space is typically not intended for inclusion in the delivered version of the document. On the other hand, "significant" white space that should be preserved in the delivered version is common, for example in poetry and -source code.

-

An - XML processor - +source code.

+

An XML processor must always pass all characters in a document that are not -markup through to the application. A -validating XML processor - must also inform the application +markup through to the application. A +validating XML processor must also inform the application which of these characters constitute white space appearing -in element content -. -

-

A special - attribute - -named xml:space - may be attached to an element +in element content. +

+

A special attribute +named xml:space may be attached to an element to signal an intention that in that element, white space should be preserved by applications. In valid documents, this attribute, like any other, must be - declared - if it is used. +declared if it is used. When declared, it must be given as an - enumerated type - whose only -possible values are " default -" and " preserve -". -For example: -]]> -

-

The value " - default -" signals that applications' +enumerated type whose only +possible values are "default" and "preserve". +For example:]]>

+

The value "default" signals that applications' default white-space processing modes are acceptable for this element; the -value " preserve -" indicates the intent that applications preserve +value "preserve" indicates the intent that applications preserve all the white space. This declared intent is considered to apply to all elements within the content of the element where it is specified, unless overriden with another instance -of the xml:space - attribute. -

-

The - root element - of any document +of the xml:space attribute. +

+

The root element of any document is considered to have signaled no intentions as regards application space handling, unless it provides a value for this attribute or the attribute is declared with a default value. -

+

End-of-Line Handling -

XML - parsed entities - are often stored in +

XML parsed entities are often stored in computer files which, for editing convenience, are organized into lines. These lines are typically separated by some combination of the characters -carriage-return (#xD) and line-feed (#xA).

-

To simplify the tasks of - applications -, +carriage-return (#xD) and line-feed (#xA).

+

To simplify the tasks of applications, wherever an external parsed entity or the literal entity value of an internal parsed entity contains either the literal two-character sequence "#xD#xA" or a standalone literal -#xD, an XML processor - must +#xD, an XML processor must pass to the application the single character #xA. (This behavior can conveniently be produced by normalizing all line breaks to #xA on input, before parsing.) -

+

Language Identification @@ -1854,114 +1148,46 @@ line breaks to #xA on input, before parsing.) identify the natural or formal language in which the content is written. -A special - attribute - named - xml:lang - may be inserted in +A special attribute named +xml:lang may be inserted in documents to specify the language used in the contents and attribute values of any element in an XML document. In valid documents, this attribute, like any other, must be - declared - if it is used. +declared if it is used. The values of the attribute are language identifiers as defined -by -, "Tags for the Identification of Languages": - - Language Identification - - LanguageID - - Langcode - -('-' Subcode -)* - - - Langcode - - ISO639Code - | - IanaCode - | - UserCode - - - - ISO639Code - ([a-z] | [A-Z]) ([a-z] | [A-Z]) - - - IanaCode - ('i' | 'I') '-' ([a-z] | [A-Z])+ - - - UserCode - ('x' | 'X') '-' ([a-z] | [A-Z])+ - - - Subcode - ([a-z] | [A-Z])+ - - - -The Langcode - may be any of the following: - - -

a two-letter language code as defined by - - -, "Codes -for the representation of names of languages"

-
- -

a language identifier registered with the Internet -Assigned Numbers Authority - -; these begin with the -prefix " i- -" (or " I- -")

-
- -

a language identifier assigned by the user, or agreed on +by , "Tags for the Identification of Languages": +Language IdentificationLanguageIDLangcode +('-' Subcode)*LangcodeISO639Code | +IanaCode | +UserCodeISO639Code([a-z] | [A-Z]) ([a-z] | [A-Z])IanaCode('i' | 'I') '-' ([a-z] | [A-Z])+UserCode('x' | 'X') '-' ([a-z] | [A-Z])+Subcode([a-z] | [A-Z])+ +The Langcode may be any of the following: +

a two-letter language code as defined by +, "Codes +for the representation of names of languages"

a language identifier registered with the Internet +Assigned Numbers Authority ; these begin with the +prefix "i-" (or "I-")

a language identifier assigned by the user, or agreed on between parties in private use; these must begin with the -prefix " - x- -" or " X- -" in order to ensure that they do not conflict -with names later standardized or registered with IANA

-
-
-

-

There may be any number of - Subcode - segments; if +prefix "x-" or "X-" in order to ensure that they do not conflict +with names later standardized or registered with IANA

+

There may be any number of Subcode segments; if the first subcode segment exists and the Subcode consists of two letters, then it must be a country code from - -, "Codes +, "Codes for the representation of names of countries." If the first subcode consists of more than two letters, it must be a subcode for the language in question registered with IANA, -unless the Langcode - begins with the prefix -" x- -" or -" X- -".

+unless the Langcode begins with the prefix +"x-" or +"X-".

It is customary to give the language code in lower case, and the country code (if any) in upper case. Note that these values, unlike other names in XML documents, are case insensitive.

For example: - - -The quick brown fox jumps over the lazy dog.

+The quick brown fox jumps over the lazy dog.

What colour is it?

What color is it?

@@ -1969,19 +1195,15 @@ are case insensitive.

Juristerei, und Medizin und leider auch Theologie durchaus studiert mit heißem Bemüh'n. -
]]>
-

+ ]]>

-

The intent declared with - xml:lang - is considered to apply to +

The intent declared with xml:lang is considered to apply to all attributes and content of the element where it is specified, -unless overridden with an instance of xml:lang - -on another element within that content.

+unless overridden with an instance of xml:lang +on another element within that content.

-

A simple declaration for - xml:lang - might take +

A simple declaration for xml:lang might take the form - xml:lang NMTOKEN #IMPLIED - +xml:lang NMTOKEN #IMPLIED but specific default values may also be given, if appropriate. In a collection of French poems for English students, with glosses and notes in English, the xml:lang attribute might be declared this way: - - + - ]]> - -

+ ]]> +

Logical Structures -

- Each - XML document - contains one or more - elements -, the boundaries of which are -either delimited by start-tags - -and end-tags -, or, for empty - elements, by an empty-element tag -. Each element has a type, +

Each XML document contains one or more +elements, the boundaries of which are +either delimited by start-tags +and end-tags, or, for empty elements, by an empty-element tag. Each element has a type, identified by name, sometimes called its "generic identifier" (GI), and may have a set of -attribute specifications. - Each attribute specification -has a name - and a value -. -

+attribute specifications. Each attribute specification +has a name and a value. +

Element @@ -2044,156 +1250,84 @@ has a name EmptyElemTag - | - STag - content - - ETag - + | STag content +ETag

This specification does not constrain the semantics, use, or (beyond syntax) names of the element types and attributes, except that names -beginning with a match to - (('X'|'x')('M'|'m')('L'|'l')) - +beginning with a match to (('X'|'x')('M'|'m')('L'|'l')) are reserved for standardization in this or future versions of this specification. -

+

Element Type Match

-The - Name - in an element's end-tag must match +The Name in an element's end-tag must match the element type in the start-tag. -

+

Element Valid

An element is valid if there is a declaration matching - - elementdecl - where the - Name - matches the element type, and -one of the following holds:

+elementdecl where the +Name matches the element type, and +one of the following holds:

-

The declaration matches - EMPTY - and the element has no - content -.

+

The declaration matches EMPTY and the element has no +content.

-

The declaration matches - children - and +

The declaration matches children and the sequence of - child elements - +child elements belongs to the language generated by the regular expression in the content model, with optional white space (characters -matching the nonterminal S -) between each pair -of child elements.

+matching the nonterminal S) between each pair +of child elements.

-

The declaration matches - Mixed - and -the content consists of character -data - and child elements - -whose types match names in the content model.

+

The declaration matches Mixed and +the content consists of character +data and child elements +whose types match names in the content model.

-

The declaration matches - ANY -, and the types -of any child elements - have -been declared.

+

The declaration matches ANY, and the types +of any child elements have +been declared.

Start-Tags, End-Tags, and Empty-Element Tags -

- The beginning of every -non-empty XML element is marked by a - start-tag -. - - Start-tag - - - STag - '<' - Name - -( S - Attribute -)* - S -? '>' - - - - Attribute - - Name - Eq - - AttValue - - - - - - - - -The Name - in +

The beginning of every +non-empty XML element is marked by a start-tag. +Start-tagSTag'<' Name +(S Attribute)* +S? '>'AttributeName Eq +AttValue +The Name in the start- and end-tags gives the -element's type -. - - -The - Name -- AttValue - pairs are +element's type. + +The Name-AttValue pairs are referred to as -the attribute specifications - of the element -, - with the - - Name - in each pair -referred to as the attribute name - - and - the content of the - - AttValue - (the text between the - ' - or " - delimiters) -as the attribute value -. - -

+the attribute specifications of the element, +with the +Name in each pair +referred to as the attribute name and +the content of the +AttValue (the text between the +' or " delimiters) +as the attribute value. +

Unique Att Spec

@@ -2206,10 +1340,8 @@ or empty-element tag.

The attribute must have been declared; the value must be of the type declared for it. -(For attribute types, see - -.) -

+(For attribute types, see .) +

No External Entity References @@ -2219,193 +1351,86 @@ to external entities.

- No - < - in Attribute Values -

The - replacement text - of any entity + No < in Attribute Values +

The replacement text of any entity referred to directly or indirectly in an attribute -value (other than " &lt; -") must not contain -a < -. -

+value (other than "&lt;") must not contain +a <. +

An example of a start-tag: - - <termdef id="dt-dog" term="dog"> -

+<termdef id="dt-dog" term="dog">

The end of every element that begins with a start-tag must -be marked by an - end-tag - +be marked by an end-tag containing a name that echoes the element's type as given in the start-tag: - - End-tag - - - ETag - '</' - Name - - S -? '>' - - - - - -

-

An example of an end-tag: - </termdef> +End-tagETag'</' Name +S? '>' +

+

An example of an end-tag:</termdef>

The - - text - between the start-tag and +text between the start-tag and end-tag is called the element's - content -: - - Content of Elements - - - content - ( - element - | CharData - -| Reference - | CDSect - -| PI - | Comment -)* - - - - - +content: +Content of Elementscontent(element | CharData +| Reference | CDSect +| PI | Comment)* +

-

- If an element is - empty -, +

If an element is empty, it must be represented either by a start-tag immediately followed -by an end-tag or by an empty-element tag. - - An - - empty-element tag - takes a special form: - - Tags for Empty Elements - - - EmptyElemTag - '<' - Name - ( S - - Attribute -)* S -? -'/>' - - - - - - -

+by an end-tag or by an empty-element tag. +An +empty-element tag takes a special form: +Tags for Empty ElementsEmptyElemTag'<' Name (S +Attribute)* S? +'/>' +

Empty-element tags may be used for any element which has no content, whether or not it is declared using the keyword - - EMPTY -. - For interoperability -, the empty-element +EMPTY. +For interoperability, the empty-element tag must be used, and can only be used, for elements which are - declared - EMPTY -.

+declared EMPTY.

Examples of empty elements: - - <IMG align="left" +<IMG align="left" src="http://www.w3.org/Icons/WWW/w3c_home" /> <br></br> -<br/> -

+<br/>

Element Type Declarations -

The - element - structure of an - XML document - may, for - validation - purposes, +

The element structure of an +XML document may, for +validation purposes, be constrained using element type and attribute-list declarations. An element type declaration constrains the element's - content -. -

+content. +

Element type declarations often constrain which element types can -appear as - children - of the element. +appear as children of the element. At user option, an XML processor may issue a warning when a declaration mentions an element type for which no declaration -is provided, but this is not an error.

-

- An - element -type declaration - takes the form: - - Element Type Declaration - - - elementdecl - '<!ELEMENT' - S - - Name - - S - - contentspec - - S -? '>' - - - - contentspec - 'EMPTY' +is provided, but this is not an error.

+

An element +type declaration takes the form: +Element Type Declarationelementdecl'<!ELEMENT' S +Name +S +contentspec +S? '>'contentspec'EMPTY' | 'ANY' -| - Mixed - -| children - - - - - - -where the Name - gives the element type -being declared. - -

+| Mixed +| children + +where the Name gives the element type +being declared. +

Unique Element Type Declaration

@@ -2413,219 +1438,112 @@ No element type may be declared more than once.

Examples of element type declarations: - - <!ELEMENT br EMPTY> +<!ELEMENT br EMPTY> <!ELEMENT p (#PCDATA|emph)* > <!ELEMENT %name.para; %content.para; > -<!ELEMENT container ANY> -

+<!ELEMENT container ANY>

Element Content -

- An element - type - has - element content - when elements of that -type must contain only child - +

An element type has +element content when elements of that +type must contain only child elements (no character data), optionally separated by white space (characters matching the nonterminal - S -). - - +S). + In this case, the constraint includes a content model, a simple grammar governing the allowed types of the child elements and the order in which they are allowed to appear. The grammar is built on -content particles ( cp -s), which consist of names, +content particles (cps), which consist of names, choice lists of content particles, or sequence lists of content particles: - - Element-content Models - - - children - ( - choice - -| seq -) -('?' | '*' | '+')? - - - cp - ( - Name - -| choice - -| seq -) -('?' | '*' | '+')? - - - choice - '(' - S -? cp -( S -? '|' S -? cp - )* - S -? ')' - - - - seq - '(' - S -? cp -( S -? ',' S -? cp - )* - S -? ')' - - - - - -where each Name - is the type of an element which may -appear as a child -. +Element-content Modelschildren(choice +| seq) +('?' | '*' | '+')?cp(Name +| choice +| seq) +('?' | '*' | '+')?choice'(' S? cp +( S? '|' S? cp )* +S? ')'seq'(' S? cp +( S? ',' S? cp )* +S? ')' +where each Name is the type of an element which may +appear as a child. Any content -particle in a choice list may appear in the element content - at the location where +particle in a choice list may appear in the element content at the location where the choice list appears in the grammar; content particles occurring in a sequence list must each -appear in the element content - in the +appear in the element content in the order given in the list. The optional character following a name or list governs whether the element or the content particles in the list may occur one -or more ( + -), zero or more ( * -), or zero or -one times ( ? -). +or more (+), zero or more (*), or zero or +one times (?). The absence of such an operator means that the element or content particle must appear exactly once. This syntax and meaning are identical to those used in the productions in this -specification.

+specification.

The content of an element matches a content model if and only if it is possible to trace out a path through the content model, obeying the sequence, choice, and repetition operators and matching each element in -the content against an element type in the content model. - For compatibility -, it is an error +the content against an element type in the content model. For compatibility, it is an error if an element in the document can match more than one occurrence of an element type in the content model. -For more information, see -. +For more information, see . - - -

+

Proper Group/PE Nesting

Parameter-entity - - replacement text - must be properly nested +replacement text must be properly nested with parenthetized groups. That is to say, if either of the opening or closing parentheses -in a choice -, seq -, or - Mixed - construct +in a choice, seq, or +Mixed construct is contained in the replacement text for a - parameter entity -, -both must be contained in the same replacement text.

-

- For interoperability -, +parameter entity, +both must be contained in the same replacement text.

+

For interoperability, if a parameter-entity reference appears in a - choice -, seq -, or - Mixed - construct, its replacement text +choice, seq, or +Mixed construct, its replacement text should not be empty, and neither the first nor last non-blank character of the replacement text should be a connector -( | - or , -). -

+(| or ,). +

Examples of element-content models: - - <!ELEMENT spec (front, body, back?)> +<!ELEMENT spec (front, body, back?)> <!ELEMENT div1 (head, (p | list | note)*, div2*)> -<!ELEMENT dictionary-body (%div.mix; | %dict.mix;)*> -

+<!ELEMENT dictionary-body (%div.mix; | %dict.mix;)*>

Mixed Content -

- An element - - type - has - mixed content - when elements of that type may contain +

An element +type has +mixed content when elements of that type may contain character data, optionally interspersed with - child - elements. - +child elements. In this case, the types of the child elements may be constrained, but not their order or their number of occurrences: - - Mixed-content Declaration - - - Mixed - '(' - S -? +Mixed-content DeclarationMixed'(' S? '#PCDATA' -( S -? +(S? '|' - S -? - Name -)* - S -? -')*' - | '(' - S -? '#PCDATA' S -? ')' - - - - - - - -where the Name -s give the types of elements +S? +Name)* +S? +')*' | '(' S? '#PCDATA' S? ')' + +where the Names give the types of elements that may appear as children. -

+

No Duplicate Types

The same name must not appear more than once in a single mixed-content @@ -2633,104 +1551,51 @@ declaration.

Examples of mixed content declarations: - - <!ELEMENT p (#PCDATA|a|ul|b|i|em)*> +<!ELEMENT p (#PCDATA|a|ul|b|i|em)*> <!ELEMENT p (#PCDATA | %font; | %phrase; | %special; | %form;)* > -<!ELEMENT b (#PCDATA)> -

+<!ELEMENT b (#PCDATA)>

Attribute-List Declarations -

- Attributes - are used to associate -name-value pairs with elements -. -Attribute specifications may appear only within start-tags - -and empty-element tags -; +

Attributes are used to associate +name-value pairs with elements. +Attribute specifications may appear only within start-tags +and empty-element tags; thus, the productions used to -recognize them appear in -. +recognize them appear in . Attribute-list declarations may be used: - - -

To define the set of attributes pertaining to a given -element type.

- - -

To establish type constraints for these -attributes.

-
- -

To provide - default values - -for attributes.

-
- - -

+

To define the set of attributes pertaining to a given +element type.

To establish type constraints for these +attributes.

To provide default values +for attributes.

+

- - Attribute-list declarations - specify the name, data type, and default +Attribute-list declarations specify the name, data type, and default value (if any) of each attribute associated with a given element type: - - Attribute-list Declaration - - AttlistDecl - '<!ATTLIST' - S - - Name - - AttDef -* - S -? '>' - - - AttDef - - S - Name - - S - AttType - - S - DefaultDecl - - - - -The Name - in the - AttlistDecl - rule is the type of an element. At +Attribute-list DeclarationAttlistDecl'<!ATTLIST' S +Name +AttDef* +S? '>'AttDefS Name +S AttType +S DefaultDecl +The Name in the +AttlistDecl rule is the type of an element. At user option, an XML processor may issue a warning if attributes are declared for an element type not itself declared, but this is not an -error. The Name - in the - AttDef - rule is -the name of the attribute. +error. The Name in the +AttDef rule is +the name of the attribute.

-When more than one - AttlistDecl - is provided for a +When more than one AttlistDecl is provided for a given element type, the contents of all those provided are merged. When more than one definition is provided for the same attribute of a given element type, the first declaration is binding and later declarations are ignored. - For interoperability, - writers of DTDs +For interoperability, writers of DTDs may choose to provide at most one attribute-list declaration for a given element type, at most one attribute definition for a given attribute name, and at least one attribute definition @@ -2740,67 +1605,27 @@ issue a warning when more than one attribute-list declaration is provided for a given element type, or more than one attribute definition is provided for a given attribute, but this is not an error. -

+

Attribute Types

XML attribute types are of three kinds: a string type, a set of tokenized types, and enumerated types. The string type may take any literal string as a value; the tokenized types have varying lexical and semantic constraints, as noted: - - - Attribute Types - - - AttType - - StringType - -| TokenizedType - -| EnumeratedType - - - - - StringType - 'CDATA' - - - TokenizedType - 'ID' - - - - | 'IDREF' - - | 'IDREFS' - - | 'ENTITY' - - | 'ENTITIES' - - | 'NMTOKEN' - - | 'NMTOKENS' - - - - - -

+Attribute TypesAttTypeStringType +| TokenizedType +| EnumeratedType +StringType'CDATA'TokenizedType'ID'| 'IDREF'| 'IDREFS'| 'ENTITY'| 'ENTITIES'| 'NMTOKEN'| 'NMTOKENS' +

ID

-Values of type - ID - must match the - Name - production. +Values of type ID must match the +Name production. A name must not appear more than once in an XML document as a value of this type; i.e., ID values must uniquely identify the elements which bear them. -

+

One ID per Element Type @@ -2808,200 +1633,108 @@ identify the elements which bear them. ID Attribute Default -

An ID attribute must have a declared default of - #IMPLIED - or - #REQUIRED -.

+

An ID attribute must have a declared default of #IMPLIED or +#REQUIRED.

IDREF

-Values of type - IDREF - must match -the Name - production, and -values of type IDREFS - must match - Names -; -each Name - must match the value of an ID attribute on -some element in the XML document; i.e. IDREF - values must +Values of type IDREF must match +the Name production, and +values of type IDREFS must match +Names; +each Name must match the value of an ID attribute on +some element in the XML document; i.e. IDREF values must match the value of some ID attribute. -

+

Entity Name

-Values of type - ENTITY - -must match the Name - production, -values of type ENTITIES - must match - Names -; -each Name - must +Values of type ENTITY +must match the Name production, +values of type ENTITIES must match +Names; +each Name must match the -name of an unparsed entity - declared in the - DTD -. -

+name of an unparsed entity declared in the +DTD. +

Name Token

-Values of type - NMTOKEN - must match the - Nmtoken - production; -values of type NMTOKENS - must -match Nmtokens -. -

+Values of type NMTOKEN must match the +Nmtoken production; +values of type NMTOKENS must +match Nmtokens. +

-

- - Enumerated attributes - can take one -of a list of values provided in the declaration -. There are two +

Enumerated attributes can take one +of a list of values provided in the declaration. There are two kinds of enumerated types: - - Enumerated Attribute Types - - EnumeratedType - - NotationType - -| Enumeration - - - - - NotationType - 'NOTATION' - - S - +Enumerated Attribute TypesEnumeratedTypeNotationType +| Enumeration +NotationType'NOTATION' +S '(' - S -? - Name - -( S -? '|' S -? - Name -)* - S -? ')' - - - - - Enumeration - '(' - S -? - Nmtoken - -( S -? '|' - S -? - Nmtoken -)* - S -? -')' - - - - -A NOTATION - attribute identifies a - notation -, declared in the +S? +Name +(S? '|' S? +Name)* +S? ')' +Enumeration'(' S? +Nmtoken +(S? '|' +S? +Nmtoken)* +S? +')' +A NOTATION attribute identifies a +notation, declared in the DTD with associated system and/or public identifiers, to be used in interpreting the element to which the attribute is attached. -

+

Notation Attributes

Values of this type must match -one of the - notation - names included in +one of the notation names included in the declaration; all notation names in the declaration must be declared. -

+

Enumeration

Values of this type -must match one of the - Nmtoken - tokens in the +must match one of the Nmtoken tokens in the declaration. -

+

-

- For interoperability, - the same - Nmtoken - should not occur more than once in the +

For interoperability, the same +Nmtoken should not occur more than once in the enumerated attribute types of a single element type. -

+

Attribute Defaults -

An - attribute declaration - provides +

An attribute declaration provides information on whether the attribute's presence is required, and if not, how an XML processor should react if a declared attribute is absent in a document. - - Attribute Defaults - - - DefaultDecl - '#REQUIRED' -| '#IMPLIED' - | (('#FIXED' S)? - AttValue -) - - - - - - - +Attribute DefaultsDefaultDecl'#REQUIRED' +| '#IMPLIED' | (('#FIXED' S)? AttValue) - -

-

In an attribute declaration, - #REQUIRED - means that the -attribute must always be provided, #IMPLIED - that no default +

+

In an attribute declaration, #REQUIRED means that the +attribute must always be provided, #IMPLIED that no default value is provided. - - If the +If the declaration -is neither - #REQUIRED - nor #IMPLIED -, then the - AttValue - value contains the declared - default - value; the #FIXED - keyword states that +is neither #REQUIRED nor #IMPLIED, then the +AttValue value contains the declared +default value; the #FIXED keyword states that the attribute must always have the default value. If a default value is declared, when an XML processor encounters an omitted attribute, it is to behave as though the attribute were present with -the declared default value. -

+the declared default value.

Required Attribute -

If the default declaration is the keyword - #REQUIRED -, then +

If the default declaration is the keyword #REQUIRED, then the attribute must be specified for all elements of the type in the attribute-list declaration. -

+

Attribute Default Legal @@ -3046,52 +1769,33 @@ default value must meet the lexical constraints of the declared attribute type. Fixed Attribute Default

If an attribute has a default value declared with the - - #FIXED - keyword, instances of that attribute must +#FIXED keyword, instances of that attribute must match the default value. -

+

Examples of attribute-list declarations: - - <!ATTLIST termdef +<!ATTLIST termdef id ID #REQUIRED name CDATA #IMPLIED> <!ATTLIST list type (bullets|ordered|glossary) "ordered"> <!ATTLIST form - method CDATA #FIXED "POST"> -

+ method CDATA #FIXED "POST">

Attribute-Value Normalization

Before the value of an attribute is passed to the application or checked for validity, the XML processor must normalize it as follows: - - - -

a character reference is processed by appending the referenced -character to the attribute value

- - -

an entity reference is processed by recursively processing the -replacement text of the entity

-
- -

a whitespace character (#x20, #xD, #xA, #x9) is processed by +

a character reference is processed by appending the referenced +character to the attribute value

an entity reference is processed by recursively processing the +replacement text of the entity

a whitespace character (#x20, #xD, #xA, #x9) is processed by appending #x20 to the normalized value, except that only a single #x20 is appended for a "#xD#xA" sequence that is part of an external parsed entity or the literal entity value of an internal parsed -entity

-
- -

other characters are processed by appending them to the normalized -value

-
- - -

+entity

other characters are processed by appending them to the normalized +value

+

If the declared value is not CDATA, then the XML processor must further process the normalized attribute value by discarding any leading and trailing space (#x20) characters, and by replacing @@ -3100,111 +1804,58 @@ character.

All attributes for which no declaration has been read should be treated by a non-validating parser as if declared - - CDATA -. -

+CDATA. +

Conditional Sections -

- - - Conditional sections - are portions of the - document type declaration external subset - +

+Conditional sections are portions of the +document type declaration external subset which are included in, or excluded from, the logical structure of the DTD based on -the keyword which governs them. - - - Conditional Section - - - conditionalSect - - includeSect - -| ignoreSect - - - - - includeSect - '<![' S? 'INCLUDE' S? '[' - - - extSubsetDecl +the keyword which governs them. +Conditional SectionconditionalSectincludeSect +| ignoreSect +includeSect'<![' S? 'INCLUDE' S? '[' +extSubsetDecl ']]>' - - - - ignoreSect - '<![' S? 'IGNORE' S? '[' - - ignoreSectContents -* -']]>' - - - ignoreSectContents - - Ignore - -('<![' ignoreSectContents - ']]>' - Ignore -)* - - - Ignore - - Char -* - -( Char -* ('<![' | ']]>') - Char -*) - - - - - -

+ignoreSect'<![' S? 'IGNORE' S? '[' +ignoreSectContents* +']]>'ignoreSectContentsIgnore +('<![' ignoreSectContents ']]>' +Ignore)*IgnoreChar* - +(Char* ('<![' | ']]>') +Char*) + +

Like the internal and external DTD subsets, a conditional section may contain one or more complete declarations, comments, processing instructions, or nested conditional sections, intermingled with white space.

If the keyword of the -conditional section is - INCLUDE -, then the contents of the conditional +conditional section is INCLUDE, then the contents of the conditional section are part of the DTD. If the keyword of the conditional -section is IGNORE -, then the contents of the conditional section are +section is IGNORE, then the contents of the conditional section are not logically part of the DTD. Note that for reliable parsing, the contents of even ignored conditional sections must be read in order to detect nested conditional sections and ensure that the end of the outermost (ignored) conditional section is properly detected. If a conditional section with a -keyword of INCLUDE - occurs within a larger conditional -section with a keyword of IGNORE -, both the outer and the -inner conditional sections are ignored.

+keyword of INCLUDE occurs within a larger conditional +section with a keyword of IGNORE, both the outer and the +inner conditional sections are ignored.

If the keyword of the conditional section is a parameter-entity reference, the parameter entity must be replaced by its content before the processor decides whether to include or ignore the conditional section.

An example: - - <!ENTITY % draft 'INCLUDE' > +<!ENTITY % draft 'INCLUDE' > <!ENTITY % final 'IGNORE' > <![%draft;[ @@ -3214,8 +1865,7 @@ include or ignore the conditional section.

<!ELEMENT book (title, body, supplements?)> ]]> - -

+

Physical Structures -

- An XML document may consist +

An XML document may consist of one or many storage units. These are called - - entities -; they all have content - and are all +entities; they all have content and are all (except for the document entity, see below, and -the external DTD subset -) -identified by name -. - - +the external DTD subset) +identified by name. + Each XML document has one entity -called the document entity -, which serves -as the starting point for the XML -processor - and may contain the whole document.

+called the document entity, which serves +as the starting point for the XML +processor and may contain the whole document.

Entities may be either parsed or unparsed. - - A - parsed entity's - +A parsed entity's contents are referred to as its - replacement text -; -this text - is considered an -integral part of the document. -

-

- An - - unparsed entity - +replacement text; +this text is considered an +integral part of the document.

+

An +unparsed entity is a resource whose contents may or may not be - text -, and if text, may not be XML. +text, and if text, may not be XML. Each unparsed entity -has an associated notation -, identified by name. +has an associated notation, identified by name. Beyond a requirement that an XML processor make the identifiers for the entity and notation available to the application, -XML places no constraints on the contents of unparsed entities. - -

+XML places no constraints on the contents of unparsed entities. +

Parsed entities are invoked by name using entity references; -unparsed entities by name, given in the value of - ENTITY - -or ENTITIES - -attributes.

-

- - General entities - +unparsed entities by name, given in the value of ENTITY +or ENTITIES +attributes.

+

General entities are entities for use within the document content. In this specification, general entities are sometimes referred -to with the unqualified term entity - when this leads -to no ambiguity. - - Parameter entities +to with the unqualified term entity when this leads +to no ambiguity. +Parameter entities are parsed entities for use within the DTD. - These two types of entities use different forms of reference and are recognized in different contexts. Furthermore, they occupy different namespaces; a parameter entity and a general entity with the same name are two distinct entities. -

+

Character and Entity References -

- -A - character reference - refers to a specific character in the +

+A character reference refers to a specific character in the ISO/IEC 10646 character set, for example one not directly accessible from available input devices. - - Character Reference - - CharRef - '&#' [0-9]+ ';' - | '&hcro;' [0-9a-fA-F]+ ';' - - - - - - Legal Character -

Characters referred to using character references must +Character ReferenceCharRef'&#' [0-9]+ ';' | '&hcro;' [0-9a-fA-F]+ ';' +Legal Character

Characters referred to using character references must match the production for - - Char -.

- - -If the character reference begins with " &#x -", the digits and -letters up to the terminating ; - provide a hexadecimal +Char.

+If the character reference begins with "&#x", the digits and +letters up to the terminating ; provide a hexadecimal representation of the character's code point in ISO/IEC 10646. -If it begins just with " &# -", the digits up to the terminating - ; - provide a decimal representation of the character's +If it begins just with "&#", the digits up to the terminating +; provide a decimal representation of the character's code point. - - -

-

- An - entity -reference - refers to the content of a named entity. - - References to + +

+

An entity +reference refers to the content of a named entity. +References to parsed general entities -use ampersand ( - & -) and semicolon ( ; -) as -delimiters. - - - - Parameter-entity references - use percent-sign ( % -) and +use ampersand (&) and semicolon (;) as +delimiters. + +Parameter-entity references use percent-sign (%) and semicolon -( ; -) as delimiters. - -

+(;) as delimiters. +

Entity Reference Reference - - EntityRef - -| CharRef - + EntityRef +| CharRef EntityRef - '&' - Name - ';' + '&' Name ';' @@ -3404,9 +1983,7 @@ semicolon PEReference - '%' - Name - ';' + '%' Name ';' @@ -3416,64 +1993,45 @@ semicolon Entity Declared

In a document without any DTD, a document with only an internal DTD subset which contains no parameter entity references, or a document with -" - standalone='yes' -", -the Name - given in the entity reference must - match - that in an - entity declaration -, except that +"standalone='yes'", +the Name given in the entity reference must +match that in an +entity declaration, except that well-formed documents need not declare any of the following entities: &magicents;. The declaration of a parameter entity must precede any reference to it. Similarly, the declaration of a general entity must precede any reference to it which appears in a default value in an attribute-list -declaration.

+declaration.

Note that if entities are declared in the external subset or in external parameter entities, a non-validating processor is - - not obligated to - read +not obligated to read and process their declarations; for such documents, the rule that an entity must be declared is a well-formedness constraint only -if standalone='yes' -.

+if standalone='yes'.

Entity Declared

In a document with an external subset or external parameter -entities with " - standalone='no' -", -the Name - given in the entity reference must match - that in an - entity declaration -. +entities with "standalone='no'", +the Name given in the entity reference must match that in an +entity declaration. For interoperability, valid documents should declare the entities &magicents;, in the form -specified in -. +specified in . The declaration of a parameter entity must precede any reference to it. Similarly, the declaration of a general entity must precede any reference to it which appears in a default value in an attribute-list -declaration.

+declaration.

Parsed Entity

-An entity reference must not contain the name of an - unparsed entity -. Unparsed entities may be referred -to only in attribute values - declared to -be of type ENTITY - or ENTITIES -. -

+An entity reference must not contain the name of an unparsed entity. Unparsed entities may be referred +to only in attribute values declared to +be of type ENTITY or ENTITIES. +

No Recursion @@ -3486,212 +2044,93 @@ either directly or indirectly. In DTD

Parameter-entity references may only appear in the - - DTD -. -

+DTD. +

Examples of character and entity references: - - Type <key>less-than</key> (&hcro;3C;) to save options. +Type <key>less-than</key> (&hcro;3C;) to save options. This document was prepared on &docdate; and -is classified &security-level;. -

+is classified &security-level;.

Example of a parameter-entity reference: - - - + -%ISOLat2;]]> -

+%ISOLat2;]]>

Entity Declarations -

- +

Entities are declared thus: - - - Entity Declaration - - - EntityDecl - - GEDecl - - | PEDecl - - - - - GEDecl - '<!ENTITY' - S - Name - - S - EntityDef - - S -? '>' - - - PEDecl - '<!ENTITY' - S - '%' S - - Name - S - - PEDef - S -? '>' - - - - EntityDef - - EntityValue - +Entity DeclarationEntityDeclGEDecl | PEDeclGEDecl'<!ENTITY' S Name +S EntityDef +S? '>'PEDecl'<!ENTITY' S '%' S +Name S +PEDef S? '>'EntityDefEntityValue -| ( ExternalID - - NDataDecl -?) - - - - - PEDef - - EntityValue - -| ExternalID - - - - - -The Name - identifies the entity in an - entity reference - or, in the case of an -unparsed entity, in the value of an ENTITY - or ENTITIES - +-->| (ExternalID +NDataDecl?)PEDefEntityValue +| ExternalID +The Name identifies the entity in an +entity reference or, in the case of an +unparsed entity, in the value of an ENTITY or ENTITIES attribute. If the same entity is declared more than once, the first declaration encountered is binding; at user option, an XML processor may issue a -warning if entities are declared multiple times. - -

+warning if entities are declared multiple times. +

Internal Entities -

- If +

If the entity definition is an - - EntityValue -, -the defined entity is called an internal entity -. +EntityValue, +the defined entity is called an internal entity. There is no separate physical storage object, and the content of the entity is given in the -declaration. - +declaration. Note that some processing of entity and character references in the - literal entity value - may be required to -produce the correct replacement -text -: see -. -

-

An internal entity is a - parsed -entity -.

+literal entity value may be required to +produce the correct replacement +text: see . +

+

An internal entity is a parsed +entity.

Example of an internal entity declaration: - - <!ENTITY Pub-Status "This is a pre-release of the - specification."> -

+<!ENTITY Pub-Status "This is a pre-release of the + specification.">

External Entities

If the entity is not -internal, it is an - external -entity -, declared as follows: - - External Entity Declaration - - - ExternalID - 'SYSTEM' - S - - SystemLiteral - - | 'PUBLIC' - S - - PubidLiteral - - S - - SystemLiteral - - - - - NDataDecl - - S - 'NDATA' S - - Name - - - - - -If the NDataDecl - is present, this is a -general unparsed -entity -; otherwise it is a parsed entity. + -->ExternalID'SYSTEM' S +SystemLiteral| 'PUBLIC' S +PubidLiteral +S +SystemLiteral +NDataDeclS 'NDATA' S +Name +If the NDataDecl is present, this is a +general unparsed +entity; otherwise it is a parsed entity.

Notation Declared

-The - Name - must match the declared name of a - notation -. -

+The Name must match the declared name of a +notation. +

-

- The - - SystemLiteral - -is called the entity's system identifier -. It is a URI, -which may be used to retrieve the entity. - -Note that the hash mark ( # -) and fragment identifier +

The +SystemLiteral +is called the entity's system identifier. It is a URI, +which may be used to retrieve the entity. +Note that the hash mark (#) and fragment identifier frequently used with URIs are not, formally, part of the URI itself; an XML processor may signal an error if a fragment identifier is given as part of a system identifier. @@ -3701,70 +2140,46 @@ DTD, or a processing instruction defined by a particular application specification), relative URIs are relative to the location of the resource within which the entity declaration occurs. A URI might thus be relative to the - document entity -, to the entity -containing the external DTD subset -, -or to some other external parameter entity -. -

+document entity, to the entity +containing the external DTD subset, +or to some other external parameter entity. +

An XML processor should handle a non-ASCII character in a URI by representing the character in UTF-8 as one or more bytes, and then escaping these bytes with the URI escaping mechanism (i.e., by converting each byte to %HH, where HH is the hexadecimal notation of the byte value).

-

- +

In addition to a system identifier, an external identifier may -include a - public identifier -. - +include a public identifier. An XML processor attempting to retrieve the entity's content may use the public identifier to try to generate an alternative URI. If the processor is unable to do so, it must use the URI specified in the system literal. Before a match is attempted, all strings of white space in the public identifier must be normalized to single space characters (#x20), -and leading and trailing white space must be removed.

+and leading and trailing white space must be removed.

Examples of external entity declarations: - - <!ENTITY open-hatch +<!ENTITY open-hatch SYSTEM "http://www.textuality.com/boilerplate/OpenHatch.xml"> <!ENTITY open-hatch PUBLIC "-//Textuality//TEXT Standard open-hatch boilerplate//EN" "http://www.textuality.com/boilerplate/OpenHatch.xml"> <!ENTITY hatch-pic SYSTEM "../grafix/OpenHatch.gif" - NDATA gif > -

+ NDATA gif >

Parsed Entities The Text Declaration -

External parsed entities may each begin with a - text -declaration -. - - Text Declaration - - - TextDecl - &xmlpio; - - VersionInfo -? - EncodingDecl - - S -? &pic; - - - - -

+

External parsed entities may each begin with a text +declaration. +Text DeclarationTextDecl&xmlpio; +VersionInfo? +EncodingDecl +S? &pic; +

The text declaration must be provided literally, not by reference to a parsed entity. No text declaration may appear at any position other than the beginning of @@ -3773,64 +2188,33 @@ an external parsed entity.

Well-Formed Parsed Entities

The document entity is well-formed if it matches the production labeled - - document -. +document. An external general parsed entity is well-formed if it matches the production labeled - extParsedEnt -. +extParsedEnt. An external parameter entity is well-formed if it matches the production labeled - extPE -. - - Well-Formed External Parsed Entity - - extParsedEnt - - TextDecl -? - content - - - - extPE - - TextDecl -? - extSubsetDecl - - - - +extPE. +Well-Formed External Parsed EntityextParsedEntTextDecl? +contentextPETextDecl? +extSubsetDecl An internal general parsed entity is well-formed if its replacement text matches the production labeled - content -. +content. All internal parameter entities are well-formed by definition. -

+

A consequence of well-formedness in entities is that the logical and physical structures in an XML document are properly nested; no - - start-tag -, - end-tag -, - empty-element tag -, - element -, - comment -, - processing instruction -, - character -reference -, or - entity reference - -can begin in one entity and end in another.

+start-tag, +end-tag, +empty-element tag, +element, +comment, +processing instruction, +character +reference, or +entity reference +can begin in one entity and end in another.

Character Encoding in Entities @@ -3851,83 +2235,46 @@ the UTF-8 and UTF-16 encodings, it is recognized that other encodings are used around the world, and it may be desired for XML processors to read entities that use them. Parsed entities which are stored in an encoding other than -UTF-8 or UTF-16 must begin with a - text -declaration - containing an encoding declaration: - - Encoding Declaration - - EncodingDecl - - S - -'encoding' Eq - -('"' EncName - '"' | -"'" EncName - "'" ) - - - - EncName - [A-Za-z] ([A-Za-z0-9._] | '-')* - Encoding name contains only Latin characters - - - -In the document entity -, the encoding -declaration is part of the XML declaration -. -The EncName - is the name of the encoding used. -

+UTF-8 or UTF-16 must begin with a text +declaration containing an encoding declaration: +Encoding DeclarationEncodingDeclS +'encoding' Eq +('"' EncName '"' | +"'" EncName "'" ) +EncName[A-Za-z] ([A-Za-z0-9._] | '-')*Encoding name contains only Latin characters +In the document entity, the encoding +declaration is part of the XML declaration. +The EncName is the name of the encoding used. +

In an encoding declaration, the values -" - UTF-8 -", -" UTF-16 -", -" ISO-10646-UCS-2 -", and -" ISO-10646-UCS-4 -" should be +"UTF-8", +"UTF-16", +"ISO-10646-UCS-2", and +"ISO-10646-UCS-4" should be used for the various encodings and transformations of Unicode / ISO/IEC 10646, the values -" ISO-8859-1 -", -" ISO-8859-2 -", ... -" ISO-8859-9 -" should be used for the parts of ISO 8859, and +"ISO-8859-1", +"ISO-8859-2", ... +"ISO-8859-9" should be used for the parts of ISO 8859, and the values -" ISO-2022-JP -", -" Shift_JIS -", and -" EUC-JP -" +"ISO-2022-JP", +"Shift_JIS", and +"EUC-JP" should be used for the various encoded forms of JIS X-0208-1997. XML processors may recognize other encodings; it is recommended that -character encodings registered (as charset -s) +character encodings registered (as charsets) with the Internet Assigned Numbers -Authority -, other than those just listed, should be +Authority , other than those just listed, should be referred to using their registered names. Note that these registered names are defined to be case-insensitive, so processors wishing to match against them should do so in a case-insensitive -way.

+way.

In the absence of information provided by an external transport protocol (e.g. HTTP or MIME), -it is an - error - for an entity including +it is an error for an entity including an encoding declaration to be presented to the XML processor in an encoding other than that named in the declaration, for an encoding declaration to occur other than at the beginning @@ -3936,97 +2283,40 @@ an entity which begins with neither a Byte Order Mark nor an encoding declaration to use an encoding other than UTF-8. Note that since ASCII is a subset of UTF-8, ordinary ASCII entities do not strictly need -an encoding declaration.

-

It is a - fatal error - when an XML processor -encounters an entity with an encoding that it is unable to process.

+an encoding declaration.

+

It is a fatal error when an XML processor +encounters an entity with an encoding that it is unable to process.

Examples of encoding declarations: - - <?xml encoding='UTF-8'?> -<?xml encoding='EUC-JP'?> -

+<?xml encoding='UTF-8'?> +<?xml encoding='EUC-JP'?>

XML Processor Treatment of Entities and References

The table below summarizes the contexts in which character references, entity references, and invocations of unparsed entities might appear and the -required behavior of an - XML processor - in +required behavior of an XML processor in each case. The labels in the leftmost column describe the recognition context: - - - - -

as a reference -anywhere after the - start-tag - and -before the end-tag - of an element; corresponds -to the nonterminal content -.

- - - - - -

as a reference within either the value of an attribute in a - - start-tag -, or a default -value in an attribute declaration -; +

as a reference +anywhere after the start-tag and +before the end-tag of an element; corresponds +to the nonterminal content.

as a reference within either the value of an attribute in a +start-tag, or a default +value in an attribute declaration; corresponds to the nonterminal - AttValue -.

-
-
- - - -

as a - Name -, not a reference, appearing either as +AttValue.

as a Name, not a reference, appearing either as the value of an -attribute which has been declared as type ENTITY -, or as one of +attribute which has been declared as type ENTITY, or as one of the space-separated tokens in the value of an attribute which has been -declared as type ENTITIES -.

-
-
- - - -

as a reference +declared as type ENTITIES.

as a reference within a parameter or internal entity's - - literal entity value - in +literal entity value in the entity's declaration; corresponds to the nonterminal - EntityValue -.

-
-
- - - -

as a reference within either the internal or external subsets of the - - DTD -, but outside -of an EntityValue - or - AttValue -.

-
-
- -

+EntityValue.

as a reference within either the internal or external subsets of the +DTD, but outside +of an EntityValue or +AttValue.

@@ -4141,65 +2431,50 @@ in DTD Not Recognized -

Outside the DTD, the - % - character has no +

Outside the DTD, the % character has no special significance; thus, what would be parameter entity references in the -DTD are not recognized as markup in content -. +DTD are not recognized as markup in content. Similarly, the names of unparsed entities are not recognized except when they appear in the value of an appropriately declared attribute. -

+

Included

An entity is - - included - when its - replacement text - is retrieved +included when its +replacement text is retrieved and processed, in place of the reference itself, as though it were part of the document at the location the reference was recognized. The replacement text may contain both - character data - -and (except for parameter entities) markup -, +character data +and (except for parameter entities) markup, which must be recognized in the usual way, except that the replacement text of entities used to escape markup delimiters (the entities &magicents;) is always treated as -data. (The string " AT&amp;T; -" expands to -" AT&T; -" and the remaining ampersand is not recognized +data. (The string "AT&amp;T;" expands to +"AT&T;" and the remaining ampersand is not recognized as an entity-reference delimiter.) -A character reference is included - when the indicated +A character reference is included when the indicated character is processed in place of the reference itself. - +

Included If Validating

When an XML processor recognizes a reference to a parsed entity, in order -to - validate - +to validate the document, the processor must - include - its +include its replacement text. If the entity is external, and the processor is not attempting to validate the XML document, the -processor may -, but need not, +processor may, but need not, include the entity's replacement text. If a non-validating parser does not include the replacement text, it must inform the application that it recognized, but did not -read, the entity.

+read, the entity.

This rule is based on the recognition that the automatic inclusion provided by the SGML and XML entity mechanism, primarily designed to support modularity in authoring, is not necessarily @@ -4212,98 +2487,62 @@ presence and retrieve it for display only on demand. Forbidden

The following are forbidden, and constitute - - fatal - errors: - - -

the appearance of a reference to an - - unparsed entity -. -

- - -

the appearance of any character or general-entity reference in the -DTD except within an - EntityValue - or - AttValue -.

-
- -

a reference to an external entity in an attribute value.

-
- - -

+fatal errors: +

the appearance of a reference to an +unparsed entity. +

the appearance of any character or general-entity reference in the +DTD except within an EntityValue or +AttValue.

a reference to an external entity in an attribute value.

+

Included in Literal -

When an - entity reference - appears in an +

When an entity reference appears in an attribute value, or a parameter entity reference appears in a literal entity -value, its replacement text - is +value, its replacement text is processed in place of the reference itself as though it were part of the document at the location the reference was recognized, except that a single or double quote character in the replacement text is always treated as a normal data character and will not terminate the literal. For example, this is well-formed: - - -]]> - + +]]> while this is not: - <!ENTITY EndAttr "27'" > +<!ENTITY EndAttr "27'" > <element attribute='a-&EndAttr;> - -

+

Notify -

When the name of an - unparsed -entity - appears as a token in the -value of an attribute of declared type ENTITY - or ENTITIES -, +

When the name of an unparsed +entity appears as a token in the +value of an attribute of declared type ENTITY or ENTITIES, a validating processor must inform the -application of the system - -and public - (if any) +application of the system +and public (if any) identifiers for both the entity and its associated - notation -.

+notation.

Bypassed

When a general entity reference appears in the - - EntityValue - in an entity declaration, -it is bypassed and left as is.

+EntityValue in an entity declaration, +it is bypassed and left as is.

Included as PE

Just as with external parsed entities, parameter entities -need only be - included if -validating -. +need only be included if +validating. When a parameter-entity reference is recognized in the DTD and included, its - replacement -text - is enlarged by the attachment of one leading and one following +replacement +text is enlarged by the attachment of one leading and one following space (#x20) character; the intent is to constrain the replacement text of parameter entities to contain an integral number of grammatical tokens in the DTD. -

+

@@ -4311,198 +2550,130 @@ entities to contain an integral number of grammatical tokens in the DTD.

In discussing the treatment of internal entities, it is useful to distinguish two forms of the entity's value. - - The - literal -entity value - is the quoted string actually +The literal +entity value is the quoted string actually present in the entity declaration, corresponding to the -non-terminal EntityValue -. - - The - replacement -text - is the content of the entity, after +non-terminal EntityValue. +The replacement +text is the content of the entity, after replacement of character references and parameter-entity references. - -

+

The literal entity value as given in an internal entity declaration -( - EntityValue -) may contain character, +(EntityValue) may contain character, parameter-entity, and general-entity references. Such references must be contained entirely within the literal entity value. The actual replacement text that is - included - as described above -must contain the replacement text - of any +included as described above +must contain the replacement text of any parameter entities referred to, and must contain the character referred to, in place of any character references in the literal entity value; however, general-entity references must be left as-is, unexpanded. For example, given the following declarations: - - + ]]> - -then the replacement text for the entity " book -" is: - La Peste: Albert Camus, +© 1947 %pub;. &rights;" >]]> +then the replacement text for the entity "book" is: +La Peste: Albert Camus, © 1947 Éditions Gallimard. &rights; - -The general-entity reference " &rights; -" would be expanded -should the reference " &book; -" appear in the document's -content or an attribute value.

+The general-entity reference "&rights;" would be expanded +should the reference "&book;" appear in the document's +content or an attribute value.

These simple rules may have complex interactions; for a detailed discussion of a difficult example, see - - -. -

+. +

Predefined Entities

Entity and character -references can both be used to - escape - the left angle bracket, +references can both be used to escape the left angle bracket, ampersand, and other delimiters. A set of general entities (&magicents;) is specified for this purpose. Numeric character references may also be used; they are expanded immediately when recognized and must be treated as character data, so the numeric character references -" &#60; -" and " &#38; -" may be used to -escape < - and & - when they occur -in character data. +"&#60;" and "&#38;" may be used to +escape < and & when they occur +in character data.

All XML processors must recognize these entities whether they are declared or not. - - For interoperability -, +For interoperability, valid XML documents should declare these entities, like any others, before using them. If the entities in question are declared, they must be declared as internal entities whose replacement text is the single character being escaped or a character reference to that character, as shown below. - - + -]]> - -Note that the < - and & - characters -in the declarations of " lt -" and " amp -" +]]> +Note that the < and & characters +in the declarations of "lt" and "amp" are doubly escaped to meet the requirement that entity replacement be well-formed. -

+

Notation Declarations

- - Notations - identify by -name the format of unparsed -entities -, the + Notations identify by +name the format of unparsed +entities, the format of elements which bear a notation attribute, or the application to which -a processing instruction - is -addressed. +a processing instruction is +addressed.

- - Notation declarations - +Notation declarations provide a name for the notation, for use in entity and attribute-list declarations and in attribute specifications, and an external identifier for the notation which may allow an XML processor or its client application to locate a helper application capable of processing data in the given notation. - - Notation Declarations - - NotationDecl - '<!NOTATION' - S - Name - - S - -( ExternalID - | - PublicID -) - S -? '>' - - - PublicID - 'PUBLIC' - S - - PubidLiteral - - - - - - +Notation DeclarationsNotationDecl'<!NOTATION' S Name +S +(ExternalID | +PublicID) +S? '>'PublicID'PUBLIC' S +PubidLiteral + +

XML processors must provide applications with the name and external identifier(s) of any notation declared and referred to in an attribute value, attribute definition, or entity declaration. They may additionally resolve the external identifier into the - - system identifier -, +system identifier, file name, or other information needed to allow the application to call a processor for data in the notation described. (It is not an error, however, for XML documents to declare and refer to notations for which notation-specific applications are not available on -the system where the XML processor or application is running.)

+the system where the XML processor or application is running.)

Document Entity -

- The - document -entity - serves as the root of the entity -tree and a starting-point for an XML -processor -. - +

The document +entity serves as the root of the entity +tree and a starting-point for an XML +processor. This specification does not specify how the document entity is to be located by an XML processor; unlike other entities, the document entity has no name and might well appear on a processor input stream -without any identification at all.

+without any identification at all.

@@ -4510,69 +2681,47 @@ without any identification at all.

Conformance Validating and Non-Validating Processors -

Conforming - XML processors - fall into two -classes: validating and non-validating.

+

Conforming XML processors fall into two +classes: validating and non-validating.

Validating and non-validating processors alike must report violations of this specification's well-formedness constraints in the content of the - - document entity - and any -other parsed entities - that -they read.

-

- - - Validating processors - must report +document entity and any +other parsed entities that +they read.

+

+Validating processors must report violations of the constraints expressed by the declarations in the - DTD -, and +DTD, and failures to fulfill the validity constraints given in this specification. - - + To accomplish this, validating XML processors must read and process the entire DTD and all external parsed entities referenced in the document. -

+

Non-validating processors are required to check only the - - document entity -, including +document entity, including the entire internal DTD subset, for well-formedness. - + While they are not required to check the document for validity, they are required to - - process - all the declarations they read in the +process all the declarations they read in the internal DTD subset and in any parameter entity that they read, up to the first reference -to a parameter entity that they do not - read; that is to +to a parameter entity that they do not read; that is to say, they must use the information in those declarations to - normalize - attribute values, - include - the replacement text of +normalize attribute values, +include the replacement text of internal entities, and supply - default attribute values -. - - -They must not process - - entity declarations - or - attribute-list declarations - +default attribute values. + +They must not process +entity declarations or +attribute-list declarations encountered after a reference to a parameter entity that is not read, since the entity may have contained overriding declarations. -

+

Using XML Processors @@ -4582,44 +2731,25 @@ validity violations. Less is required of a non-validating processor; it need not read any part of the document other than the document entity. This has two effects that may be important to users of XML processors: - - - -

Certain well-formedness errors, specifically those that require +

Certain well-formedness errors, specifically those that require reading external entities, may not be detected by a non-validating processor. Examples include the constraints entitled - - Entity Declared -, - Parsed Entity -, and - No Recursion -, as well +Entity Declared, +Parsed Entity, and +No Recursion, as well as some of the cases described as - forbidden - in - -.

-
- -

The information passed from the processor to the application may +forbidden in +.

The information passed from the processor to the application may vary, depending on whether the processor reads parameter and external entities. For example, a non-validating processor may not - - normalize - attribute values, - include - the replacement text of +normalize attribute values, +include the replacement text of internal entities, or supply - default attribute values -, +default attribute values, where doing so depends on having read declarations in -external or parameter entities.

-
-
- -

+external or parameter entities.

+

For maximum reliability in interoperating between different XML processors, applications which use non-validating processors should not rely on any behaviors not required of such processors. @@ -4633,9 +2763,7 @@ entities should use validating XML processors.

The formal grammar of XML is given in this specification using a simple Extended Backus-Naur Form (EBNF) notation. Each rule in the grammar defines one symbol, in the form - - symbol ::= expression -

+symbol ::= expression

Symbols are written with an initial capital letter if they are defined by a regular expression, or with an initial lower case letter otherwise. @@ -4644,211 +2772,35 @@ Literal strings are quoted.

Within the expression on the right-hand side of a rule, the following expressions are used to match strings of one or more characters: - - - - - -

where - N - is a hexadecimal integer, the +

where N is a hexadecimal integer, the expression matches the character in ISO/IEC 10646 whose canonical (UCS-4) code value, when interpreted as an unsigned binary number, has the value indicated. The number of leading zeros in the - #xN - form is insignificant; the number of leading +#xN form is insignificant; the number of leading zeros in the corresponding code value is governed by the character -encoding in use and is not significant for XML.

- - - - - -

matches any - character - -with a value in the range(s) indicated (inclusive).

-
-
- - - -

matches any - character - -with a value outside - the -range indicated.

-
-
- - - -

matches any - character - -with a value not among the characters given.

-
-
- - - -

matches a literal string - matching - -that given inside the double quotes.

-
-
- - - -

matches a literal string - matching - -that given inside the single quotes.

-
-
- - +encoding in use and is not significant for XML.

matches any character +with a value in the range(s) indicated (inclusive).

matches any character +with a value outside the +range indicated.

matches any character +with a value not among the characters given.

matches a literal string matching +that given inside the double quotes.

matches a literal string matching +that given inside the single quotes.

These symbols may be combined to match more complex patterns as follows, -where A - and B - represent simple expressions: - - - - -

- expression - is treated as a unit -and may be combined as described in this list.

-
-
- - - -

matches - A - or nothing; optional A -.

-
-
- - - -

matches - A - followed by B -.

-
-
- - - -

matches - A - or B - but not both.

-
-
- - - -

matches any string that matches - A - but does not match - B -. -

-
-
- - - -

matches one or more occurrences of - A -.

-
-
- - - -

matches zero or more occurrences of - A -.

-
-
-
- +where A and B represent simple expressions: +

expression is treated as a unit +and may be combined as described in this list.

matches A or nothing; optional A.

matches A followed by B.

matches A or B but not both.

matches any string that matches A but does not match +B. +

matches one or more occurrences of A.

matches zero or more occurrences of A.

Other notations used in the productions are: - - - - -

comment.

-
-
- - - -

well-formedness constraint; this identifies by name a +

comment.

well-formedness constraint; this identifies by name a constraint on - - well-formed - documents -associated with a production.

-
-
- - - -

validity constraint; this identifies by name a constraint on - - valid - documents associated with -a production.

-
-
-
- -

+well-formed documents +associated with a production.

validity constraint; this identifies by name a constraint on +valid documents associated with +a production.

+

@@ -4860,54 +2812,41 @@ a production.

Normative References -(Internet Assigned Numbers Authority) - Official Names for -Character Sets -, +(Internet Assigned Numbers Authority) Official Names for +Character Sets, ed. Keld Simonsen et al. -See ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets -. - +See ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets. + IETF (Internet Engineering Task Force). - - RFC 1766: Tags for the Identification of Languages -, +RFC 1766: Tags for the Identification of Languages, ed. H. Alvestrand. 1995. - + (International Organization for Standardization). - - ISO 639:1988 (E). +ISO 639:1988 (E). Code for the representation of names of languages. - [Geneva]: International Organization for -Standardization, 1988. +Standardization, 1988. (International Organization for Standardization). - - ISO 3166-1:1997 (E). +ISO 3166-1:1997 (E). Codes for the representation of names of countries and their subdivisions — Part 1: Country codes - [Geneva]: International Organization for -Standardization, 1997. +Standardization, 1997. ISO (International Organization for Standardization). - - ISO/IEC 10646-1993 (E). Information technology — Universal +ISO/IEC 10646-1993 (E). Information technology — Universal Multiple-Octet Coded Character Set (UCS) — Part 1: Architecture and Basic Multilingual Plane. - [Geneva]: International Organization for Standardization, 1993 (plus amendments AM 1 through AM 7). - + The Unicode Consortium. - - The Unicode Standard, Version 2.0. - -Reading, Mass.: Addison-Wesley Developers Press, 1996. +The Unicode Standard, Version 2.0. +Reading, Mass.: Addison-Wesley Developers Press, 1996. @@ -4915,88 +2854,67 @@ Reading, Mass.: Addison-Wesley Developers Press, 1996. Aho, Alfred V., Ravi Sethi, and Jeffrey D. Ullman. - - Compilers: Principles, Techniques, and Tools -. -Reading: Addison-Wesley, 1986, rpt. corr. 1988. +Compilers: Principles, Techniques, and Tools. +Reading: Addison-Wesley, 1986, rpt. corr. 1988. Berners-Lee, T., R. Fielding, and L. Masinter. - - Uniform Resource Identifiers (URI): Generic Syntax and -Semantics -. +Uniform Resource Identifiers (URI): Generic Syntax and +Semantics. 1997. -(Work in progress; see updates to RFC1738.) +(Work in progress; see updates to RFC1738.) Brüggemann-Klein, Anne. - - Regular Expressions into Finite Automata -. +Regular Expressions into Finite Automata. Extended abstract in I. Simon, Hrsg., LATIN 1992, S. 97-98. Springer-Verlag, Berlin 1992. Full Version in Theoretical Computer Science 120: 197-213, 1993. - + Brüggemann-Klein, Anne, and Derick Wood. - - Deterministic Regular Languages -. +Deterministic Regular Languages. Universität Freiburg, Institut für Informatik, Bericht 38, Oktober 1991. - + James Clark. Comparison of SGML and XML. See - - http://www.w3.org/TR/NOTE-sgml-xml-971215 -. - +http://www.w3.org/TR/NOTE-sgml-xml-971215. + IETF (Internet Engineering Task Force). - - RFC 1738: Uniform Resource Locators (URL) -, +RFC 1738: Uniform Resource Locators (URL), ed. T. Berners-Lee, L. Masinter, M. McCahill. 1994. - + IETF (Internet Engineering Task Force). - - RFC 1808: Relative Uniform Resource Locators -, +RFC 1808: Relative Uniform Resource Locators, ed. R. Fielding. 1995. - + IETF (Internet Engineering Task Force). - - RFC 2141: URN Syntax -, +RFC 2141: URN Syntax, ed. R. Moats. 1997. - + ISO (International Organization for Standardization). - - ISO 8879:1986(E). Information processing — Text and Office -Systems — Standard Generalized Markup Language (SGML). - First +ISO 8879:1986(E). Information processing — Text and Office +Systems — Standard Generalized Markup Language (SGML). First edition — 1986-10-15. [Geneva]: International Organization for Standardization, 1986. - + ISO (International Organization for Standardization). - - ISO/IEC 10744-1992 (E). Information technology — +ISO/IEC 10744-1992 (E). Information technology — Hypermedia/Time-based Structuring Language (HyTime). - [Geneva]: International Organization for Standardization, 1992. - Extended Facilities Annexe. - +Extended Facilities Annexe. [Geneva]: International Organization for Standardization, 1996. - + @@ -5009,21 +2927,8 @@ diacritics), ideographic characters, and combining characters (among others, this class contains most diacritics); these classes combine to form the class of letters. Digits and extenders are also distinguished. - - - Characters - - - Letter - - BaseChar - -| Ideographic - - - - BaseChar - [#x0041-#x005A] +CharactersLetterBaseChar +| IdeographicBaseChar[#x0041-#x005A] | [#x0061-#x007A] | [#x00C0-#x00D6] | [#x00D8-#x00F6] @@ -5225,18 +3130,10 @@ also distinguished. | [#x30A1-#x30FA] | [#x3105-#x312C] | [#xAC00-#xD7A3] - - - - Ideographic - [#x4E00-#x9FA5] +Ideographic[#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029] - - - - CombiningChar - [#x0300-#x0345] +CombiningChar[#x0300-#x0345] | [#x0360-#x0361] | [#x0483-#x0486] | [#x0591-#x05A1] @@ -5331,11 +3228,7 @@ also distinguished. | [#x302A-#x302F] | #x3099 | #x309A - - - - Digit - [#x0030-#x0039] +Digit[#x0030-#x0039] | [#x0660-#x0669] | [#x06F0-#x06F9] | [#x0966-#x096F] @@ -5350,11 +3243,7 @@ also distinguished. | [#x0E50-#x0E59] | [#x0ED0-#x0ED9] | [#x0F20-#x0F29] - - - - Extender - #x00B7 +Extender#x00B7 | #x02D0 | #x02D1 | #x0387 @@ -5365,122 +3254,67 @@ also distinguished. | [#x3031-#x3035] | [#x309D-#x309E] | [#x30FC-#x30FE] - - - - - -

+
+

The character classes defined here can be derived from the Unicode character database as follows: - - - -

Name start characters must have one of the categories Ll, Lu, -Lo, Lt, Nl.

- - -

Name characters other than Name-start characters -must have one of the categories Mc, Me, Mn, Lm, or Nd.

-
- -

Characters in the compatibility area (i.e. with character code +

Name start characters must have one of the categories Ll, Lu, +Lo, Lt, Nl.

Name characters other than Name-start characters +must have one of the categories Mc, Me, Mn, Lm, or Nd.

Characters in the compatibility area (i.e. with character code greater than #xF900 and less than #xFFFE) are not allowed in XML -names.

-
- -

Characters which have a font or compatibility decomposition (i.e. those +names.

Characters which have a font or compatibility decomposition (i.e. those with a "compatibility formatting tag" in field 5 of the database -- -marked by field 5 beginning with a "<") are not allowed.

-
- -

The following characters are treated as name-start characters +marked by field 5 beginning with a "<") are not allowed.

The following characters are treated as name-start characters rather than name characters, because the property file classifies -them as Alphabetic: [#x02BB-#x02C1], #x0559, #x06E5, #x06E6.

-
- -

Characters #x20DD-#x20E0 are excluded (in accordance with -Unicode, section 5.14).

-
- -

Character #x00B7 is classified as an extender, because the -property list so identifies it.

-
- -

Character #x0387 is added as a name character, because #x00B7 -is its canonical equivalent.

-
- -

Characters ':' and '_' are allowed as name-start characters.

-
- -

Characters '-' and '.' are allowed as name characters.

-
- - -

+them as Alphabetic: [#x02BB-#x02C1], #x0559, #x06E5, #x06E6.

Characters #x20DD-#x20E0 are excluded (in accordance with +Unicode, section 5.14).

Character #x00B7 is classified as an extender, because the +property list so identifies it.

Character #x0387 is added as a name character, because #x00B7 +is its canonical equivalent.

Characters ':' and '_' are allowed as name-start characters.

Characters '-' and '.' are allowed as name characters.

+

XML and SGML

XML is designed to be a subset of SGML, in that every - - valid - XML document should also be a +valid XML document should also be a conformant SGML document. For a detailed comparison of the additional restrictions that XML places on -documents beyond those of SGML, see -. -

+documents beyond those of SGML, see . +

Expansion of Entity and Character References

This appendix contains some examples illustrating the sequence of entity- and character-reference recognition and -expansion, as specified in - -.

+expansion, as specified in .

If the DTD contains the declaration - - -An ampersand (&#38;) may be escaped +An ampersand (&#38;) may be escaped numerically (&#38;#38;) or with a general entity (&amp;).

" > -]]> - +]]> then the XML processor will recognize the character references when it parses the entity declaration, and resolve them before storing the following string as the -value of the entity " example -": - -An ampersand (&) may be escaped +value of the entity "example": +An ampersand (&) may be escaped numerically (&#38;) or with a general entity (&amp;).

-]]>
- -A reference in the document to " &example; -" +]]>
+A reference in the document to "&example;" will cause the text to be reparsed, at which time the -start- and end-tags of the " p -" element will be recognized +start- and end-tags of the "p" element will be recognized and the three references will be recognized and expanded, -resulting in a " p -" element with the following content +resulting in a "p" element with the following content (all data, no delimiters or markup): - - - -

+]]> +

A more complex example will illustrate the rules and their effects fully. In the following example, the line numbers are solely for reference. - - - + 2 4 @@ -5488,107 +3322,57 @@ solely for reference. 6 %xx; 7 ]> 8 This sample shows a &tricky; method. -]]> - +]]> This produces the following: - - -

in line 4, the reference to character 37 is expanded immediately, -and the parameter entity " - xx -" is stored in the symbol -table with the value " %zz; -". Since the replacement text -is not rescanned, the reference to parameter entity " zz -" +

in line 4, the reference to character 37 is expanded immediately, +and the parameter entity "xx" is stored in the symbol +table with the value "%zz;". Since the replacement text +is not rescanned, the reference to parameter entity "zz" is not recognized. (And it would be an error if it were, since -" zz -" is not yet declared.)

- - -

in line 5, the character reference " - &#60; -" is -expanded immediately and the parameter entity " zz -" is +"zz" is not yet declared.)

in line 5, the character reference "&#60;" is +expanded immediately and the parameter entity "zz" is stored with the replacement text -" <!ENTITY tricky "error-prone" > -", -which is a well-formed entity declaration.

-
- -

in line 6, the reference to " - xx -" is recognized, -and the replacement text of " xx -" (namely -" %zz; -") is parsed. The reference to " zz -" +"<!ENTITY tricky "error-prone" >", +which is a well-formed entity declaration.

in line 6, the reference to "xx" is recognized, +and the replacement text of "xx" (namely +"%zz;") is parsed. The reference to "zz" is recognized in its turn, and its replacement text -(" <!ENTITY tricky "error-prone" > -") is parsed. -The general entity " tricky -" has now been -declared, with the replacement text " error-prone -".

-
- -

-in line 8, the reference to the general entity " - tricky -" is +("<!ENTITY tricky "error-prone" >") is parsed. +The general entity "tricky" has now been +declared, with the replacement text "error-prone".

+in line 8, the reference to the general entity "tricky" is recognized, and it is expanded, so the full content of the -" test -" element is the self-describing (and ungrammatical) string - This sample shows a error-prone method. - -

-
- - -

+"test" element is the self-describing (and ungrammatical) string +This sample shows a error-prone method. +

+

Deterministic Content Models -

- For compatibility -, it is +

For compatibility, it is required that content models in element type declarations be deterministic. -

+

SGML requires deterministic content models (it calls them "unambiguous"); XML processors built using SGML systems may flag non-deterministic content models as errors.

-

For example, the content model - ((b, c) | (b, d)) - is -non-deterministic, because given an initial b - the parser -cannot know which b - in the model is being matched without -looking ahead to see which element follows the b -. +

For example, the content model ((b, c) | (b, d)) is +non-deterministic, because given an initial b the parser +cannot know which b in the model is being matched without +looking ahead to see which element follows the b. In this case, the two references to - b - can be collapsed +b can be collapsed into a single reference, making the model read - (b, (c | d)) -. An initial b - now clearly +(b, (c | d)). An initial b now clearly matches only a single name in the content model. The parser doesn't -need to look ahead to see what follows; either c - or - d - would be accepted.

+need to look ahead to see what follows; either c or +d would be accepted.

More formally: a finite state automaton may be constructed from the content model using the standard algorithms, e.g. algorithm 3.5 in section 3.9 -of Aho, Sethi, and Ullman - -. +of Aho, Sethi, and Ullman . In many such algorithms, a follow set is constructed for each position in the regular expression (i.e., each leaf node in the @@ -5598,12 +3382,10 @@ more than one following position is labeled with the same element type name, then the content model is in error and may be reported as an error. -

+

Algorithms exist which allow many but not all non-deterministic content models to be reduced automatically to equivalent deterministic -models; see Brüggemann-Klein 1991 - -.

+models; see Brüggemann-Klein 1991 .

Autodetection of Character Encodings @@ -5625,68 +3407,17 @@ processor without, or with, any accompanying (external) information. We consider the first case first.

-Because each XML entity not in UTF-8 or UTF-16 format - must - +Because each XML entity not in UTF-8 or UTF-16 format must begin with an XML encoding declaration, in which the first characters -must be ' <?xml -', any conforming processor can detect, +must be '<?xml', any conforming processor can detect, after two to four octets of input, which of the following cases apply. In reading this list, it may help to know that in UCS-4, '<' is -" #x0000003C -" and '?' is " #x0000003F -", and the Byte -Order Mark required of UTF-16 data streams is " #xFEFF -".

+"#x0000003C" and '?' is "#x0000003F", and the Byte +Order Mark required of UTF-16 data streams is "#xFEFF".

- - - -

- 00 00 00 3C -: UCS-4, big-endian machine (1234 order)

- - -

- 3C 00 00 00 -: UCS-4, little-endian machine (4321 order)

-
- -

- 00 00 3C 00 -: UCS-4, unusual octet order (2143)

-
- -

- 00 3C 00 00 -: UCS-4, unusual octet order (3412)

-
- -

- FE FF -: UTF-16, big-endian

-
- -

- FF FE -: UTF-16, little-endian

-
- -

- 00 3C 00 3F -: UTF-16, big-endian, no Byte Order Mark -(and thus, strictly speaking, in error)

-
- -

- 3C 00 3F 00 -: UTF-16, little-endian, no Byte Order Mark -(and thus, strictly speaking, in error)

-
- -

- 3C 3F 78 6D -: UTF-8, ISO 646, ASCII, some part of ISO 8859, +

00 00 00 3C: UCS-4, big-endian machine (1234 order)

3C 00 00 00: UCS-4, little-endian machine (4321 order)

00 00 3C 00: UCS-4, unusual octet order (2143)

00 3C 00 00: UCS-4, unusual octet order (3412)

FE FF: UTF-16, big-endian

FF FE: UTF-16, little-endian

00 3C 00 3F: UTF-16, big-endian, no Byte Order Mark +(and thus, strictly speaking, in error)

3C 00 3F 00: UTF-16, little-endian, no Byte Order Mark +(and thus, strictly speaking, in error)

3C 3F 78 6D: UTF-8, ISO 646, ASCII, some part of ISO 8859, Shift-JIS, EUC, or any other 7-bit, 8-bit, or mixed-width encoding which ensures that the characters of ASCII have their normal positions, width, @@ -5694,23 +3425,12 @@ and values; the actual encoding declaration must be read to detect which of these applies, but since all of these encodings use the same bit patterns for the ASCII characters, the encoding declaration itself may be read reliably -

-
- -

- 4C 6F A7 94 -: EBCDIC (in some flavor; the full +

4C 6F A7 94: EBCDIC (in some flavor; the full encoding declaration must be read to tell which code page is in -use)

-
- -

other: UTF-8 without an encoding declaration, or else +use)

other: UTF-8 without an encoding declaration, or else the data stream is corrupt, fragmentary, or enclosed in -a wrapper of some kind

-
- - -

+a wrapper of some kind

+

This level of autodetection is enough to read the XML encoding declaration and parse the character-encoding identifier, which is @@ -5755,41 +3475,27 @@ MIME-type label in an external header, for example, should be part of the RFC document defining the text/xml and application/xml MIME types. In the interests of interoperability, however, the following rules are recommended. - - - -

If an XML entity is in a file, the Byte-Order Mark +

If an XML entity is in a file, the Byte-Order Mark and encoding-declaration PI are used (if present) to determine the character encoding. All other heuristics and sources of information are solely for error recovery. -

- - -

If an XML entity is delivered with a -MIME type of text/xml, then the - charset - parameter +

If an XML entity is delivered with a +MIME type of text/xml, then the charset parameter on the MIME type determines the character encoding method; all other heuristics and sources of information are solely for error recovery. -

-
- -

If an XML entity is delivered +

If an XML entity is delivered with a MIME type of application/xml, then the Byte-Order Mark and encoding-declaration PI are used (if present) to determine the character encoding. All other heuristics and sources of information are solely for error recovery. -

-
- - +

These rules apply only in the absence of protocol-level documentation; in particular, when the MIME types text/xml and application/xml are defined, the recommendations of the relevant RFC will supersede these rules. -

+

W3C XML Working Group diff --git a/result/valid/xlink.xml b/result/valid/xlink.xml index 80ec5ffe..79197898 100644 --- a/result/valid/xlink.xml +++ b/result/valid/xlink.xml @@ -14,9 +14,7 @@ type="text/css"?> XML Linking Language (XLink) Version 1.0 - - - WD-xlink-19990527 + WD-xlink-19990527 World Wide Web Consortium Working Draft 29 @@ -61,24 +59,12 @@ type="text/css"?> tbray@textuality.com --> -

This is a W3C Working Draft for review by W3C members and other interested parties. It is a draft document and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use W3C Working Drafts as reference material or to cite them as other than "work in progress". A list of current W3C working drafts can be found at - http://www.w3.org/TR -.

-

- Note: - Since working drafts are subject to frequent change, you are advised to reference the above URI, rather than the URIs for working drafts themselves. Some of the work remaining is described in -.

-

This work is part of the W3C XML Activity (for current status, see - http://www.w3.org/XML/Activity -). For information about the XPointer language which is expected to be used with XLink, see http://www.w3.org/TR/WD-xptr -. -

-

See - http://www.w3.org/TR/NOTE-xlink-principles - for additional background on the design principles informing XLink.

-

Also see - http://www.w3.org/TR/NOTE-xlink-req/ - for the XLink requirements that this document attempts to satisfy.

+

This is a W3C Working Draft for review by W3C members and other interested parties. It is a draft document and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use W3C Working Drafts as reference material or to cite them as other than "work in progress". A list of current W3C working drafts can be found at http://www.w3.org/TR.

+

Note: Since working drafts are subject to frequent change, you are advised to reference the above URI, rather than the URIs for working drafts themselves. Some of the work remaining is described in .

+

This work is part of the W3C XML Activity (for current status, see http://www.w3.org/XML/Activity ). For information about the XPointer language which is expected to be used with XLink, see http://www.w3.org/TR/WD-xptr. +

+

See http://www.w3.org/TR/NOTE-xlink-principles for additional background on the design principles informing XLink.

+

Also see http://www.w3.org/TR/NOTE-xlink-req/ for the XLink requirements that this document attempts to satisfy.

@@ -121,533 +107,120 @@ type="text/css"?> Introduction -

This specification defines constructs that may be inserted into XML DTDs, schemas, and document instances to describe links between objects. A - link -, as the term is used here, is an explicit relationship between two or more data objects or portions of data objects. This specification is concerned with the syntax used to assert link existence and describe link characteristics. Implicit (unasserted) relationships, for example that of one word to the next or that of a word in a text to its entry in an on-line dictionary are obviously important, but outside its scope.

-

Links are asserted by - elements - contained in XML document instances -. The simplest case is very like an HTML A - link, and has these characteristics: - - -

The link is expressed at one of its ends (similar to the - A - element in some document)

- - -

Users can only initiate travel from that end to the other

-
- -

The link's effect on windows, frames, go-back lists, stylesheets in use, and so on is mainly determined by browsers, not by the link itself. For example, traveral of - A - links normally replaces the current view, perhaps with a user option to open a new window.

-
- -

The link goes to only one destination (although a server may have great freedom in finding or dynamically creating that destination).

-
- - -

+

This specification defines constructs that may be inserted into XML DTDs, schemas, and document instances to describe links between objects. A link, as the term is used here, is an explicit relationship between two or more data objects or portions of data objects. This specification is concerned with the syntax used to assert link existence and describe link characteristics. Implicit (unasserted) relationships, for example that of one word to the next or that of a word in a text to its entry in an on-line dictionary are obviously important, but outside its scope.

+

Links are asserted by elements contained in XML document instances. The simplest case is very like an HTML A link, and has these characteristics: +

The link is expressed at one of its ends (similar to the A element in some document)

Users can only initiate travel from that end to the other

The link's effect on windows, frames, go-back lists, stylesheets in use, and so on is mainly determined by browsers, not by the link itself. For example, traveral of A links normally replaces the current view, perhaps with a user option to open a new window.

The link goes to only one destination (although a server may have great freedom in finding or dynamically creating that destination).

+

While this set of characteristics is already very powerful and obviously has proven itself highly useful and effective, each of these assumptions also limits the range of hypertext functionality. The linking model defined here provides ways to create links that go beyond each of these specific characteristics, thus providing features previously available mostly in dedicated hypermedia systems.

Origin and Goals

Following is a summary of the design principles governing XLink: - - - -

XLink must be straightforwardly usable over the Internet.

- - -

XLink must be usable by a wide variety of link usage domains and classes of linking application software.

-
- -

XLink must support HTML 4.0 linking constructs.

-
- -

The XLink expression language must be XML.

-
- -

The XLink design must be formal, concise, and illustrative.

-
- -

XLinks must be human-readable and human-writable.

-
- -

XLinks may reside within or outside the documents in which the - participating resources reside.

-
- -

XLink must represent the abstract structure and significance of links.

-
- -

XLink must be feasible to implement.

-
- -

XLink must be informed by knowledge of established hypermedia systems and standards.

-
- - -

+

XLink must be straightforwardly usable over the Internet.

XLink must be usable by a wide variety of link usage domains and classes of linking application software.

XLink must support HTML 4.0 linking constructs.

The XLink expression language must be XML.

The XLink design must be formal, concise, and illustrative.

XLinks must be human-readable and human-writable.

XLinks may reside within or outside the documents in which the + participating resources reside.

XLink must represent the abstract structure and significance of links.

XLink must be feasible to implement.

XLink must be informed by knowledge of established hypermedia systems and standards.

+

Relationship to Existing Standards

Three standards have been especially influential: - - - -

- HTML: - Defines several SGML element types that represent links.

- - -

- HyTime: - Defines inline and out-of-line link structures and some semantic features, including traversal control and presentation of objects. - -

-
- -

- Text Encoding Initiative Guidelines (TEI P3): - Provides structures for creating links, aggregate objects, and link collections out of them.

-
- - -

+

HTML: Defines several SGML element types that represent links.

HyTime: Defines inline and out-of-line link structures and some semantic features, including traversal control and presentation of objects. +

Text Encoding Initiative Guidelines (TEI P3): Provides structures for creating links, aggregate objects, and link collections out of them.

+

Many other linking systems have also informed this design, especially Dexter, FRESS, MicroCosm, and InterMedia.

Terminology -

The following basic terms apply in this document. - - - - - - -

A symbolic representation of traversal behavior in links, especially the direction, context and timing of traversal.

- - - - - -

A representation of the relevant structure specified by the tags and attributes in an XML document, based on "groves" as defined in the ISO DSSSL standard.

-
-
- - - -

Abstractly, a - link - which serves as one of its own resources -. Concretely, a link where the content of the linking element - serves as a participating resource -. - HTML A -, HyTime clink -, and TEI XREF - - are all inline links.

-
-
- - - -

An explicit relationship between two or more data objects or portions of data objects.

-
-
- - - -

An - element - that asserts the existence and describes the characteristics of a link -.

-
-
- - - -

The content of an - inline -linking element. Note that the content of the linking element could be explicitly pointed to by means of a regular locator - in the same linking element, in which case the resource is considered remote -, not local.

-
-
- - - -

Data, provided as part of a link, which identifies a - - resource -.

-
-
- - - -

A - link - whose traversal - can be initiated from more than one of its participating resources -. Note that being able to "go back" after following a one-directional link does not make the link multidirectional.

-
-
- - - -

A - link - whose content does not serve as one of the link's participating resources -. Such links presuppose a notion like extended link groups -, which instruct application software where to look for links. Out-of-line links are generally required for supporting multidirectional traversal - and for allowing read-only resources to have outgoing links.

-
-
- - - -

In the context of link behavior, a parsed link is any link whose content is transcluded into the document where the link originated. The use of the term "parsed" directly refers to the concept in XML of a - parsed entity.

-
-
- - - -

A - resource - that belongs to a link. All resources are potential contributors to a link; participating resources are the actual contributors to a particular link.

-
-
- - - -

Any participating resource of a link that is pointed to with a locator.

-
-
- - - -

In the abstract sense, an addressable unit of information or service that is participating in a - link -. Examples include files, images, documents, programs, and query results. Concretely, anything reachable by the use of a locator - in some linking element -. Note that this term and its definition are taken from the basic specifications governing the World Wide Web. - -

-
-
- - - -

A portion of a resource, pointed to as the precise destination of a link. As one example, a link might specify that an entire document be retrieved and displayed, but that some specific part(s) of it is the specific linked data, to be treated in an application-appropriate manner such as indication by highlighting, scrolling, etc.

-
-
- - - -

The action of using a - link -; that is, of accessing a resource -. Traversal may be initiated by a user action (for example, clicking on the displayed content of a linking element -) or occur under program control.

-
-
- - -

+

A symbolic representation of traversal behavior in links, especially the direction, context and timing of traversal.

A representation of the relevant structure specified by the tags and attributes in an XML document, based on "groves" as defined in the ISO DSSSL standard.

Abstractly, a link which serves as one of its own resources. Concretely, a link where the content of the linking element serves as a participating resource. + HTML A, HyTime clink, and TEI XREF + are all inline links.

An explicit relationship between two or more data objects or portions of data objects.

An element that asserts the existence and describes the characteristics of a link.

The content of an inlinelinking element. Note that the content of the linking element could be explicitly pointed to by means of a regular locator in the same linking element, in which case the resource is considered remote, not local.

Data, provided as part of a link, which identifies a + resource.

A link whose traversal can be initiated from more than one of its participating resources. Note that being able to "go back" after following a one-directional link does not make the link multidirectional.

A link whose content does not serve as one of the link's participating resources . Such links presuppose a notion like extended link groups, which instruct application software where to look for links. Out-of-line links are generally required for supporting multidirectional traversal and for allowing read-only resources to have outgoing links.

In the context of link behavior, a parsed link is any link whose content is transcluded into the document where the link originated. The use of the term "parsed" directly refers to the concept in XML of a + parsed entity.

A resource that belongs to a link. All resources are potential contributors to a link; participating resources are the actual contributors to a particular link.

Any participating resource of a link that is pointed to with a locator.

In the abstract sense, an addressable unit of information or service that is participating in a link. Examples include files, images, documents, programs, and query results. Concretely, anything reachable by the use of a locator in some linking element. Note that this term and its definition are taken from the basic specifications governing the World Wide Web. +

A portion of a resource, pointed to as the precise destination of a link. As one example, a link might specify that an entire document be retrieved and displayed, but that some specific part(s) of it is the specific linked data, to be treated in an application-appropriate manner such as indication by highlighting, scrolling, etc.

The action of using a link; that is, of accessing a resource. Traversal may be initiated by a user action (for example, clicking on the displayed content of a linking element) or occur under program control.

+

Notation -

The formal grammar for - locators - is given using a simple Extended Backus-Naur Form (EBNF) location, as described in the XML specification -.

+

The formal grammar for locators is given using a simple Extended Backus-Naur Form (EBNF) location, as described in the XML specification.

Locator Syntax -

The locator for a - resource - is typically provided by means of a Uniform Resource Identifier, or URI. XPointers can be used in conjunction with the URI structure, as fragment identifiers, to specify a more precise sub-resource.

+

The locator for a resource is typically provided by means of a Uniform Resource Identifier, or URI. XPointers can be used in conjunction with the URI structure, as fragment identifiers, to specify a more precise sub-resource.

-

A locator generally contains a URI, as described in IETF RFCs - - and -. As these RFCs state, the URI may include a trailing query - (marked by a leading " ? -"), and be followed by a " # -" and a fragment identifier -, with the query interpreted by the host providing the indicated resource, and the interpretation of the fragment identifier dependent on the data type of the indicated resource.

+

A locator generally contains a URI, as described in IETF RFCs and . As these RFCs state, the URI may include a trailing query (marked by a leading "?"), and be followed by a "#" and a fragment identifier, with the query interpreted by the host providing the indicated resource, and the interpretation of the fragment identifier dependent on the data type of the indicated resource.

-

In order to locate XML documents and portions of documents, a locator value may contain either a - URI - or a fragment identifier, or both. Any fragment identifier for pointing into XML must be an XPointer -.

+

In order to locate XML documents and portions of documents, a locator value may contain either a URI or a fragment identifier, or both. Any fragment identifier for pointing into XML must be an XPointer.

Special syntax may be used to request the use of particular processing models in accessing the locator's resource. This is designed to reflect the realities of network operation, where it may or may not be desirable to exercise fine control over the distribution of work between local and remote processors. - - - Locator - - Locator - - URI - - | - Connector - ( XPointer - | Name -) - | - URI - Connector - ( XPointer - | Name -) - - - Connector - '#' | '|' - - - URI - - URIchar* - - - - -

-

- In this discussion, the term - designated resource - refers to the resource which an entire locator serves to locate. - The following rules apply: - - -

- The URI, if provided, locates a resource called the - containing resource -. -

- - -

If the URI is not provided, the containing resource is considered to be the document in which the linking element is contained. -

-
- -

- If an XPointer is provided, the designated resource is a - sub-resource - + LocatorLocatorURI| Connector (XPointer | Name)| URI Connector (XPointer | Name)Connector'#' | '|'URIURIchar* +

+

In this discussion, the term designated resource refers to the resource which an entire locator serves to locate. The following rules apply: +

The URI, if provided, locates a resource called the containing resource.

If the URI is not provided, the containing resource is considered to be the document in which the linking element is contained. +

If an XPointer is provided, the designated resource is a sub-resource of the containing resource; otherwise the designated resource is the - containing resource. -

-
- - -

If the - Connector - is followed directly by a Name -, the Name - is shorthand for the XPointer" id(Name) -"; that is, the sub-resource is the element in the containing resource that has an XML ID attribute - whose value matches - the Name -. This shorthand is to encourage use of the robust id - addressing mode.

-
- - -

If the connector is " - # -", this signals an intent that the containing resource is to be fetched as a whole from the host that provides it, and that the XPointer processing to extract the sub-resource - is to be performed on the client, that is to say on the same system where the linking element is recognized and processed.

-
- -

If the connector is " - | -", no intent is signaled as to what processing model is to be used to go about accessing the designated resource.

-
- - -

+ containing resource.

If the Connector is followed directly by a Name, the Name is shorthand for the XPointer"id(Name)"; that is, the sub-resource is the element in the containing resource that has an XML ID attribute whose value matches the Name. This shorthand is to encourage use of the robust id addressing mode.

If the connector is "#", this signals an intent that the containing resource is to be fetched as a whole from the host that provides it, and that the XPointer processing to extract the sub-resource + is to be performed on the client, that is to say on the same system where the linking element is recognized and processed.

If the connector is "|", no intent is signaled as to what processing model is to be used to go about accessing the designated resource.

+

Note that the definition of a URI includes an optional query component.

In the case where the URI contains a query (to be interpreted by the server), information providers and authors of server software are urged to use queries as follows: - - - Query - - Query - 'XML-XPTR=' ( - XPointer - | Name -) - - - -

+ QueryQuery'XML-XPTR=' ( XPointer | Name) +

Link Recognition -

The existence of a - link - is asserted by a linking element -. Linking elements must be recognized reliably by application software in order to provide appropriate display and behavior. There are several ways link recognition could be accomplished: for example, reserving element type names, reserving attributes names, leaving the matter of recognition entirely up to stylesheets and application software, or using the XLink namespace - to specify element names and attribute names that would be recognized by namespace and XLink-aware processors. Using element and attribute names within the XLink namespace provides a balance between giving users control of their own markup language design and keeping the identification of linking elements simple and unambiguous.

-

The two approaches to identifying linking elements are relatively simple to implement. For example, here's how the HTML - A - element would be declared using attributes within the XLink namespace, and then how an element within the XLink namespace might do the same: - <A xlink:type="simple" xlink:href="http://www.w3.org/TR/wd-xlink/" +

The existence of a link is asserted by a linking element. Linking elements must be recognized reliably by application software in order to provide appropriate display and behavior. There are several ways link recognition could be accomplished: for example, reserving element type names, reserving attributes names, leaving the matter of recognition entirely up to stylesheets and application software, or using the XLink namespace to specify element names and attribute names that would be recognized by namespace and XLink-aware processors. Using element and attribute names within the XLink namespace provides a balance between giving users control of their own markup language design and keeping the identification of linking elements simple and unambiguous.

+

The two approaches to identifying linking elements are relatively simple to implement. For example, here's how the HTML A element would be declared using attributes within the XLink namespace, and then how an element within the XLink namespace might do the same: + <A xlink:type="simple" xlink:href="http://www.w3.org/TR/wd-xlink/" xlink:title="The Xlink Working Draft">The XLink Working Draft.</A> - - <xlink:simple href="http://www.w3.org/TR/wd-xlink/" + <xlink:simple href="http://www.w3.org/TR/wd-xlink/" title="The XLink Working Draft">The XLink Working Draft</xlink:simple> - - Any arbitrary element can be made into an XLink by using the xlink:type - attribute. And, of course, the explicit XLink elements may be used, as well. This document will go on to describe the linking attributes that are associated with linking elements. It may be assumed by the reader that these attributes would require the xlink - namespace prefix if they existed within an arbitrary element, or that they may be used directly if they exist within an explicit Xlink element.

+ Any arbitrary element can be made into an XLink by using the xlink:type attribute. And, of course, the explicit XLink elements may be used, as well. This document will go on to describe the linking attributes that are associated with linking elements. It may be assumed by the reader that these attributes would require the xlink namespace prefix if they existed within an arbitrary element, or that they may be used directly if they exist within an explicit Xlink element.

Linking Attributes -

XLink has several attributes associated with the variety of links it may represent. These attributes define four main concepts: locators, arcs, behaviors, and semantics. - Locators - define where the actual resource is located. Arcs - define the traversal of links. Where does the link come from? Where does it go to? All this information can be stored in the arc attributes. Behaviors - define how the link is activated, and what the application should do with the resource being linked to. Semantics - define useful information that the application may use, and enables the link for such specalized targets as constricted devices and accessibility software.

+

XLink has several attributes associated with the variety of links it may represent. These attributes define four main concepts: locators, arcs, behaviors, and semantics. Locators define where the actual resource is located. Arcs define the traversal of links. Where does the link come from? Where does it go to? All this information can be stored in the arc attributes. Behaviors define how the link is activated, and what the application should do with the resource being linked to. Semantics define useful information that the application may use, and enables the link for such specalized targets as constricted devices and accessibility software.

Locator Attributes -

The only locator attribute at this time is - href -. This attribute must contain either a string in the form of a URI that defines the remote resource being linked to, a string containing a fragment identifier that links to a local resource, or a string containing a URI with a fragment identifier concacenated onto it.

+

The only locator attribute at this time is href. This attribute must contain either a string in the form of a URI that defines the remote resource being linked to, a string containing a fragment identifier that links to a local resource, or a string containing a URI with a fragment identifier concacenated onto it.

Arc Attributes -

Arcs contain two attributes, - from - and to -. The from - attribute may contain a string containing the content of a role - attribute from the resource being linked from. The purpose of the from - attribute is to define where this link is being actuated from.

-

The - to - attribute may contain a string containing the content of a role - attribute from the resource being linked to. The purpose of the to - attribute is to define where this link traverses to.

+

Arcs contain two attributes, from and to. The from attribute may contain a string containing the content of a role attribute from the resource being linked from. The purpose of the from attribute is to define where this link is being actuated from.

+

The to attribute may contain a string containing the content of a role attribute from the resource being linked to. The purpose of the to attribute is to define where this link traverses to.

The application may use this information in a number of ways, especially in a complex hypertext system, but it is mainly useful in providing context for application behavior.

Behavior Attributes -

There are two attributes associated with behavior: - show - and actuate -. The show - attribute defines how the remote resource is to be revealed to the user. It has three options: new -, parsed -, and replace -. The new - option indicates that the remote resource should be shown in a new window (or other device context) without replacing the previous content. The parsed - option, relating directly to the XML concept of a parsed entity, indicates that the content should be integrated into the document from which the link was actuated. The replace - option is the one most commonly seen on the World Wide Web, where the document being linked from is entirely replaced by the object being linked to.

-

The - actuate - attribute defines how the link is initiated. It has two options: user - and auto -. The user - option indicates that the link must be initiated by some sort of human-initiated selection, such as clicking on an HTML anchor. The auto - option indicates that the link is automatically initiated when the application deems that the user has reached the link. It then follows the behavior set out in the show - option.

+

There are two attributes associated with behavior: show and actuate. The show attribute defines how the remote resource is to be revealed to the user. It has three options: new, parsed, and replace. The new option indicates that the remote resource should be shown in a new window (or other device context) without replacing the previous content. The parsed option, relating directly to the XML concept of a parsed entity, indicates that the content should be integrated into the document from which the link was actuated. The replace option is the one most commonly seen on the World Wide Web, where the document being linked from is entirely replaced by the object being linked to.

+

The actuate attribute defines how the link is initiated. It has two options: user and auto. The user option indicates that the link must be initiated by some sort of human-initiated selection, such as clicking on an HTML anchor. The auto option indicates that the link is automatically initiated when the application deems that the user has reached the link. It then follows the behavior set out in the show option.

Semantic Attributes -

There are two attributes associated with semantics, - role - and title -. The role - attribute is a generic string used to describe the function of the link's content. For example, a poem might have a link with a role="stanza" -. The role - is also used as an identifier for the from - and to - attributes of arcs.

-

The - title - attribute is designed to provide human-readable text describing the link. It is very useful for those who have text-based applications, whether that be due to a constricted device that cannot display the link's content, or if it's being read by an application to a visually-impaired user, or if it's being used to create a table of links. The title - attribute contains a simple, descriptive string.

+

There are two attributes associated with semantics, role and title. The role attribute is a generic string used to describe the function of the link's content. For example, a poem might have a link with a role="stanza". The role is also used as an identifier for the from and to attributes of arcs.

+

The title attribute is designed to provide human-readable text describing the link. It is very useful for those who have text-based applications, whether that be due to a constricted device that cannot display the link's content, or if it's being read by an application to a visually-impaired user, or if it's being used to create a table of links. The title attribute contains a simple, descriptive string.

Linking Elements -

There are several kinds of linking elements in XLink: - simple - links, locators -, arcs -, and extended - links. These elements may be instantiated via element declarations from the XLink namespace, or they may be instantiated via attribute declarations from the XLink namespace. Both kinds of instantiation are described in the definition of each linking element.

-

The - simple - link is used to declare a link that approximates the functionality of the HTML A - element. It has, however, a few added features to increase its value, including the potential declaration of semantics and behavior. The locator - elements are used to define the resource being linked to. Some links may contain multiple locators, representing a choice of potential links to be traversed. The arcs - are used to define the traversal semantics of the link. Finally, an extended - linking element differs from a simple link in that it can connect any number of resources, not just one local resource (optionally) and one remote resource, and in that extended links are more often out-of-line than simple links.

+

There are several kinds of linking elements in XLink: simple links, locators, arcs, and extended links. These elements may be instantiated via element declarations from the XLink namespace, or they may be instantiated via attribute declarations from the XLink namespace. Both kinds of instantiation are described in the definition of each linking element.

+

The simple link is used to declare a link that approximates the functionality of the HTML A element. It has, however, a few added features to increase its value, including the potential declaration of semantics and behavior. The locator elements are used to define the resource being linked to. Some links may contain multiple locators, representing a choice of potential links to be traversed. The arcs are used to define the traversal semantics of the link. Finally, an extended linking element differs from a simple link in that it can connect any number of resources, not just one local resource (optionally) and one remote resource, and in that extended links are more often out-of-line than simple links.

Simple Links - +

The following are two examples of linking elements, each showing all the possible attributes that can be associated with a simple link. Here is the explicit XLink simple linking element. - - <!ELEMENT xlink:simple ANY> + <!ELEMENT xlink:simple ANY> <!ATTLIST xlink:slink href CDATA #REQUIRED role CDATA #IMPLIED @@ -655,9 +228,8 @@ title="The XLink Working Draft">The XLink Working Draft</xlink:s show (new|parsed|replace) "replace" actuate (user|auto) "user" > - And here is how to make an arbitrary element into a simple link. - <!ELEMENT xlink:simple ANY> + <!ELEMENT xlink:simple ANY> <!ATTLIST foo xlink:type (simple|extended|locator|arc) #FIXED "simple" xlink:href CDATA #REQUIRED @@ -666,28 +238,22 @@ title="The XLink Working Draft">The XLink Working Draft</xlink:s xlink:show (new|parsed|replace) "replace" xlink:actuate (user|auto) "user" > - Here is how the first example might look in a document: - <xlink:simple href="http://www.w3.org/TR/wd-xlink" role="working draft" +<xlink:simple href="http://www.w3.org/TR/wd-xlink" role="working draft" title="The XLink Working Draft" show="replace" actuate="user"> The XLink Working Draft.</xlink:simple> - - <foo xlink:href="http://www.w3.org/TR/wd-xlink" xlink:role="working draft" +<foo xlink:href="http://www.w3.org/TR/wd-xlink" xlink:role="working draft" xlink:title="The XLink Working Draft" xlink:show="new" xlink:actuate="user"> The XLink Working Draft.</foo> - Alternately, a simple link could be as terse as this: - <foo xlink:href="#stanza1">The First Stanza.</foo> - -

+<foo xlink:href="#stanza1">The First Stanza.</foo> +

There are no constraints on the contents of a simple linking element. In - the sample declaration above, it is given a content model of - ANY - + the sample declaration above, it is given a content model of ANY to illustrate that any content model or declared content is acceptable. In a valid document, every element that is significant to XLink must still conform - to the constraints expressed in its governing DTD.

+ to the constraints expressed in its governing DTD.

Note that it is meaningful to have an out-of-line simple link, although such links are uncommon. They are called "one-ended" and are typically used to associate discrete semantic properties with locations. The properties might @@ -699,58 +265,27 @@ The XLink Working Draft.</foo> Extended Links

- An - extended link - differs from a simple link in that it can connect any number of resources, not just one local resource (optionally) and one remote resource, and in that extended links are more often out-of-line than simple links. + An extended link differs from a simple link in that it can connect any number of resources, not just one local resource (optionally) and one remote resource, and in that extended links are more often out-of-line than simple links.

These additional capabilities of extended links are required for: - - - -

Enabling outgoing links in documents that cannot be modified to add an inline link

- - -

Creating links to and from resources in formats with no native support for embedded links (such as most multimedia formats)

-
- -

Applying and filtering sets of relevant links on demand

-
- -

Enabling other advanced hypermedia capabilities

-
- - -

+

Enabling outgoing links in documents that cannot be modified to add an inline link

Creating links to and from resources in formats with no native support for embedded links (such as most multimedia formats)

Applying and filtering sets of relevant links on demand

Enabling other advanced hypermedia capabilities

+

Application software might be expected to provide traversal among all of a link's participating resources (subject to semantic constraints outside the scope of this specification) and to signal the fact that a given resource or sub-resource participates in one or more links when it is displayed (even though there is no markup at exactly that point to signal it).

-

A linking element for an extended link contains a series of - child elements - that serve as locators and arcs. Because an extended link can have more than one remote resource, it separates out linking itself from the mechanisms used to locate each resource (whereas a simple link combines the two).

-

The - xlink:type - attribute value for an extended link must be extended -, if the link is being instantiated on an arbitrary element. Note that extended links introduce variants of the show - and actuate - behavior attributes. These attributes, the showdefault - and actuatedefault - define the same behavior as their counterparts. However, in this case, they are considered to define the default behavior for all the linking elements that they contain.

-

However, when a linking element within an extended link has a - show - or actuate - attribute of its own, that attribute overrides the defaults set on the extended linking element.

+

A linking element for an extended link contains a series of child elements that serve as locators and arcs. Because an extended link can have more than one remote resource, it separates out linking itself from the mechanisms used to locate each resource (whereas a simple link combines the two).

+

The xlink:type attribute value for an extended link must be extended, if the link is being instantiated on an arbitrary element. Note that extended links introduce variants of the show and actuate behavior attributes. These attributes, the showdefault and actuatedefault define the same behavior as their counterparts. However, in this case, they are considered to define the default behavior for all the linking elements that they contain.

+

However, when a linking element within an extended link has a show or actuate attribute of its own, that attribute overrides the defaults set on the extended linking element.

The extended linking element itself retains those attributes relevant to the link as a whole, and to its local resource if any. Following are two sample declaration for an extended link. The first is an example of the explicit XLink extended link: - - <!ELEMENT xlink:extended ((xlink:arc | xlink:locator)*)> +<!ELEMENT xlink:extended ((xlink:arc | xlink:locator)*)> <!ATTLIST xlink:extended role CDATA #IMPLIED title CDATA #IMPLIED showdefault (new|parsed|replace) #IMPLIED actuatedefault (user|auto) #IMPLIED > - The second is an example of an arbitrary element being used an extended link: - <!ELEMENT foo ((xlink:arc | xlink:locator)*)> +<!ELEMENT foo ((xlink:arc | xlink:locator)*)> <!ATTLIST foo xlink:type (simple|extended|locator|arc) #FIXED "extended" xlink:role CDATA #IMPLIED @@ -758,60 +293,38 @@ The XLink Working Draft.</foo> xlink:showdefault (new|parsed|replace) #IMPLIED xlink:actuatedefault (user|auto) #IMPLIED > - The following two examples demonstrate how each of the above might appear within a document instance. Note that the content of these examples would be other elements. For brevity's sake, they've been left blank. The first example shows how the link might appear, using an explicit XLink extended link: - <xlink:extended role="address book" title="Ben's Address Book" showdefault="replace" actuatedefault="user"> ... </xlink:extended> - +<xlink:extended role="address book" title="Ben's Address Book" showdefault="replace" actuatedefault="user"> ... </xlink:extended> And the second shows how the link might appear, using an arbitrary element: - <foo xlink:type="extended" xlink:role="address book" xlink:title="Ben's Address Book" xlink:showdefault="replace" xlink:actuatedefault="user"> ... </foo> - -

+<foo xlink:type="extended" xlink:role="address book" xlink:title="Ben's Address Book" xlink:showdefault="replace" xlink:actuatedefault="user"> ... </foo> +

Arc Elements -

- An - arc - is contained within an extended link for the purpose of defining traversal behavior. - More than one arc may be associated with a link. Otherwise, arc elements function exactly as the arc attributes might lead on to expect.

+

An arc is contained within an extended link for the purpose of defining traversal behavior. More than one arc may be associated with a link. Otherwise, arc elements function exactly as the arc attributes might lead on to expect.

Conformance -

An element conforms to XLink if: - - -

The element has an - xml:link - attribute whose value is -one of the attribute values prescribed by this specification, and

- - -

the element and all of its attributes and content adhere to the +

An element conforms to XLink if:

The element has an xml:link attribute whose value is +one of the attribute values prescribed by this specification, and

the element and all of its attributes and content adhere to the syntactic -requirements imposed by the chosen - xml:link - attribute value, -as prescribed in this specification.

-
- -

+requirements imposed by the chosen xml:link attribute value, +as prescribed in this specification.

Note that conformance is assessed at the level of individual elements, rather than whole XML documents, because XLink and non-XLink linking mechanisms may be used side by side in any one document.

An application conforms to XLink if it interprets XLink-conforming elements according to all required semantics prescribed by this specification and, for any optional semantics it chooses to support, supports them in the way -prescribed. - -

+levels of support. -elm-->

@@ -827,62 +340,41 @@ version will provide a mechanism for the use of structured link titles.

References - Eve Maler and Steve DeRose, editors. - -XML Pointer Language (XPointer) V1.0 -. ArborText, Inso, and Brown + Eve Maler and Steve DeRose, editors. +XML Pointer Language (XPointer) V1.0. ArborText, Inso, and Brown University. Burlington, Seekonk, et al.: World Wide Web Consortium, 1998. -(See http://www.w3.org/TR/WD-xptr - -.) +(See http://www.w3.org/TR/WD-xptr + .) ISO (International Organization for -Standardization). - ISO/IEC 10744-1992 (E). Information technology -- Hypermedia/Time-based Structuring Language (HyTime). - [Geneva]: -International Organization for Standardization, 1992. Extended +Standardization). ISO/IEC 10744-1992 (E). Information technology +- Hypermedia/Time-based Structuring Language (HyTime). [Geneva]: +International Organization for Standardization, 1992. Extended Facilities -Annex. - [Geneva]: International Organization for Standardization, -1996. (See http://www.ornl.go -v/sgml/wg8/hytime/html/is10744r.html - - ). +Annex. [Geneva]: International Organization for Standardization, +1996. (See http://www.ornl.go +v/sgml/wg8/hytime/html/is10744r.html ). IETF (Internet Engineering Task -Force). - -RFC 1738: Uniform Resource Locators -. 1991. (See -http://www.w3.org/Addressing/rfc1738.txt -). +Force). +RFC 1738: Uniform Resource Locators. 1991. (See +http://www.w3.org/Addressing/rfc1738.txt). IETF (Internet Engineering Task -Force). - -RFC 1808: Relative Uniform Resource Locators -. 1995. (See http://www.w3.org/Addressing/rfc -1808.txt -). +Force). +RFC 1808: Relative Uniform Resource Locators. 1995. (See http://www.w3.org/Addressing/rfc +1808.txt ). C. M. Sperberg-McQueen and Lou Burnard, editors. - - -Guidelines for Electronic Text Encoding and Interchange -. Association + +Guidelines for Electronic Text Encoding and Interchange. Association for Computers and the Humanities (ACH), Association for Computational Linguistics (ACL), and Association for Literary and Linguistic Computing (ALLC). Chicago, -Oxford: Text Encoding Initiative, 1994. - +Oxford: Text Encoding Initiative, 1994. ]Steven J. DeRose and David G. Durand. 1995. "The -TEI Hypertext Guidelines." In - Computing and the Humanities - -29(3). -Reprinted in Text Encoding Initiative: Background and -Context -, -ed. Nancy Ide and Jean ronis -, ISBN 0-7923-3704-2. +TEI Hypertext Guidelines." In Computing and the Humanities +29(3). +Reprinted in Text Encoding Initiative: Background and +Context, +ed. Nancy Ide and Jean ronis , ISBN 0-7923-3704-2.
diff --git a/tree.c b/tree.c index eb465d67..d1caae9e 100644 --- a/tree.c +++ b/tree.c @@ -2662,6 +2662,20 @@ xmlBufferCCat(xmlBufferPtr buf, const char *str) { } } +/** + * xmlBufferLastChar: + * @buf: the buffer to dump + * + * Get the last char of the buffer + * + * Returns the last char from the buffer or 0 if empty + */ +xmlChar +xmlBufferLastChar(xmlBufferPtr buf) { + if ((buf == NULL) || (buf->use <= 0)) return(0); + return(buf->content[buf->use - 1]); +} + /** * xmlBufferWriteCHAR: * @buf: the XML buffer @@ -2899,38 +2913,38 @@ xmlAttrListDump(xmlBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur) { static void -xmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level); +xmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level, + int format); /** * xmlNodeListDump: * @buf: the XML buffer output * @doc: the document * @cur: the first node * @level: the imbrication level for indenting + * @format: is formatting allowed * * Dump an XML node list, recursive behaviour,children are printed too. */ static void -xmlNodeListDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level) { - int needIndent = 0, i; +xmlNodeListDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level, + int format) { + int i; if (cur == NULL) { fprintf(stderr, "xmlNodeListDump : node == NULL\n"); return; } while (cur != NULL) { - if ((cur->type != XML_TEXT_NODE) && - (cur->type != XML_ENTITY_REF_NODE)) { - if (!needIndent) { - needIndent = 1; - xmlBufferWriteChar(buf, "\n"); - } + if ((format) && (xmlIndentTreeOutput) && + (cur->type == XML_ELEMENT_NODE)) + for (i = 0;i < level;i++) + xmlBufferWriteChar(buf, " "); + xmlNodeDump(buf, doc, cur, level, format); + if (format) { + xmlBufferWriteChar(buf, "\n"); } - xmlNodeDump(buf, doc, cur, level); cur = cur->next; } - if ((xmlIndentTreeOutput) && (needIndent)) - for (i = 1;i < level;i++) - xmlBufferWriteChar(buf, " "); } /** @@ -2939,12 +2953,15 @@ xmlNodeListDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level) { * @doc: the document * @cur: the current node * @level: the imbrication level for indenting + * @format: is formatting allowed * * Dump an XML node, recursive behaviour,children are printed too. */ static void -xmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level) { +xmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level, + int format) { int i; + xmlNodePtr tmp; if (cur == NULL) { fprintf(stderr, "xmlNodeDump : node == NULL\n"); @@ -2970,7 +2987,7 @@ xmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level) { xmlBufferWriteChar(buf, " "); xmlBufferWriteCHAR(buf, cur->content); } - xmlBufferWriteChar(buf, "?>\n"); + xmlBufferWriteChar(buf, "?>"); } return; } @@ -2978,7 +2995,7 @@ xmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level) { if (cur->content != NULL) { xmlBufferWriteChar(buf, "\n"); + xmlBufferWriteChar(buf, "-->"); } return; } @@ -2995,10 +3012,18 @@ xmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level) { xmlBufferWriteChar(buf, "]]>"); return; } - if (xmlIndentTreeOutput) - for (i = 0;i < level;i++) - xmlBufferWriteChar(buf, " "); + if (format == 1) { + tmp = cur->childs; + while (tmp != NULL) { + if ((tmp->type == XML_TEXT_NODE) || + (tmp->type == XML_ENTITY_REF_NODE)) { + format = 0; + break; + } + tmp = tmp->next; + } + } xmlBufferWriteChar(buf, "<"); if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) { xmlBufferWriteCHAR(buf, cur->ns->prefix); @@ -3012,7 +3037,7 @@ xmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level) { xmlAttrListDump(buf, doc, cur->properties); if ((cur->content == NULL) && (cur->childs == NULL)) { - xmlBufferWriteChar(buf, "/>\n"); + xmlBufferWriteChar(buf, "/>"); return; } xmlBufferWriteChar(buf, ">"); @@ -3026,7 +3051,11 @@ xmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level) { } } if (cur->childs != NULL) { - xmlNodeListDump(buf, doc, cur->childs, level + 1); + if (format) xmlBufferWriteChar(buf, "\n"); + xmlNodeListDump(buf, doc, cur->childs, level + 1, format); + if ((xmlIndentTreeOutput) && (format)) + for (i = 0;i < level;i++) + xmlBufferWriteChar(buf, " "); } xmlBufferWriteChar(buf, "ns != NULL) && (cur->ns->prefix != NULL)) { @@ -3035,7 +3064,7 @@ xmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level) { } xmlBufferWriteCHAR(buf, cur->name); - xmlBufferWriteChar(buf, ">\n"); + xmlBufferWriteChar(buf, ">"); } /** @@ -3077,7 +3106,8 @@ xmlDocContentDump(xmlBufferPtr buf, xmlDocPtr cur) { xmlUpgradeOldNs(cur); while (child != NULL) { - xmlNodeDump(buf, cur, child, 0); + xmlNodeDump(buf, cur, child, 0, 1); + xmlBufferWriteChar(buf, "\n"); child = child->next; } }