zoukankan      html  css  js  c++  java
  • DTD

    The main building blocks of both XML and HTML documents are elements.

    The Building Blocks of XML Documents

    Seen from a DTD point of view(从dtd的角度来看), all XML documents (and HTML documents) are made up by the following building blocks:

    • Elements
    • Attributes
    • Entities
    • PCDATA
    • CDATA

    Elements

    Elements are the main building blocks of both XML and HTML documents.

    Examples of HTML elements are "body" and "table". Examples of XML elements could be "note" and "message". Elements can contain text, other elements, or be empty. Examples of empty HTML elements are "hr", "br" and "img".

    Examples:

    <body>some text</body>
    
    <message>some text</message>

    Attributes

    Attributes provide extra information about elements.

    Attributes are always placed inside the opening tag of an element. Attributes always come in name/value pairs. The following "img" element has additional information about a source file:

    <img src="computer.gif" />

    The name of the element is "img". The name of the attribute is "src". The value of the attribute is "computer.gif". Since the element itself is empty it is closed by a " /".


    Entities

    Some characters have a special meaning in XML, like the less than sign (<) that defines the start of an XML tag.

    Most of you know the HTML entity: "&nbsp;". This "no-breaking-space" entity is used in HTML to insert an extra space in a document. Entities are expanded when a document is parsed by an XML parser.

    The following entities are predefined in XML:

    Entity ReferencesCharacter
    &lt; <
    &gt; >
    &amp; &
    &quot; "
    &apos; '

    PCDATA

    PCDATA means parsed character data.

    Think of character data as the text found between the start tag and the end tag of an XML element.

    PCDATA is text that WILL be parsed by a parserThe text will be examined by the parser for entities and markup.

    Tags inside the text will be treated as markup and entities will be expanded.

    However, parsed character data should not contain any &, <, or > characters; these need to be represented by the &amp; &lt; and &gt; entities, respectively.


    CDATA

    CDATA means character data.

    CDATA is text that will NOT be parsed by a parser. Tags inside the text will NOT be treated as markup and entities will not be expanded.

  • 相关阅读:
    由后序遍历序列和中序遍历序列确定二叉树
    由先序遍历序列和中序遍历序列确定二叉树
    EBR-TLV数据格式
    埃利斯(A.Ellis)ABCDE情绪管理理论
    马斯洛需求层次理论
    【Linux命令】find命令
    Windows核心编程——动态库和静态库
    C++Socket编程—socket网络模型之事件选择模型模型
    C++Socket编程—socket网络模型之异步选择模型
    C++Socket编程—socket网络模型之select模型
  • 原文地址:https://www.cnblogs.com/ghgyj/p/3991911.html
Copyright © 2011-2022 走看看