openjavas 2010-05-20 11:09
浏览 586
已采纳

publicId 和 systemId 究竟是个什么东东?

org.xml.sax.InputSource中有publicId 和 systemId
这个public identifier 和 system identifier究竟是个啥玩意儿?
谁跟我讲讲啊?
[code="java"]

/**
 * Set the public identifier for this input source.
 *
 * <p>The public identifier is always optional: if the application
 * writer includes one, it will be provided as part of the
 * location information.</p>
 *
 * @param publicId The public identifier as a string.
 * @see #getPublicId
 * @see org.xml.sax.Locator#getPublicId
 * @see org.xml.sax.SAXParseException#getPublicId
 */
public void setPublicId (String publicId)
{
this.publicId = publicId;
}

/**
 * Set the system identifier for this input source.
 *
 * <p>The system identifier is optional if there is a byte stream
 * or a character stream, but it is still useful to provide one,
 * since the application can use it to resolve relative URIs
 * and can include it in error messages and warnings (the parser
 * will attempt to open a connection to the URI only if
 * there is no byte stream or character stream specified).</p>
 *
 * <p>If the application knows the character encoding of the
 * object pointed to by the system identifier, it can register
 * the encoding using the setEncoding method.</p>
 *
 * <p>If the system identifier is a URL, it must be fully
 * resolved (it may not be a relative URL).</p>
 *
 * @param systemId The system identifier as a string.
 * @see #setEncoding
 * @see #getSystemId
 * @see org.xml.sax.Locator#getSystemId
 * @see org.xml.sax.SAXParseException#getSystemId
 */
public void setSystemId (String systemId)
{
this.systemId = systemId;
}

[/code]

  • 写回答

1条回答 默认 最新

  • myali88 2010-05-20 14:06
    关注

    看看Wiki上的解释吧。
    [quote]
    A public identifier is a document processing construct in SGML and XML.

    In HTML and XML, a public identifier is meant to be universally unique within its application scope. It typically occurs in a Document Type Declaration.

    A public identifier is meant to identify a document type that may span more than one application.
    [/quote]
    [quote]
    A system identifier is meant for a document type that is used exclusively in one application.
    [/quote]

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 ansys fluent计算闪退
  • ¥15 有关wireshark抓包的问题
  • ¥15 Ubuntu20.04无法连接GitHub
  • ¥15 需要写计算过程,不要写代码,求解答,数据都在图上
  • ¥15 向数据表用newid方式插入GUID问题
  • ¥15 multisim电路设计
  • ¥20 用keil,写代码解决两个问题,用库函数
  • ¥50 ID中开关量采样信号通道、以及程序流程的设计
  • ¥15 U-Mamba/nnunetv2固定随机数种子
  • ¥30 C++行情软件的tick数据如何高效的合成K线