Question

I am running into an issue in a .Net 3.5 site I inherited.

The issue is the site uses XElements everywhere to render the content on some pages. But, I am noticing that with certain YouTube video embeds, I am getting errors stating that there is an unexpected > and the XML is malformed.

I narrowed it down to the use of the allowfullscreen attribute in the newer YouTube embed codes.

So, what I'm wondering is if there is a RegEx that I could use to make sure that attributes like this have at least the structure of attribute="" to satisfy the valid XML need.

Was it helpful?

Solution 2

Since all pertinent videos in this instance will be from youtube, and include the allowfullscreen attribute, the answer was simply add: .Replace("allowfullscreen", "allowfullscreen=""true""")

OTHER TIPS

You are trying to parse html, not XML. Use an HTML parser. For example the "HTML Agility Pack" would be ideal.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top