Exemplo n.º 1
0
 public Engine(bool includeComments, string inclusivePrefixes, bool fullDocumentMode)
 {
     _fullDocumentMode           = fullDocumentMode;
     _includeComments            = includeComments;
     _inclusivePrefixes          = inclusivePrefixes;
     _tokenizedInclusivePrefixes = C14nUtil.TokenizeInclusivePrefixList(inclusivePrefixes);
     _canonicalWriterStream      = new MemoryStream();
     _encoder         = new CanonicalEncoder(_canonicalWriterStream);
     _canonicalWriter = new CanonicalWriter(_encoder, _tokenizedInclusivePrefixes, includeComments, null, 0);
 }
 private bool IsNonRedundantNamespaceDeclaration(string prefix, string namespaceUri)
 {
     for (int i = _namespaceContext.Count - 1; i >= 0; i--)
     {
         NamespaceEntry ne = _namespaceContext[i];
         if (ne != null && ne.Prefix == prefix)
         {
             return(ne.NamespaceUri != namespaceUri);
         }
     }
     return(!C14nUtil.IsEmptyDefaultNamespaceDeclaration(prefix, namespaceUri) &&
            !C14nUtil.IsXmlPrefixDeclaration(prefix, namespaceUri));
 }