internal PrefixChange( string oldPrefix, string newPrefix, string ns, ulong opid, PrefixChange next ) { _oldPrefix = oldPrefix; _newPrefix = newPrefix; _NS = ns; _opid = opid; _next = next; }
// returns appropriate operation ID for this namespace or prefix change private ulong GetNamespaceChangeOpid( string oldNamespaceURI, string oldPrefix, string newNamespaceURI, string newPrefix) { Debug.Assert( !_xmlDiff.IgnoreNamespaces ); ulong opid = 0; // namespace change if ( oldNamespaceURI != newNamespaceURI ) { // prefix must remain the same if ( oldPrefix != newPrefix ) return 0; // lookup this change in the list of namespace changes NamespaceChange nsChange = _namespaceChangeDescr; while ( nsChange != null ) { if ( nsChange._oldNS == oldNamespaceURI && nsChange._prefix == oldPrefix && nsChange._newNS == newNamespaceURI ) { return nsChange._opid; } nsChange = nsChange._next; } // the change record was not found -> create a new one opid = GenerateOperationID( XmlDiffDescriptorType.NamespaceChange ); _namespaceChangeDescr = new NamespaceChange( oldPrefix, oldNamespaceURI, newNamespaceURI, opid, _namespaceChangeDescr ); } // prefix change else if ( !_xmlDiff.IgnorePrefixes && oldPrefix != newPrefix ) { // lookup this change in the list of prefix changes PrefixChange prefixChange = _prefixChangeDescr; while ( prefixChange != null ) { if ( prefixChange._NS == oldNamespaceURI && prefixChange._oldPrefix == oldPrefix && prefixChange._newPrefix == newPrefix ) { return prefixChange._opid; } prefixChange = prefixChange._next; } // the change record was not found -> create a new one opid = GenerateOperationID( XmlDiffDescriptorType.PrefixChange ); _prefixChangeDescr = new PrefixChange( oldPrefix, newPrefix, oldNamespaceURI, opid, _prefixChangeDescr ); } return opid; }