Exemplo n.º 1
0
 public System.Xml.XmlNode Generate(XCRI.Interfaces.XCRICAP11.IImage image)
 {
     return(this._GetGeneratedNode((w) =>
     {
         this.XmlGenerator.Write(w, image);
     }));
 }
Exemplo n.º 2
0
 public void Write
 (
     System.Xml.XmlWriter xmlWriter,
     XCRI.Interfaces.XCRICAP11.IImage image
 )
 {
     if (image == null)
     {
         throw new ArgumentNullException("image");
     }
     if ((image.CompatibleWith & XCRIProfiles.XCRI_v1_1) == 0)
     {
         return;
     }
     this._WriteStartElement(xmlWriter, "image", Configuration.Namespaces.XCRICAP11NamespaceUri);
     this._WriteXsiTypeAttribute(xmlWriter, image.XsiTypeValue, image.XsiTypeValueNamespace);
     this._WriteXmlLanguageAttribute(xmlWriter, image.XmlLanguage);
     if (image.Source != null)
     {
         if (String.IsNullOrEmpty(xmlWriter.LookupPrefix(Configuration.Namespaces.XCRICAP11NamespaceUri)))
         {
             xmlWriter.WriteAttributeString("src", image.Source.ToString());
         }
         else
         {
             xmlWriter.WriteAttributeString("src", Configuration.Namespaces.XCRICAP11NamespaceUri, image.Source.ToString());
         }
     }
     if (String.IsNullOrEmpty(image.Title) == false)
     {
         if (String.IsNullOrEmpty(xmlWriter.LookupPrefix(Configuration.Namespaces.XCRICAP11NamespaceUri)))
         {
             xmlWriter.WriteAttributeString("title", image.Title);
         }
         else
         {
             xmlWriter.WriteAttributeString("title", Configuration.Namespaces.XCRICAP11NamespaceUri, image.Title);
         }
     }
     if (String.IsNullOrEmpty(image.Alt) == false)
     {
         if (String.IsNullOrEmpty(xmlWriter.LookupPrefix(Configuration.Namespaces.XCRICAP11NamespaceUri)))
         {
             xmlWriter.WriteAttributeString("alt", image.Alt);
         }
         else
         {
             xmlWriter.WriteAttributeString("alt", Configuration.Namespaces.XCRICAP11NamespaceUri, image.Alt);
         }
     }
     this._WriteEndElement(xmlWriter);
 }