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

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]

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

报告相同问题?

悬赏问题

  • ¥40 图书信息管理系统程序编写
  • ¥15 7-1 jmu-java-m02-使用二维数组存储多元线性方程组
  • ¥20 Qcustomplot缩小曲线形状问题
  • ¥15 企业资源规划ERP沙盘模拟
  • ¥15 树莓派控制机械臂传输命令报错,显示摄像头不存在
  • ¥15 前端echarts坐标轴问题
  • ¥15 ad5933的I2C
  • ¥15 请问RTX4060的笔记本电脑可以训练yolov5模型吗?
  • ¥15 数学建模求思路及代码
  • ¥50 silvaco GaN HEMT有栅极场板的击穿电压仿真问题