【发布时间】:2011-06-30 21:18:27
【问题描述】:
我正在使用 Html Agility Pack 解析一些 html,但遇到了格式错误的元标记的问题。
鉴于此元标记:
"<meta name=\"productattributes\" value=\"shop: Baby|category: Category|category: Babies\" r\"us=\"\" exclusives|family:=\"\" strollers|name:=\"\" baby=\"\" trend=\"\" expedition=\"\" elx=\"\" travel=\"\" system=\"\" stroller=\"\" -=\"\" everglade|price:=\"\" 239.99\"=\"\">"
当我打电话时:
HtmlNode productAttributes = hap.DocumentNode.SelectSingleNode("//meta[@name='productattributes']");
var productAttributesStr = productAttributes.GetAttributeValue("value", "");
生成的 productAttributesStr 以在“r”处截断的值结束:
“商店:婴儿|类别:类别|类别:婴儿”
我做错了什么?
【问题讨论】:
标签: c# html-parsing html-agility-pack