Code
Function Test ()
{
VaR Doc = New Activexobject ( " Microsoft. xmldom " );
// VaR Doc = SG. xmldocument ();
VaR Returnxml = " <Root> </root> " ;
Doc. loadxml (returnxml );
VaR R = Doc. selectsinglenode ( " Root " );
// R. Attributes. removenameditem ("caption"); // remove a Single Node
For ( VaR I = 0 ; I < 5 ; I ++ )
{
R. setattribute ("ATTR"+I, I );
}
For ( VaR I = 0 , J = R. Attributes. length; I < J; I ++ )
{
Alert (R. attributes [I]. value );
}
Removeattributes (R );
// Removeattributes (R, 1,10000 );
For ( VaR I = 0 , J = R. Attributes. length; I < J; I ++ )
{
Alert (R. attributes [I]. value );
}
// Remove all nodes or nodes in a certain range
Function Removeattributes (node, from,)
{
If (From = Null | To = Null )
{
For ( VaR I = 0 , J = Node. Attributes. length; I < J; I ++ )
{
VaRAttrname=Node. attributes [0]. Name;
Node. Attributes. removenameditem (attrname );
}
}
Else If (From ! = Null && To ! = Null )
{
VaR Len = Node. Attributes. Length > To ? To: node. Attributes. length;
For ( VaR I = From; I < Len; I ++ )
{
VaRAttrname=Node. attributes [from]. Name;
Node. Attributes. removenameditem (attrname );
}
}
}