내가 XHTML 파일이 :을 XmlDocument 무시의 xmlns
<html xmlns="http://www.w3.org/1999/xhtml">
나는 그것을로드 :
XmlDocument xml = new XmlDocument();
StringReader sr = new StringReader(html);
XmlTextReader xmltr = new XmlTextReader(sr);
xmltr.Namespaces = false;
xml.Load(xmltr);
을 나는 항상 The 'xmlns' attribute is bound to the reserved namespace 'http://www.w3.org/2000/xmlns/'.
예외 가지고 xml.InnerXml
를 호출의 내부 XML에 액세스 할 수없는 경우 내 XmlDocument. 로드하는 동안 xmlns 제거하는 방법?
솔루션입니다 :
추측에서XmlNode xmln = xml.SelectSingleNode("//html");
if (xmln != null)
((XmlElement)xmln).RemoveAttribute("xmlns");
XHTML 선언은 'http : // www.w3.org/1999/xhtml'에 대해 이야기하지만 설명 된 오류는 'http : // www.w3.org/2000/xmlns'에 대해 이야기합니다. 둘 다 맞습니까? –
예, 제 3 자 XHTML은 1999이고 예외는 2000이라고 말합니다. – Denis
더 중요한 비트는 "xhtml"과 "xmlns"비트입니다 ... –