Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

XmlValidatingReader::IsDefault Property

 

Gets a value indicating whether the current node is an attribute that was generated from the default value defined in the document type definition (DTD) or schema.

Namespace:   System.Xml
Assembly:  System.Xml (in System.Xml.dll)

public:
property bool IsDefault {
	virtual bool get() override;
}

Property Value

Type: System::Boolean

true if the current node is an attribute whose value was generated from the default value defined in the DTD or schema; false if the attribute value was explicitly set.

This property applies only to an attribute node.

System_CAPS_noteNote

The XmlValidatingReader class is obsolete in .NET Framework 2.0. You can create a validating XmlReader instance by using the XmlReaderSettings class and the Create method. For more information, see the Remarks section of the XmlReader reference page.

The following example displays all attributes nodes on the root element.

#using <System.Xml.dll>

using namespace System;
using namespace System::IO;
using namespace System::Xml;
int main()
{

   // Create the reader.
   XmlTextReader^ txtreader = gcnew XmlTextReader( "book4.xml" );
   XmlValidatingReader^ reader = gcnew XmlValidatingReader( txtreader );
   reader->MoveToContent();

   // Display each of the attribute nodes, including default attributes.
   while ( reader->MoveToNextAttribute() )
   {
      if ( reader->IsDefault )
            Console::Write( "(default attribute) " );

      Console::WriteLine( " {0} = {1}", reader->Name, reader->Value );
   }


   // Close the reader.
   reader->Close();
}

The example uses the following files as input.

book4.xml

<!DOCTYPE book SYSTEM 'book.dtd'>
<book ISBN = '1-861001-57-5'>
  <title>Pride And Prejudice</title>
  <price>19.95</price>
</book>

book.dtd

.NET Framework
Available since 1.1
Return to top
Show:
© 2017 Microsoft