Change element.Pattern to element.PatternElement.