asp.net String.IsNullOrEmpty 方法(2)


public static void RecursiveWalk(XPathNavigator nav)
{
switch (nav.NodeType){
case XPathNodeType.Element:
if (nav.Prefix==String.Empty)
Console.WriteLine("<{0}>", nav.LocalName);
else
Console.Write("<{0}:{1}>", nav.Prefix, nav.LocalName);
Console.WriteLine("\t"+ nav.NamespaceURI);
break;
case XPathNodeType.Text:
Console.WriteLine("\t" + nav.Value);
break;
}
if ( nav.MoveToFirstChild() )
{
do{
RecursiveWalk(nav);
} while ( nav.MoveToNext() );
nav.MoveToParent();
if (nav.NodeType == XPathNodeType.Element)
Console.WriteLine("</{0}>", nav.Name);
}
}


C++ 复制代码 

复制代码 代码如下:


static void RecursiveWalk( XPathNavigator^ nav )
{
switch ( nav->NodeType )
{
case XPathNodeType::Element:
if ( nav->Prefix == String::Empty )
Console::WriteLine( "< {0}>", nav->LocalName );
else
Console::Write( "< {0}: {1}>", nav->Prefix, nav->LocalName );
Console::WriteLine( "\t {0}", nav->NamespaceURI );
break;
case XPathNodeType::Text:
Console::WriteLine( "\t {0}", nav->Value );
break;
}
if ( nav->MoveToFirstChild() )
{
do
{
RecursiveWalk( nav );
}
while ( nav->MoveToNext() );
nav->MoveToParent();
if ( nav->NodeType == XPathNodeType::Element )
Console::WriteLine( "</ {0}>", nav->Name );
}
}


J# 复制代码

复制代码 代码如下:


public static void RecursiveWalk(XPathNavigator nav)
{
switch (nav.get_NodeType()) {
case XPathNodeType.Element:
if (nav.get_Prefix().Equals("")){
Console.WriteLine("<{0}>", nav.get_LocalName());
}
else {
Console.Write("<{0}:{1}>", nav.get_Prefix(),
nav.get_LocalName());
}
Console.WriteLine("\t" + nav.get_NamespaceURI());
break;
case XPathNodeType.Text:
Console.WriteLine("\t" + nav.get_Value());
break;
}
if (nav.MoveToFirstChild()) {
do {
RecursiveWalk(nav);
} while (nav.MoveToNext());
nav.MoveToParent();
if (nav.get_NodeType() .Equals(XPathNodeType.Element)) {
Console.WriteLine("</{0}>", nav.get_Name());
}
}
} //RecursiveWalk


平台
Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition
.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求。
版本信息
.NET Framework
受以下版本支持:2.0、1.1、1.0
.NET Compact Framework
受以下版本支持:2.0、1.0

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wjfzys.html