Java 解析过程中的CSSOMParser错误

Java 解析过程中的CSSOMParser错误,java,xml,css-parsing,Java,Xml,Css Parsing,我在解析css文件时遇到以下错误 它看起来与损坏的css标记有关。有人能澄清一下吗? 我正在使用文件中的css规则来找出html页面上链接到css的某些元素。这些错误是否会影响css规则的解析,从而影响网页上html元素的分析?我肯定是这样,但希望不是这样 提前感谢。解析时必须转义字符。Apache有StringEscapeUtils类可以帮助您。 我认为你必须使用StringEscapeUtils.escapehtmlreadtext;由于html和css语法更相似 问候 可能是因为您正在使用

我在解析css文件时遇到以下错误

它看起来与损坏的css标记有关。有人能澄清一下吗? 我正在使用文件中的css规则来找出html页面上链接到css的某些元素。这些错误是否会影响css规则的解析,从而影响网页上html元素的分析?我肯定是这样,但希望不是这样


提前感谢。

解析时必须转义字符。Apache有StringEscapeUtils类可以帮助您。 我认为你必须使用StringEscapeUtils.escapehtmlreadtext;由于html和css语法更相似


问候

可能是因为您正在使用非标准CSS规则,例如!ie7或特定于供应商的属性,如-moz border radius

所以这是一个问题,我不应该担心规则被忽略,因为它们可能非常特定于供应商??我说的对吗?我认为这不会给你带来问题。OP正在解析一个独立的CSS文件,所以不需要转义HTML实体。
null [1:1763] Error in style rule. Invalid token "!". Was expecting one of: <S>, "}", ",", ";", "/", "+", "-", <HASH>, <STRING>, <URI>, <IMPORTANT_SYM>, "inherit", <EMS>, <EXS>, <LENGTH_PX>, <LENGTH_CM>, <LENGTH_MM>, <LENGTH_IN>, <LENGTH_PT>, <LENGTH_PC>, <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <TIME_MS>, <TIME_S>, <FREQ_HZ>, <FREQ_KHZ>, <DIMEN>, <PERCENTAGE>, <NUMBER>, "rgb(", <FUNCTION>, <IDENT>, <UNICODERANGE>.
null [1:1763] Ignoring the following declarations in this rule.
null [1:4352] Error in style rule. Invalid token "!". Was expecting one of: <S>, "}", ",", ";", "/", "+", "-", <HASH>, <STRING>, <URI>, <IMPORTANT_SYM>, "inherit", <EMS>, <EXS>, <LENGTH_PX>, <LENGTH_CM>, <LENGTH_MM>, <LENGTH_IN>, <LENGTH_PT>, <LENGTH_PC>, <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <TIME_MS>, <TIME_S>, <FREQ_HZ>, <FREQ_KHZ>, <DIMEN>, <PERCENTAGE>, <NUMBER>, "rgb(", <FUNCTION>, <IDENT>, <UNICODERANGE>.
null [1:4352] Ignoring the following declarations in this rule.
null [1:4435] Error in style rule. Invalid token "-". Was expecting one of: <S>, "}", ";", <IDENT>.
null [1:4435] Ignoring the following declarations in this rule.
null [1:10349] Error in style rule. Invalid token "-". Was expecting one of: <S>, "}", ";", <IDENT>.
null [1:10349] Ignoring the following declarations in this rule.
null [1:12131] Error in style rule. Invalid token "!". Was expecting one of: <S>, "}", ",", ";", "/", "+", "-", <HASH>, <STRING>, <URI>, <IMPORTANT_SYM>, "inherit", <EMS>, <EXS>, <LENGTH_PX>, <LENGTH_CM>, <LENGTH_MM>, <LENGTH_IN>, <LENGTH_PT>, <LENGTH_PC>, <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <TIME_MS>, <TIME_S>, <FREQ_HZ>, <FREQ_KHZ>, <DIMEN>, <PERCENTAGE>, <NUMBER>, "rgb(", <FUNCTION>, <IDENT>, <UNICODERANGE>.
null [1:12131] Ignoring the following declarations in this rule.
null [1:17335] Error in style rule. Invalid token "-". Was expecting one of: <S>, "}", ";", <IDENT>.
null [1:17335] Ignoring the following declarations in this rule.
null [1:20115] Error in style rule. Invalid token "-". Was expecting one of: <S>, "}", ";", <IDENT>.
null [1:20115] Ignoring the following declarations in this rule.
null [1:20499] Error in style rule. Invalid token "-". Was expecting one of: <S>, "}", ";", <IDENT>.
null [1:20499] Ignoring the following declarations in this rule.
null [1:22593] Error in style rule. Invalid token "-". Was expecting one of: <S>, "}", ";", <IDENT>.
null [1:22593] Ignoring the following declarations in this rule.
null [1:23137] Error in expression. Invalid token "=". Was expecting one of: <S>, ",", "/", "+", "-", <HASH>, <STRING>, ")", <URI>, "inherit", <EMS>, <EXS>, <LENGTH_PX>, <LENGTH_CM>, <LENGTH_MM>, <LENGTH_IN>, <LENGTH_PT>, <LENGTH_PC>, <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <TIME_MS>, <TIME_S>, <FREQ_HZ>, <FREQ_KHZ>, <DIMEN>, <PERCENTAGE>, <NUMBER>, "rgb(", <FUNCTION>, <IDENT>, <UNICODERANGE>.
null [1:27252] Error in style rule. Invalid token "-". Was expecting one of: <S>, "}", ";", <IDENT>.
null [1:27252] Ignoring the following declarations in this rule.
null [1:28495] Error in style rule. Invalid token "!". Was expecting one of: <S>, "}", ",", ";", "/", "+", "-", <HASH>, <STRING>, <URI>, <IMPORTANT_SYM>, "inherit", <EMS>, <EXS>, <LENGTH_PX>, <LENGTH_CM>, <LENGTH_MM>, <LENGTH_IN>, <LENGTH_PT>, <LENGTH_PC>, <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <TIME_MS>, <TIME_S>, <FREQ_HZ>, <FREQ_KHZ>, <DIMEN>, <PERCENTAGE>, <NUMBER>, "rgb(", <FUNCTION>, <IDENT>, <UNICODERANGE>.
null [1:28495] Ignoring the following declarations in this rule.
null [1:32022] Error in style rule. Invalid token "-". Was expecting one of: <S>, "}", ";", <IDENT>.
null [1:32022] Ignoring the following declarations in this rule.
null [1:33926] Error in style rule. Invalid token "-". Was expecting one of: <S>, "}", ";", <IDENT>.
null [1:33926] Ignoring the following declarations in this rule.
null [1:34660] Error in style rule. Invalid token "-". Was expecting one of: <S>, "}", ";", <IDENT>.
null [1:34660] Ignoring the following declarations in this rule.
null [1:36410] Error in style rule. Invalid token "-". Was expecting one of: <S>, "}", ";", <IDENT>.
null [1:36410] Ignoring the following declarations in this rule.
null [1:36624] Error in style rule. Invalid token "-". Was expecting one of: <S>, "}", ";", <IDENT>.
null [1:36624] Ignoring the following declarations in this rule.
null [1:37378] Error in style rule. Invalid token "-". Was expecting one of: <S>, "}", ";", <IDENT>.
null [1:37378] Ignoring the following declarations in this rule.
null [1:39110] Error in style rule. Invalid token "-". Was expecting one of: <S>, "}", ";", <IDENT>.
null [1:39110] Ignoring the following declarations in this rule.
null [1:40536] Error in style rule. Invalid token "-". Was expecting one of: <S>, "}", ";", <IDENT>.
null [1:40536] Ignoring the following declarations in this rule.
null [1:41061] Error in style rule. Invalid token "-". Was expecting one of: <S>, "}", ";", <IDENT>.
null [1:41061] Ignoring the following declarations in this rule.
null [1:41487] Error in style rule. Invalid token "-". Was expecting one of: <S>, "}", ";", <IDENT>.
null [1:41487] Ignoring the following declarations in this rule.
null [1:45987] Error in expression. Invalid token "=". Was expecting one of: <S>, ",", "/", "+", "-", <HASH>, <STRING>, ")", <URI>, "inherit", <EMS>, <EXS>, <LENGTH_PX>, <LENGTH_CM>, <LENGTH_MM>, <LENGTH_IN>, <LENGTH_PT>, <LENGTH_PC>, <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <TIME_MS>, <TIME_S>, <FREQ_HZ>, <FREQ_KHZ>, <DIMEN>, <PERCENTAGE>, <NUMBER>, "rgb(", <FUNCTION>, <IDENT>, <UNICODERANGE>.
null [1:45992] Error in style rule. Invalid token "position". Was expecting one of: "}", ";".
null [1:45992] Ignoring the following declarations in this rule.
null [1:46761] Error in style rule. Invalid token "-". Was expecting one of: <S>, "}", ";", <IDENT>.
null [1:46761] Ignoring the following declarations in this rule.
null [1:50353] Error in style rule. Invalid token "-". Was expecting one of: <S>, "}", ";", <IDENT>.
null [1:50353] Ignoring the following declarations in this rule.
null [1:51070] Error in style rule. Invalid token "-". Was expecting one of: <S>, "}", ";", <IDENT>.
null [1:51070] Ignoring the following declarations in this rule.