我可以使用startEntity来请求ISAXLexical Handler不要解释#8804; [英] Can I use startEntity to ask ISAXLexical Handler not to interpret #8804;
问题描述
您好
我在C ++中使用ISAXLexicalHendler要求我的读者不要将像&#8804: 这样的字符转换为"≤" 。
我是尝试将解析器的输出放到浏览器中,以便浏览器可以理解字符的含义。
所以我创建了一个SAXLexicalHendler指针,并将其传递给读者 使用属性"http://xml.org/sax/properties/lexical-handler"。
但无法获得对SAXLexicalHendler的startEntity的影响 当我打电话给解析时。
我正在打击 startDTD,endDTD,startCDATA的代码,但无法命中startEntity()
任何人都可以看看这个。
这里是我的输入:
<?xml version =" 1.0" encoding =" windows-1252"?>
<!DOCTYPE html PUBLIC" - // W3C // DTD XHTML 1.0 Strict // EN"
  ;&NBSP;&NBSP; "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
< html xmlns =" http://www.w3.org / 1999 / xhtml">
< head>
< meta http-equiv =" Content-Type"含量=" text / html的;字符集= US-ASCII" />
$
< title> XSL FO文件< / title>
< / head>
< body bgcolor ="白" MARGINWIDTH =" 6英寸MARGINHEIGHT =" 6英寸LEFTMARGIN = QUOT; 6英寸topmargin =" 6">
< div valign =" top">
< div style =" font-family:Helvetica,sans- serif,Lucida Sans Unicode; font-size:12pt; font-weight:normal; font-style:normal; text-decoration:none;颜色:rgb(0,0,0);背景颜色:透明;保证金 - 保证金 - 底部:0.0pt; text-indent:0.0in; margin-
margin-right:0.0in; text-align:left; border-style:none; border-width:0.0pt; border-color:rgb(0,0,0);填充:0.0pt;空格:预包装;">
< div>&#8804;< / div>
< / div>
< / div>
< / body>
< / html>
问题:我需要告诉解析器不要转换#8804; to"≤"。
您好
Debendra Kumar Kar ,
感谢您在此处发帖。
>>我在C ++中使用ISAXLexicalHendler要求我的读者不要将&#8804: 等字符转换为& ; ≤ " 。
XML提供两种实体 - 通用实体和参数实体。在DTD中定义的常规实体替换文档中的实体值,如前面的示例所示。参数实体将其他DTD文件的内容链接到
DTD,或充当频繁重复声明的缩写。为了区分这两种类型的实体,一般实体使用&符号(&),而参数实体使用百分号(%)。
在我看来,最好是防止使用"&"字符。
希望这可以为您提供帮助。
最诚挚的问候,
Sera Yu
Hi
I am using ISAXLexicalHendler in C++ to ask my reader to not to convert the character like ≤: to "≤" .
I am trying to put the output of the parser to a browser so that the browser can understand the meaning of the character.
So I created a SAXLexicalHendler pointer and pass it to the reader along with the property "http://xml.org/sax/properties/lexical-handler".
But unable to get a hit to the startEntity of SAXLexicalHendler when I call the parse.
I am hitting the code for startDTD, endDTD,startCDATA but unable to get a hit to the startEntity()
Can anybody have a look into this.
Here is my input:
<?xml version="1.0" encoding="windows-1252"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<title>XSL FO Document</title>
</head>
<body bgcolor="white" marginwidth="6" marginheight="6" leftmargin="6" topmargin="6">
<div valign="top">
<div style="font-family: Helvetica,sans-serif,Lucida Sans Unicode; font-size: 12pt; font-weight: normal; font-style: normal; text-decoration: none; color: rgb(0,0,0); background-color: transparent; margin- margin-bottom: 0.0pt; text-indent: 0.0in; margin-
margin-right: 0.0in; text-align: left; border-style: none; border-width: 0.0pt; border-color: rgb(0,0,0); padding: 0.0pt; white-space: pre-wrap;">
<div>≤</div>
</div>
</div>
</body>
</html>
Issue: I need to tell the parser not to convert the #8804; to "≤".
thanks for posting here.
>>I am using ISAXLexicalHendler in C++ to ask my reader to not to convert the character like ≤: to "≤" .
XML offers two kinds of entities — general entities and parameter entities. General entities, defined in DTDs, substitute the entity value within a document, as shown in the preceding example. Parameter entities link the content of additional DTD files to a DTD, or act as an abbreviation for frequently repeated declarations. To distinguish between these two types of entities, general entities use an ampersand (&) while parameter entities use the percent sign (%).
In my opinion, it would be better to prevent using "&" character.
Hope this could be help of you.
Best Regards,
Sera Yu
这篇关于我可以使用startEntity来请求ISAXLexical Handler不要解释#8804;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!