Inheritance: NSObject, IContentHandler
コード例 #1
0
        public void ParserDidStartElement(NSXMLParser parser, NSString elementName, NSString namespaceURI, NSString qualifiedName, NSDictionary attributeDict)
        {
            GSXibElement element = GSXibElement.Alloc().InitWithTypeAndAttributes(elementName, attributeDict); //andAttributes: attributeDict];
            NSString key = (NSString)attributeDict.ObjectForKey((NSString)@"key");
            NSString refId = (NSString)attributeDict.ObjectForKey((NSString)@"id");

            if (key != null)
            {
                if (CurrentElement != null)
                {
                    CurrentElement.SetElementForKey(element, key);
                }
            }
            else
            {
                // For Arrays
                if (CurrentElement != null)
                {
                    CurrentElement.AddElement(element);
                }
            }
            if (refId != null)
            {
                Objects.SetObjectForKey(element, refId);
            }

             if (!@"archive".IsEqualToString(elementName) &&
                 !@"data".IsEqualToString(elementName))
             {
                 // only used for the root element
                 // push
                 Stack.AddObject(CurrentElement);
             }

             if (!@"archive".IsEqualToString(elementName))
             {
                 CurrentElement = element;
             }
        }
コード例 #2
0
        public void ParserFoundCharacters(NSXMLParser parser, NSString foundCharacters)
        {
            //string chars = foundCharacters.Value.Replace("\n", "\\n");
            //chars = chars.Replace("\r", "\\r");
            //chars = chars.Replace("\t", "\\t");
            //_tw.WriteLine("parser:foundCharacters: " + chars);

            if (CurrentElement != null)
            {
                CurrentElement.Value = foundCharacters;
            }
        }
コード例 #3
0
 public void ParserDidEndElement(NSXMLParser parser, NSString elementName, NSString namespaceURI, NSString qualifiedName)
 {
     if (!@"archive".IsEqualToString(elementName) &&
          !@"data".IsEqualToString(elementName))
     {
          // pop
         CurrentElement = (GSXibElement)Stack.LastObject();
         Stack.RemoveLastObject();
     }
 }