Serious problem
I'm using Chris Lovett's SgmlReader class
SgmlReader sr = new SgmlReader();
XmlDocument xdoc = new XmlDocument();
sr.DocType = "HTML";
sr.InputStream = new System.IO.Strin gReader(node.In nerText);
xdoc.Load(sr);
foreach(XmlNode PotentiallyMali cous in xdoc.SelectNode s("//script |
//embed //object | //frameset //frame //iframe | //meta | //link | //style |
//@style"))
{
if (node.ParentNod e!=null)
PotentiallyMali cous.ParentNode .RemoveChild(Po tentiallyMalico us);
else
xdoc.RemoveChil d(PotentiallyMa licous);
}
item.desc = xdoc.InnerText;
Unfrotantely, I'm getting an exception on xdoc.Load(sr), saying:
System.InvalidO perationExcepti on: The specified node cannot be
inserted as the valid child of this node, because the specified node is the
wrong type.
at System.Xml.XmlD ocument.AppendC hildForLoad(Xml Node newChild,
XmlDocument doc)
at System.Xml.XmlL oader.LoadDocSe quence(XmlDocum ent parentDoc)
at System.Xml.XmlL oader.Load(XmlD ocument doc, XmlReader reader,
Boolean preserveWhitesp ace)
at System.Xml.XmlD ocument.Load(Xm lReader reader)
at Roar.RssFeed.Up dateItem(XmlNod e ItemNode, XmlNamespaceMan ager
nsMgr, ArrayList& NewItems, Boolean Update) in c:\documents and
settings\ayende \my documents\visua l studio projects\medar\ rssfeed.cs:line
233
at Roar.RssFeed.Up dateFeed(XmlDoc ument feed, ArrayList& NewItems,
Boolean Update)
I've no idea what is causing this.
node.InnerText equals:
<'a href="http://www.ncl.com/fleet/dawn/index.htm"><'im g
src="http://monster2.script ing.com/z/images/archiveScriptin gCom/2003/12/01/d
awn.jpg" width="125" height="59" border="0" align="right" hspace="15"
vspace="5" alt="A picture named dawn.jpg"><'/a>Two articles, both from the
NY Times, by coincidence happened to show up one after the other in my
aggregator, a stark contrast of how two kinds of Americans live. The first
<'a
href="http://www.nytimes.com/2003/12/01/nyregion/01SHIP.html?ex= 1385614800&e
n=f12a99f582744 ee2&ei=5007&par tner=USERLAND"> article<'/a> details the
luxurious cruise ship Tom DeLay is bringing to the Republican National
Convention in NYC in August, where George Bush will, presumably, be
nominated for a second term as President. It's a very beautiful ship, very
nice. The second <'a
href="http://www.nytimes.com/2003/11/27/international/worldspecial/27LIST.ht
ml?ex=138535560 0&en=1fa37d9cc6 c8ca0f&ei=5007& partner=USERLAN D">article<'/a>
is the daily report of US soldiers killed in Iraq. Yesterday only one
soldier died, David Goldberg, 20, an engineer in the Army reserve,
based in Layton, Utah. Needless to say he won't be going to the Republican
National Convention or riding on any cruise ships. "
Any idea what could cause it? Or how to fix it?
I'm using Chris Lovett's SgmlReader class
SgmlReader sr = new SgmlReader();
XmlDocument xdoc = new XmlDocument();
sr.DocType = "HTML";
sr.InputStream = new System.IO.Strin gReader(node.In nerText);
xdoc.Load(sr);
foreach(XmlNode PotentiallyMali cous in xdoc.SelectNode s("//script |
//embed //object | //frameset //frame //iframe | //meta | //link | //style |
//@style"))
{
if (node.ParentNod e!=null)
PotentiallyMali cous.ParentNode .RemoveChild(Po tentiallyMalico us);
else
xdoc.RemoveChil d(PotentiallyMa licous);
}
item.desc = xdoc.InnerText;
Unfrotantely, I'm getting an exception on xdoc.Load(sr), saying:
System.InvalidO perationExcepti on: The specified node cannot be
inserted as the valid child of this node, because the specified node is the
wrong type.
at System.Xml.XmlD ocument.AppendC hildForLoad(Xml Node newChild,
XmlDocument doc)
at System.Xml.XmlL oader.LoadDocSe quence(XmlDocum ent parentDoc)
at System.Xml.XmlL oader.Load(XmlD ocument doc, XmlReader reader,
Boolean preserveWhitesp ace)
at System.Xml.XmlD ocument.Load(Xm lReader reader)
at Roar.RssFeed.Up dateItem(XmlNod e ItemNode, XmlNamespaceMan ager
nsMgr, ArrayList& NewItems, Boolean Update) in c:\documents and
settings\ayende \my documents\visua l studio projects\medar\ rssfeed.cs:line
233
at Roar.RssFeed.Up dateFeed(XmlDoc ument feed, ArrayList& NewItems,
Boolean Update)
I've no idea what is causing this.
node.InnerText equals:
<'a href="http://www.ncl.com/fleet/dawn/index.htm"><'im g
src="http://monster2.script ing.com/z/images/archiveScriptin gCom/2003/12/01/d
awn.jpg" width="125" height="59" border="0" align="right" hspace="15"
vspace="5" alt="A picture named dawn.jpg"><'/a>Two articles, both from the
NY Times, by coincidence happened to show up one after the other in my
aggregator, a stark contrast of how two kinds of Americans live. The first
<'a
href="http://www.nytimes.com/2003/12/01/nyregion/01SHIP.html?ex= 1385614800&e
n=f12a99f582744 ee2&ei=5007&par tner=USERLAND"> article<'/a> details the
luxurious cruise ship Tom DeLay is bringing to the Republican National
Convention in NYC in August, where George Bush will, presumably, be
nominated for a second term as President. It's a very beautiful ship, very
nice. The second <'a
href="http://www.nytimes.com/2003/11/27/international/worldspecial/27LIST.ht
ml?ex=138535560 0&en=1fa37d9cc6 c8ca0f&ei=5007& partner=USERLAN D">article<'/a>
is the daily report of US soldiers killed in Iraq. Yesterday only one
soldier died, David Goldberg, 20, an engineer in the Army reserve,
based in Layton, Utah. Needless to say he won't be going to the Republican
National Convention or riding on any cruise ships. "
Any idea what could cause it? Or how to fix it?
Comment