⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rec-xml-20001006

📁 如何实现安全的xml机制
💻
📖 第 1 页 / 共 5 页
字号:
</tr>
<tr valign="baseline">
<td><a name="NT-extSubsetDecl"></a>[31]&nbsp;&nbsp;&nbsp;</td>
<td><code>extSubsetDecl</code></td>
<td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
<td><code>( <a href="#NT-markupdecl">markupdecl</a> | <a href="#NT-conditionalSect">conditionalSect</a>
| <a href="#NT-DeclSep">DeclSep</a>)*</code></td>
<td><i>/*  */</i></td>
</tr>
</tbody></table> <p>The external subset and external parameter entities also
differ from the internal subset in that in them, <a title="Parameter-entity reference"
href="#dt-PERef">parameter-entity references</a> are permitted <em>within</em>
markup declarations, not only <em>between</em> markup declarations.</p> <p>An
example of an XML document with a document type declaration:</p> <table class="eg"
width="100%" border="1" cellpadding="5" bgcolor="#99ffff">
<tr>
<td><pre>&lt;?xml version="1.0"?> &lt;!DOCTYPE greeting SYSTEM "hello.dtd"> &lt;greeting>Hello, world!&lt;/greeting> </pre></td>
</tr>
</table> <p>The <a title="System Identifier" href="#dt-sysid">system identifier</a>
"<code>hello.dtd</code>" gives the address (a URI reference) of a DTD for
the document.</p> <p>The declarations can also be given locally, as in this
example:</p> <table class="eg" width="100%" border="1" cellpadding="5" bgcolor="#99ffff">
<tr>
<td><pre>&lt;?xml version="1.0" encoding="UTF-8" ?>
&lt;!DOCTYPE greeting [
  &lt;!ELEMENT greeting (#PCDATA)>
]>
&lt;greeting>Hello, world!&lt;/greeting></pre></td>
</tr>
</table> <p>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.</p> </div> <div class="div2"> <h3><a name="sec-rmd"></a>2.9
Standalone Document Declaration</h3> <p>Markup declarations can affect the
content of the document, as passed from an <a title="XML Processor" href="#dt-xml-proc">XML
processor</a> 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 <a title="Document Entity" href="#dt-docent">document
entity</a> or in parameter entities. [<a title="External Markup Declaration"
name="dt-extmkpdecl">Definition</a>: An <b>external markup declaration</b>
is defined as a markup declaration occurring in the external subset or in
a parameter entity (external or internal, the latter being included because
non-validating processors are not required to read them).]</p> <h5>Standalone
Document Declaration</h5><table class="scrap"><tbody>
<tr valign="baseline">
<td><a name="NT-SDDecl"></a>[32]&nbsp;&nbsp;&nbsp;</td>
<td><code>SDDecl</code></td>
<td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
<td><code> <a href="#NT-S">S</a> 'standalone' <a href="#NT-Eq">Eq</a> (("'"
('yes' | 'no') "'") | ('"' ('yes' | 'no') '"')) </code></td>
<td><a href="#vc-check-rmd">[VC: Standalone Document Declaration]</a></td>
</tr>
</tbody></table> <p>In a standalone document declaration, the value "yes"
indicates that there are no <a title="External Markup Declaration" href="#dt-extmkpdecl">external
markup declarations</a> which affect the information passed from the XML processor
to the application. 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 <em>declarations</em>; the presence,
in a document, of references to external <em>entities</em>, when those entities
are internally declared, does not change its standalone status.</p> <p>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.</p> <p>Any XML
document for which <code>standalone="no"</code> holds can be converted algorithmically
to a standalone document, which may be desirable for some network delivery
applications.</p> <div class="constraint"><p class="prefix"><a name="vc-check-rmd"></a><b>Validity
constraint: Standalone Document Declaration</b></p><p>The standalone document
declaration must have the value "no" if any external markup declarations contain
declarations of:</p> <ul>
<li><p>attributes with <a title="Attribute Default" href="#dt-default">default</a>
values, if elements to which these attributes apply appear in the document
without specifications of values for these attributes, or</p></li>
<li><p>entities (other than <code>amp</code>, <code>lt</code>, <code>gt</code>, <code>apos</code>, <code>quot</code>),
if <a title="Entity Reference" href="#dt-entref">references</a> to those entities
appear in the document, or</p></li>
<li><p>attributes with values subject to <a href="#AVNormalize"><cite>normalization</cite></a>,
where the attribute appears in the document with a value which will change
as a result of normalization, or</p></li>
<li><p>element types with <a title="Element content" href="#dt-elemcontent">element
content</a>, if white space occurs directly within any instance of those types.</p></li>
</ul> </div> <p>An example XML declaration with a standalone document declaration:</p> <table
class="eg" width="100%" border="1" cellpadding="5" bgcolor="#99ffff">
<tr>
<td><pre>&lt;?xml version="1.0" standalone='yes'?></pre></td>
</tr>
</table> </div> <div class="div2"> <h3><a name="sec-white-space"></a>2.10
White Space Handling</h3> <p>In editing XML documents, it is often convenient
to use "white space" (spaces, tabs, and blank lines) 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.</p> <p>An <a title="XML Processor" href="#dt-xml-proc">XML
processor</a> must always pass all characters in a document that are not markup
through to the application. A <a title="Validating Processor" href="#dt-validating">
validating XML processor</a> must also inform the application which of these
characters constitute white space appearing in <a title="Element content"
href="#dt-elemcontent">element content</a>.</p> <p>A special <a title="Attribute"
href="#dt-attr">attribute</a> named <code>xml:space</code> 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 <a title="Attribute-List Declaration" href="#dt-attdecl">declared</a>
if it is used. When declared, it must be given as an <a title="Enumerated Attribute Values"
href="#dt-enumerated">enumerated type</a> whose values are one or both of
"default" and "preserve". For example:</p> <table class="eg" width="100%"
border="1" cellpadding="5" bgcolor="#99ffff">
<tr>
<td><pre>&lt;!ATTLIST poem  xml:space (default|preserve) 'preserve'>

&lt;!-- -->
&lt;!ATTLIST pre xml:space (preserve) #FIXED 'preserve'></pre></td>
</tr>
</table> <p>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 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 <code>xml:space</code>
attribute.</p> <p>The <a title="Root Element" href="#dt-root">root element</a>
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.</p> </div> <div class="div2"> <h3><a name="sec-line-ends"></a>2.11
End-of-Line Handling</h3> <p>XML <a title="Text Entity" href="#dt-parsedent">parsed
entities</a> 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).</p>  <p>To simplify
the tasks of <a title="Application" href="#dt-app">applications</a>, the characters
passed to an application by the <a title="XML Processor" href="#dt-xml-proc">XML
processor</a> must be as if the XML processor normalized all line breaks in
external parsed entities (including the document entity) on input, before
parsing, by translating both the two-character sequence #xD #xA and any #xD
that is not followed by #xA to a single #xA character.</p> </div> <div class="div2"> <h3><a
name="sec-lang-tag"></a>2.12 Language Identification</h3> <p>In document processing,
it is often useful to identify the natural or formal language in which the
content is written. A special <a title="Attribute" href="#dt-attr">attribute</a>
named <code>xml:lang</code> 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 <a title="Attribute-List Declaration"
href="#dt-attdecl">declared</a> if it is used. The values of the attribute
are language identifiers as defined by <a href="#RFC1766">[IETF RFC 1766]</a>, <cite>Tags
for the Identification of Languages</cite>, or its successor on the IETF Standards
Track.</p> <div class="note"><p class="prefix"><b>Note:</b></p> <p><a href="#RFC1766">[IETF
RFC 1766]</a> tags are constructed from two-letter language codes as defined
by <a href="#ISO639">[ISO 639]</a>, from two-letter country codes as defined
by <a href="#ISO3166">[ISO 3166]</a>, or from language identifiers registered
with the Internet Assigned Numbers Authority <a href="#IANA-LANGCODES">[IANA-LANGCODES]</a>.
It is expected that the successor to <a href="#RFC1766">[IETF RFC 1766]</a>
will introduce three-letter language codes for languages not presently covered
by <a href="#ISO639">[ISO 639]</a>.</p> </div> <p>(Productions 33 through
38 have been removed.)</p>      <p>For example:</p> <table class="eg" width="100%"
border="1" cellpadding="5" bgcolor="#99ffff">
<tr>
<td><pre>&lt;p xml:lang="en">The quick brown fox jumps over the lazy dog.&lt;/p>
&lt;p xml:lang="en-GB">What colour is it?&lt;/p>
&lt;p xml:lang="en-US">What color is it?&lt;/p>
&lt;sp who="Faust" desc='leise' xml:lang="de">
  &lt;l>Habe nun, ach! Philosophie,&lt;/l>
  &lt;l>Juristerei, und Medizin&lt;/l>
  &lt;l>und leider auch Theologie&lt;/l>
  &lt;l>durchaus studiert mit hei&szlig;em Bem&uuml;h'n.&lt;/l>
&lt;/sp></pre></td>
</tr>
</table>  <p>The intent declared with <code>xml:lang</code> is considered
to apply to all attributes and content of the element where it is specified,
unless overridden with an instance of <code>xml:lang</code> on another element
within that content.</p>  <p>A simple declaration for <code>xml:lang</code>
might take the form</p> <table class="eg" width="100%" border="1" cellpadding="5"
bgcolor="#99ffff">
<tr>
<td><pre>xml:lang NMTOKEN #IMPLIED</pre></td>
</tr>
</table> <p>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 <code>xml:lang</code> attribute might be declared this way:</p> <table
class="eg" width="100%" border="1" cellpadding="5" bgcolor="#99ffff">
<tr>
<td><pre>&lt;!ATTLIST poem   xml:lang NMTOKEN 'fr'>
&lt;!ATTLIST gloss  xml:lang NMTOKEN 'en'>
&lt;!ATTLIST note   xml:lang NMTOKEN 'en'></pre></td>
</tr>
</table> </div> </div>  <div class="div1"> <h2><a name="sec-logical-struct"></a>3
Logical Structures</h2> <p>[<a title="Element" name="dt-element">Definition</a>:
Each <a title="XML Document" href="#dt-xml-doc">XML document</a> contains
one or more <b>elements</b>, the boundaries of which are either delimited
by <a title="Start-Tag" href="#dt-stag">start-tags</a> and <a title="End Tag"
href="#dt-etag">end-tags</a>, or, for <a title="Empty" href="#dt-empty">empty</a>
elements, by an <a title="empty-element tag" href="#dt-eetag">empty-element
tag</a>. 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 <a title="Attribute Name" href="#dt-attrname">name</a>
and a <a title="Attribute Value" href="#dt-attrval">value</a>.</p> <h5>Element</h5><table
class="scrap"><tbody>
<tr valign="baseline">
<td><a name="NT-element"></a>[39]&nbsp;&nbsp;&nbsp;</td>
<td><code>element</code></td>
<td>&nb

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -