Exemplo n.º 1
0
 //We know the XML is structured to open and close with a party element, therefore it is logical to bounce in and out on these nodes
 public void ProcessOnlyPartyElement(Party party, XmlReader reader, List<IPartyFactory> partyFactory)
 {
     Attendee attendee;
     do
     {
         reader.Read();
         if (reader.NodeType == XmlNodeType.Element)
         {
             if (reader.Name == "Attendee")
             {
                 attendee = new Attendee(reader.GetAttribute("id"));
                 party.Attendee.Add(attendee);
             }
             IPartyFactory translator = partyFactory.Find(p => p.ElementName == reader.Name);
             if (translator != null)
                 BuildXmlPartyElement(translator.ElementToPartyTranslator,
                                      party.Attendee[party.Attendee.Count - 1],
                                      XNode.ReadFrom(reader) as XElement);
         }
     } while (reader.Name != "Party");
     //move past the end of the element
     reader.Read();
 }
Exemplo n.º 2
0
 public void BuildXmlPartyElement(IElementToPartyTranslator elementToPartyTranslator, Attendee attendee,
                                  XElement xElement)
 {
     elementToPartyTranslator.Translate(xElement);
 }