private void AddLineInfo(int lineNumber, int linePosition)
 {
     if (!base.IsDisposed)
     {
         LineInfo lineInfo = new LineInfo(lineNumber, linePosition);
         XamlNode node = new XamlNode(lineInfo);
         this.AddToBuffer(node);
     }
 }
 private void AddLineInfo(int lineNumber, int linePosition)
 {
     LineInfo lineInfo = new LineInfo(lineNumber, linePosition);
     XamlNode item = new XamlNode(lineInfo);
     this._nodeQueue.Enqueue(item);
     if (!this._hasLineInfo)
     {
         this._hasLineInfo = true;
     }
     if ((this._reader != null) && !this._reader.HasLineInfo)
     {
         this._reader.HasLineInfo = true;
     }
 }
Example #3
0
 public XamlNode(LineInfo lineInfo)
 {
     _nodeType         = XamlNodeType.None;
     _internalNodeType = InternalNodeType.LineInfo;
     _data             = lineInfo;
 }
Example #4
0
 public AttributeInfo(string name, string value, IXmlLineInfo lineInfo) : this(name, value)
 {
     LineInfo = new LineInfo(lineInfo);
 }
Example #5
0
 public AttributeInfo(string name, string value, LineInfo lineInfo) : this(name, value)
 {
     LineInfo = lineInfo;
 }
Example #6
0
 private AttributeInfo(string name, string value)
 {
     Name     = name;
     Value    = value;
     LineInfo = new LineInfo();
 }
Example #7
0
 public MemberInfo(XamlMember member, string value, IXmlLineInfo lineInfo) : this(member, value)
 {
     LineInfo = new LineInfo(lineInfo);
 }
Example #8
0
 public MemberInfo(XamlMember member, string value, LineInfo lineInfo) : this(member, value)
 {
     LineInfo = lineInfo;
 }
Example #9
0
 private MemberInfo(XamlMember member, string name)
 {
     Member   = member;
     Value    = name;
     LineInfo = new LineInfo();
 }
Example #10
0
        private void Initialize(XmlReader givenXmlReader, XamlSchemaContext schemaContext, XamlXmlReaderSettings settings)
        {
            XmlReader myXmlReader;

            _mergedSettings = (settings == null) ? new XamlXmlReaderSettings() : new XamlXmlReaderSettings(settings);
            //Wrap the xmlreader with a XmlCompatReader instance to apply MarkupCompat rules.
            if (!_mergedSettings.SkipXmlCompatibilityProcessing)
            {
                XmlCompatibilityReader mcReader =
                    new XmlCompatibilityReader(givenXmlReader,
                                               new IsXmlNamespaceSupportedCallback(IsXmlNamespaceSupported)
                                               );
                mcReader.Normalization = true;
                myXmlReader            = mcReader;
            }
            else
            {   //Don't wrap the xmlreader with XmlCompatReader.
                // Useful for uses where users want to keep mc: content in the XamlNode stream.
                // Or have already processed the markup compat and want that extra perf.
                myXmlReader = givenXmlReader;
            }
            // Pick up the XmlReader settings to override the "settings" defaults.
            if (!String.IsNullOrEmpty(myXmlReader.BaseURI))
            {
                _mergedSettings.BaseUri = new Uri(myXmlReader.BaseURI);
            }
            if (myXmlReader.XmlSpace == XmlSpace.Preserve)
            {
                _mergedSettings.XmlSpacePreserve = true;
            }
            if (!String.IsNullOrEmpty(myXmlReader.XmlLang))
            {
                _mergedSettings.XmlLang = myXmlReader.XmlLang;
            }
            IXmlNamespaceResolver       myXmlReaderNS   = myXmlReader as IXmlNamespaceResolver;
            Dictionary <string, string> xmlnsDictionary = null;

            if (myXmlReaderNS != null)
            {
                IDictionary <string, string> rootNamespaces = myXmlReaderNS.GetNamespacesInScope(XmlNamespaceScope.Local);
                if (rootNamespaces != null)
                {
                    foreach (KeyValuePair <string, string> ns in rootNamespaces)
                    {
                        if (xmlnsDictionary == null)
                        {
                            xmlnsDictionary = new Dictionary <string, string>();
                        }
                        xmlnsDictionary[ns.Key] = ns.Value;
                    }
                }
            }

            if (schemaContext == null)
            {
                schemaContext = new XamlSchemaContext();
            }

            _endOfStreamNode = new XamlNode(XamlNode.InternalNodeType.EndOfStream);

            _context = new XamlParserContext(schemaContext, _mergedSettings.LocalAssembly);
            _context.AllowProtectedMembersOnRoot = _mergedSettings.AllowProtectedMembersOnRoot;
            _context.AddNamespacePrefix(KnownStrings.XmlPrefix, XamlLanguage.Xml1998Namespace);

            Func <string, string> namespaceResolver = myXmlReader.LookupNamespace;

            _context.XmlNamespaceResolver = namespaceResolver;

            XamlScanner    xamlScanner = new XamlScanner(_context, myXmlReader, _mergedSettings);
            XamlPullParser parser      = new XamlPullParser(_context, xamlScanner, _mergedSettings);

            _nodeStream      = new NodeStreamSorter(_context, parser, _mergedSettings, xmlnsDictionary);
            _current         = new XamlNode(XamlNode.InternalNodeType.StartOfStream); // user must call Read() before using properties.
            _currentLineInfo = new LineInfo(0, 0);
        }