public XmlNode Generate(XCRI.Interfaces.XCRICAP11.ICatalog catalog)
 {
     return(this._GetGeneratedNode((w) =>
     {
         this.XmlGenerator.Write(w, catalog);
     }));
 }
Example #2
0
 public void Write
 (
     System.Xml.XmlWriter xmlWriter,
     XCRI.Interfaces.XCRICAP11.ICatalog catalog
 )
 {
     if (catalog == null)
     {
         throw new ArgumentNullException("catalog");
     }
     if ((catalog.CompatibleWith & XCRIProfiles.XCRI_v1_1) == 0)
     {
         return;
     }
     this._WriteStartElement(xmlWriter, "catalog", Configuration.Namespaces.XCRICAP11NamespaceUri);
     if (catalog.Generated.HasValue == false)
     {
         if (String.IsNullOrEmpty(xmlWriter.LookupPrefix(Configuration.Namespaces.XCRICAP11NamespaceUri)))
         {
             xmlWriter.WriteAttributeString("generated", (new DateTimeOffset(DateTime.Now)).ToISO8601(true));
         }
         else
         {
             xmlWriter.WriteAttributeString("generated", Configuration.Namespaces.XCRICAP11NamespaceUri, (new DateTimeOffset(DateTime.Now)).ToISO8601(true));
         }
     }
     else
     if (String.IsNullOrEmpty(xmlWriter.LookupPrefix(Configuration.Namespaces.XCRICAP11NamespaceUri)))
     {
         xmlWriter.WriteAttributeString("generated", catalog.Generated.Value.ToISO8601(true));
     }
     else
     {
         xmlWriter.WriteAttributeString("generated", Configuration.Namespaces.XCRICAP11NamespaceUri, catalog.Generated.Value.ToISO8601(true));
     }
     this.WriteXCRI11GenericItem(xmlWriter, (XCRI.Interfaces.XCRICAP11.IGeneric)catalog);
     foreach (XCRI.Interfaces.XCRICAP11.IProvider provider in catalog.Providers)
     {
         if (provider != null)
         {
             this.Write(xmlWriter, provider);
         }
     }
     this._WriteEndElement(xmlWriter);
 }