code: public byte[] convertToXmlByteArray(BucketLifecycleConfiguration config) throws SdkClientException {
  
          XmlWriter xml = new XmlWriter();
          xml.start("LifecycleConfiguration");
  
          if(config.getRules() != null) {
  	        for (Rule rule : config.getRules()) {
  	            writeRule(xml, rule);
  	        }
          }
  
          xml.end();
  
          return xml.getBytes();
      }
docs: /* <LifecycleConfiguration>
  <Rule>
  <ID>logs-rule</ID>
  <Status>Enabled</Status>
  <Transition>
  <Days>30</Days>
  <StorageClass>GLACIER</StorageClass>
  </Transition>
  <Expiration>
  <Days>365</Days>
  </Expiration>
  <NoncurrentVersionTransition>
  <NoncurrentDays>7</NoncurrentDays>
  <StorageClass>GLACIER</StorageClass>
  </NoncurrentVersionTransition>
  <NoncurrentVersionExpiration>
  <NoncurrentDays>14</NoncurrentDays>
  </NoncurrentVersionExpiration>
  <Filter> <!-- A filter can have only one of Prefix, Tag or And. -->
  <Prefix>logs/</Prefix>
  <Tag>
  <Key>key1</Key>
  <Value>value1</Value>
  </Tag>
  <And>
  <Prefix>logs/</Prefix>
  <Tag>
  <Key>key1</Key>
  <Value>value1</Value>
  </Tag>
  <Tag>
  <Key>key1</Key>
  <Value>value1</Value>
  </Tag>
  </And>
  </Filter>
  </Rule>
  <Rule>
  <ID>image-rule</ID>
  <Prefix>image/</Prefix>
  <Status>Enabled</Status>
  <Transition>
  <Date>2012-12-31T00:00:00.000Z</Date>
  <StorageClass>GLACIER</StorageClass>
  </Transition>
  <Expiration>
  <Date>2020-12-31T00:00:00.000Z</Date>
  </Expiration>
  <AbortIncompleteMultipartUpload>
  <DaysAfterInitiation>10</DaysAfterInitiation>
  </AbortIncompleteMultipartUpload>
  </Rule>
  </LifecycleConfiguration>