zoukankan      html  css  js  c++  java
  • XML Namespace

    http://www.w3schools.com/xml/xml_namespaces.asp

    XML Namespaces provide a method to avoid element name conflicts.

    When using prefixes in XML, a so-called namespace for the prefix must be defined.

    The namespace is defined by the xmlns attribute in the start tag of an element.

    The namespace declaration has the following syntax. xmlns:prefix="URI".

    <root>

    <h:table xmlns:h="http://www.w3.org/TR/html4/">
      <h:tr>
        <h:td>Apples</h:td>
        <h:td>Bananas</h:td>
      </h:tr>
    </h:table>

    <f:table xmlns:f="http://www.w3schools.com/furniture">
      <f:name>African Coffee Table</f:name>
      <f:width>80</f:width>
      <f:length>120</f:length>
    </f:table>

    </root>

    In the example above, the xmlns attribute in the <table> tag give the h: and f: prefixes a qualified namespace.

    When a namespace is defined for an element, all child elements with the same prefix are associated with the same namespace.

    Namespaces can be declared in the elements where they are used or in the XML root element:

    <root
    xmlns:h="http://www.w3.org/TR/html4/"
    xmlns:f="http://www.w3schools.com/furniture"
    >

    <h:table>
      <h:tr>
        <h:td>Apples</h:td>
        <h:td>Bananas</h:td>
      </h:tr>
    </h:table>

    <f:table>
      <f:name>African Coffee Table</f:name>
      <f:width>80</f:width>
      <f:length>120</f:length>
    </f:table>

    </root>

    Note: The namespace URI is not used by the parser to look up information.

    The purpose is to give the namespace a unique name. However, often companies use the namespace as a pointer to a web page containing namespace information.

  • 相关阅读:
    重构与模式:改善代码三部曲中的第三部
    将博客搬至CSDN
    管理之道(二十二)
    管理之道(二十一)
    管理之道(二十)
    管理之道(十九)
    管理之道(十八)
    管理之道(十七)
    管理之道(十六)
    管理之道(十五)
  • 原文地址:https://www.cnblogs.com/wucg/p/2093560.html
Copyright © 2011-2022 走看看