Search code examples
.netxmlxmlreader

Can anyone explain to me what is the meaning of the boolean parameter of the System.Xml.XmlDictionaryWriter.WriteNode(XmlReader, bool) method?


According to MSDN:
defattr
Type: System.Boolean
If true, copy the default attributes from the XmlReader; otherwise false.If true, use default attributes; otherwise false.

And my question is what does the author mean by this?


Solution

  • Every xml element has a default attribute. Even if there is no attribute when you examine the raw xml, you will find that if you step thru any xml parser code when it uses a method like MoveToNextAttribute() there will be an xmlns attribute whose value is a w3c uri(I dont recall the exact uri -something like xmlns='http://www.w3c.org/schema' You will also see it in the output from the ReadOuterXml() method for any element.