I am using the Html Agility Pack to parse some html and am having an issue with a poorly formatted meta tag.
Given this meta tag:
"<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\"=\"\">"
When I call:
HtmlNode productAttributes = hap.DocumentNode.SelectSingleNode("//meta[@name='productattributes']");
var productAttributesStr = productAttributes.GetAttributeValue("value", "");
The resulting productAttributesStr is ending up with the value truncated at the \”r”:
“shop: Baby|category: Category|category: Babies”
What am I doing wrong?
You are using
"as data inside an attribute value delimited with the same character. The first one you hits ends the attribute value. You need to represent them using entities:"