private void SetNsArrayLength(int size) { DTMXPathNamespaceNode2 [] newArr = new DTMXPathNamespaceNode2 [size]; Array.Copy(namespaces, newArr, System.Math.Min(size, namespaces.Length)); namespaces = newArr; }
// Followings are skipped: nextNsNode (may be next attribute in the same element, or ancestors' nsNode) public void AddNsNode(int declaredElement, int name, int ns, int nextNs) { if (namespaces.Length < nsIndex + 1) { nsCapacity *= 4; SetNsArrayLength(nsCapacity); } #if DTM_CLASS namespaces [nsIndex] = new DTMXPathNamespaceNode2(); #endif namespaces [nsIndex].DeclaredElement = declaredElement; namespaces [nsIndex].Name = name; namespaces [nsIndex].Namespace = ns; namespaces [nsIndex].NextNamespace = nextNs; }
public DTMXPathDocumentWriter2(XmlNameTable nt, int defaultCapacity) { nameTable = nt == null ? new NameTable() : nt; nodeCapacity = defaultCapacity; attributeCapacity = nodeCapacity; nsCapacity = 10; idTable = new Hashtable(); nodes = new DTMXPathLinkedNode2 [nodeCapacity]; attributes = new DTMXPathAttributeNode2 [attributeCapacity]; namespaces = new DTMXPathNamespaceNode2 [nsCapacity]; atomicStringPool = new string [20]; nonAtomicStringPool = new string [20]; Init(); }
private void Init(XmlReader reader, XmlSpace space, int defaultCapacity) { this.xmlReader = reader; this.validatingReader = reader as XmlValidatingReader; lineInfo = reader as IXmlLineInfo; this.xmlSpace = space; this.nameTable = reader.NameTable; nodeCapacity = defaultCapacity; attributeCapacity = nodeCapacity; nsCapacity = 10; idTable = new Hashtable(); nodes = new DTMXPathLinkedNode2 [nodeCapacity]; attributes = new DTMXPathAttributeNode2 [attributeCapacity]; namespaces = new DTMXPathNamespaceNode2 [nsCapacity]; atomicStringPool = new string [20]; nonAtomicStringPool = new string [20]; Compile(); }
// Followings are skipped: nextNsNode (may be next attribute in the same element, or ancestors' nsNode) public void AddNsNode(int declaredElement, int name, int ns, int nextNs) { if (namespaces.Length < nsIndex + 1) { nsCapacity *= 4; SetNsArrayLength(nsCapacity); } #if DTM_CLASS namespaces [nsIndex] = new DTMXPathNamespaceNode2(); #endif namespaces [nsIndex].DeclaredElement = declaredElement; namespaces [nsIndex].Name = name; namespaces [nsIndex].Namespace = ns; namespaces [nsIndex].NextNamespace = nextNs; if (lineInfo != null && lineInfo.HasLineInfo()) { namespaces [nsIndex].LineNumber = lineInfo.LineNumber; namespaces [nsIndex].LinePosition = lineInfo.LinePosition; } }
private void SetNsArrayLength(int size) { DTMXPathNamespaceNode2[] destinationArray = new DTMXPathNamespaceNode2[size]; Array.Copy(this.namespaces, destinationArray, Math.Min(size, this.namespaces.Length)); this.namespaces = destinationArray; }