private void AddNamespace( string prefix, string ns ) {
nsManager.AddNamespace( prefix, ns );
int index = nsAttrCount++;
if ( nsAttributes == null ) {
nsAttributes = new NodeData[InitialNamespaceAttributeCount];
}
if ( index == nsAttributes.Length ) {
NodeData[] newNsAttrs = new NodeData[nsAttributes.Length * 2];
Array.Copy( nsAttributes, 0, newNsAttrs, 0, index );
nsAttributes = newNsAttrs;
}
if ( nsAttributes[index] == null ) {
nsAttributes[index] = new NodeData();
}
if ( prefix.Length == 0 ) {
nsAttributes[index].Set( XmlNodeType.Attribute, xmlns, string.Empty, xmlns, XmlReservedNs.NsXmlNs, ns );
}
else {
nsAttributes[index].Set( XmlNodeType.Attribute, prefix, xmlns, string.Concat( prefix, ":", xmlns ), XmlReservedNs.NsXmlNs, ns );
}
Debug.Assert( state == State.ClearNsAttributes || state == State.Interactive || state == State.PopNamespaceScope );
state = State.ClearNsAttributes;
curNsAttr = -1;
}