Hello, I'm doing something ike this under to read a file HTML (not xml; hope this will be fine); by the way the problem is when I read the namespace, the xmlreader crash at runtime; how can I solve this?
thanks
TypeScript
publicParser(string fileContent) {
_settings.ConformanceLevel = ConformanceLevel.Fragment;
_settings.IgnoreWhitespace = true;
_settings.IgnoreComments = true;
_textReader = XmlReader.Create(fileContent, _settings);
_textReader.Read();
XmlNodeType nType = _textReader.NodeType;
while (_textReader.Read()) {
switch (_textReader.NodeType) {
caseXmlNodeType.Element: // The node is an element.Console.Write("<" + _textReader.Name);
Console.WriteLine(">");
break;
caseXmlNodeType.Text: //Display the text in each element.Console.WriteLine(_textReader.Value);
break;
caseXmlNodeType.EndElement: //Display the end of the element.Console.Write("</" + _textReader.Name);
Console.WriteLine(">");
break;
}
}
<html>
<head></head><body><usingxmlns:namespace="myfile" />
myText
<p><namespace:myComponentAttribs="val"> //it crashes on 'namespace:myCOmponent'
</body></html>
Answers
Know the answer? Post it. Somebody with the same question will find it here.
Answers
Know the answer? Post it. Somebody with the same question will find it here.