Build XML by appending to builder
339752
def build(self, builder):
        """"""
        params = {}
        if self.lang is not None:
            params["xml:lang"] = self.lang
        builder.start("TranslatedText", params)
        builder.data(self.text)
        builder.end("TranslatedText")
288575
def build(self, builder):
        """"""

        params = dict(OID=self.oid, Name=self.name)

        if self.description is not None:
            params["Description"] = self.description

        if self.signature_prompt is not None:
            params["mdsol:SignaturePrompt"] = self.signature_prompt

        if self.primary_formoid is not None:
            params["mdsol:PrimaryFormOID"] = self.primary_formoid

        if self.default_matrix_oid is not None:
            params["mdsol:DefaultMatrixOID"] = self.default_matrix_oid

        params["mdsol:DeleteExisting"] = bool_to_yes_no(self.delete_existing)

        builder.start("MetaDataVersion", params)
        if self.protocol:
            self.protocol.build(builder)

        for event in self.study_event_defs:
            event.build(builder)

        for formdef in self.form_defs:
            formdef.build(builder)

        for itemgroupdef in self.item_group_defs:
            itemgroupdef.build(builder)

        for itemdef in self.item_defs:
            itemdef.build(builder)

        for codelist in self.codelists:
            codelist.build(builder)

        # Extensions must always come after core elements
        if self.confirmation_message:
            self.confirmation_message.build(builder)

        for labeldef in self.label_defs:
            labeldef.build(builder)

        for edit_check in self.edit_checks:
            edit_check.build(builder)

        for derivation in self.derivations:
            derivation.build(builder)

        for custom_function in self.custom_functions:
            custom_function.build(builder)

        builder.end("MetaDataVersion")
1279307
def to_xml(options = {})
      builder = options[:builder] || XML.new("<#{self.class.member_name}/>")
      xml_keys.each { |key|
        value = respond_to?(key) ? send(key) : self[key]
        node = builder.add_element key

        # Duck-typing here is problematic because of ActiveSupport's #to_xml.
        case value
        when Resource, Subscription::AddOns
          value.to_xml options.merge(:builder => node)
        when Array
          value.each do |e|
            if e.is_a? Recurly::Resource
              # create a node to hold this resource
              e_node = node.add_element Helper.singularize(key)
              # serialize the resource into this node
              e.to_xml(options.merge(builder: e_node))
            else
              # it's just a primitive value
              node.add_element(Helper.singularize(key), e)
            end
          end
        when Hash, Recurly::Money
          value.each_pair { |k, v| node.add_element k.to_s, v }
        else
          node.text = value
        end
      }
      builder.to_s
    end
391391
protected function build()
    {
        $operation = $this->buildOperation('ListProfiles');

        $merchantID = $this->document->createElement('merchantID', $this->merchantId);
        $operation->appendChild($merchantID);

        if ($this->customerId) {
            $xmlMPayTid = $this->document->createElement('customerID', $this->customerId);
            $operation->appendChild($xmlMPayTid);
        }

        if ($this->expiredBy) {
            $xmlMPayTid = $this->document->createElement('expiredBy', $this->expiredBy);
            $operation->appendChild($xmlMPayTid);
        }

        if ($this->begin) {
            $xmlMPayTid = $this->document->createElement('begin', $this->begin);
            $operation->appendChild($xmlMPayTid);
        }

        if ($this->size) {
            $xmlMPayTid = $this->document->createElement('size', $this->size);
            $operation->appendChild($xmlMPayTid);
        }
    }
765221
protected function buildXml()
  {
    parent::buildXml();

   $checkedFiles = array();
   if ( !empty($_POST['files']) && is_array($_POST['files']) ){
     foreach ( $_POST['files'] as $file){
       $checkedFiles[$file['name']] = $file;
     }
   }

   for ($i = 0; $i < $this->zip->numFiles; $i++)
    {
      $fileName = $this->zip->getNameIndex($i);
      if ( !empty($checkedFiles[$fileName]) && $checkedFiles[$fileName]['options'] == 'ok' )
      {
        // file was sucessfully unzipped before
        $this->appendUnzippedNode($this->unzippedNodes,$fileName);
        continue;
      }

      $filePathInfo = pathinfo($fileName);
      $fileType = 'File';
      $fileStat = $this->zip->statName($i);
      if ( empty($filePathInfo['extension']) && empty($fileStat['size']) ){
        $fileType = 'Folder';
        // check if we can create subfolder
        if ( !$this->_currentFolder->checkAcl( CKFINDER_CONNECTOR_ACL_FOLDER_CREATE ) ){
          $this->errorCode = CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED;
          $this->appendErrorNode($this->skippedFilesNode, $this->errorCode, $fileName, $fileType);
          continue;
        }
      }
      $extractPath = $this->_currentFolder->getServerPath();
      $extractClientPath = $this->_currentFolder->getClientPath();

      $sFileName = $this->checkOneFile( $filePathInfo, $fileName );
      // security test failed, add to skipped
      if ( false !== $sFileName )
      {
        if ( file_exists($extractPath.$sFileName) )
        {
          if ( !is_dir($extractPath.$sFileName) )
          {
            // file was checked before
            if ( !empty($checkedFiles[$fileName]['options']) )
            {
              if ( $checkedFiles[$fileName]['options'] == 'autorename')
              {
                $sFileName = CKFinder_Connector_Utils_FileSystem::autoRename($extractPath,$sFileName);
                $this->extractTo($extractPath,$extractClientPath,$filePathInfo,$sFileName,$fileName);
              }
              elseif ( $checkedFiles[$fileName]['options'] == 'overwrite')
              {
                if ( !$this->_currentFolder->checkAcl( CKFINDER_CONNECTOR_ACL_FILE_DELETE ) ){
                  $this->errorCode = CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED;
                  $this->appendErrorNode($this->skippedFilesNode, $this->errorCode, $fileName, $fileType);
                  continue;
                }
                if (!CKFinder_Connector_Utils_FileSystem::unlink($extractPath.$sFileName))
                {
                  $this->errorCode = CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED;
                  $this->appendErrorNode($this->skippedFilesNode, $this->errorCode, $fileName, $fileType);
                }
                else
                {
                  $this->extractTo($extractPath,$extractClientPath,$filePathInfo,$sFileName,$fileName);
                }
              }
              else
              {
                // add to skipped files
                $this->appendUnzippedNode($this->unzippedNodes,$fileName,'skip');
              }
            }
            else
            {
              $this->errorCode = CKFINDER_CONNECTOR_ERROR_ALREADY_EXIST;
              $this->appendErrorNode($this->skippedFilesNode, $this->errorCode, $fileName, $fileType);
            }
          }
        }
        // file doesn't exist yet
        else
        {
          $this->extractTo($extractPath,$extractClientPath,$filePathInfo,$sFileName,$fileName);
        }
      }
    }
    $this->zip->close();

    $this->_connectorNode->addChild($this->unzippedNodes);

    if ($this->errorCode != CKFINDER_CONNECTOR_ERROR_NONE) {
      $this->_connectorNode->addChild($this->skippedFilesNode);
      $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ZIP_FAILED);
    }
  }
639869
public function buildXML()
    {
        $xml = new EncodingRequest();

        $request = $xml->setDomQuery($this->client->getConfig('userid'), $this->client->getConfig('userkey'), $this->getName());

        foreach ($this->getOperation()->getParams() as $name => $arg) {

            if ($this->get($name) === true) {
                $request->appendChild($xml->createElement($name));
            } else {
                if (! is_null($this->get($name)) && $this->get($name) !== false) {

                    if (! is_array($this->get($name))) {
                        // Non Array Type - String, Integer, etc ..

                        $request->appendChild($xml->createElement($name, $this->get($name)));
                    } else {

                        if ($name == "source") {
                            // Build "Flat" Array to XML

                            foreach ($this->get($name) as $key => $value) {
                                $request->appendChild($xml->createElement($name, $value));
                            }
                        } else {
                            // Build Array to XML

                            $arrayRoot = $request->appendChild($xml->createElement($name));

                            foreach ($this->get($name) as $key => $value) {

                                if (! is_array($value)) {
                                    $arrayRoot->appendChild($xml->createElement($key, $value));
                                } else {
                                    if ($key == "destination") {
                                        // Build "Flat" Array to XML in a sub Element
                                        foreach ($value as $subValue) {
                                            $arrayRoot->appendChild($xml->createElement($key, $subValue));
                                        }
                                    } else {
                                        $arraySubRoot = $arrayRoot->appendChild($xml->createElement($key));

                                        foreach ($value as $subKey => $subValue) {
                                            $arraySubRoot->appendChild($xml->createElement($subKey, $subValue));
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }

        return $xml;
    }
613692
def build(self, builder):
        """"""
        builder.start("mdsol:ReviewGroup", {})
        builder.data(self.name)
        builder.end("mdsol:ReviewGroup")
605410
def to_xml(options={})
      options[:indent] ||= 2
      xml = options[:builder] ||= Builder::XmlMarkup.new(:indent => options[:indent])
      xml.instruct! unless options[:skip_instruct]

      obj_name = self.class.resource_name.singularize
      
      # Turn our OpenStruct attributes into a hash we can export to XML
      obj_attrs = self.marshal_dump
      
      xml.tag!(obj_name) do
        obj_attrs.each do |key,value|
          next if key.to_sym == :link # Don't feed back links to server
          case value
            when ::Hash
              value.to_xml(
                options.merge({ 
                  :root => key, 
                  :skip_instruct => true 
                })
              )
            when ::Array
              value.to_xml(
                options.merge({ 
                  :root => key, 
                  :children => key.to_s.singularize, 
                  :skip_instruct => true
                })
              )
            else
              xml.tag!(key, value)
          end
        end
      end
    end
193993
def build(self, builder):
        """"""
        params = dict(OID=self.oid)
        if self.user_type:
            params.update(dict(UserType=self.user_type.value))
        builder.start(self.__class__.__name__, params)
        # build the children
        for child in ('login_name', 'display_name', 'full_name', 'first_name', 'last_name',
                      'organisation'):
            if getattr(self, child) is not None:
                getattr(self, child).build(builder)
        for address in self.addresses:
            address.build(builder)
        for email in self.emails:
            email.build(builder)
        for phone in self.phones:
            phone.build(builder)
        for location in self.locations:
            location.build(builder)
        builder.end(self.__class__.__name__)
820254
def build(self, builder):
        """"""
        params = dict(StudyOID=self.study_oid,
                      MetaDataVersionOID=self.metadata_version_oid,
                      EffectiveDate=dt_to_iso8601(self.effective_date))
        builder.start("MetaDataVersionRef", params)
        builder.end("MetaDataVersionRef")
228320
private void appendPropertyToBuilder(StringBuilder builder, String replicateOnWrite, String keyword)
    {
        String replicateOn_Write = CQLTranslator.getKeyword(keyword);
        builder.append(replicateOn_Write);
        builder.append(CQLTranslator.EQ_CLAUSE);
        builder.append(replicateOnWrite);
        builder.append(CQLTranslator.AND_CLAUSE);
    }
676162
def build(self, builder):
        
        builder.start("SignatureRef", dict(SignatureOID=self.oid))
        builder.end("SignatureRef")
1328631
def build(self, _resource, _cache=True, updatecontent=True, **kwargs):
        
        result = None

        if _cache and _resource in self._schemasbyresource:
            result = self._schemasbyresource[_resource]

        else:
            for builder in self._builders.values():
                try:
                    result = builder.build(_resource=_resource, **kwargs)

                except Exception:
                    pass

                else:
                    break

            if result is None:
                raise ValueError('No builder found for {0}'.format(_resource))

            if _cache:
                self._schemasbyresource[_resource] = result

            if updatecontent:
                from ..utils import updatecontent
                updatecontent(result, updateparents=False)

        return result
611606
def build(self, builder):
        
        params = {}

        # Add in the transaction type
        if self.transaction_type is not None:
            params["TransactionType"] = self.transaction_type

        if self.seqnum is None:
            # SeqNum is not optional (and defaulted)
            raise ValueError("SeqNum is not set.")  # pragma: no cover
        params["SeqNum"] = str(self.seqnum)

        if self.annotation_id is not None:
            # If an Annotation is contained with an Annotations element,
            # the ID attribute is required.
            params["ID"] = self.annotation_id

        builder.start("Annotation", params)

        if self.flags in (None, []):
            raise ValueError('Flag is not set.')

        # populate the flags
        for flag in self.flags:
            flag.build(builder)

        # add the Comment, if it exists
        if self.comment is not None:
            self.comment.build(builder)

        builder.end("Annotation")
1123209
def build(self, builder):
        """"""
        params = dict(
            OID=self.oid,
            Active=bool_to_true_false(self.active),
            BypassDuringMigration=bool_to_true_false(self.bypass_during_migration),
            NeedsRetesting=bool_to_true_false(self.needs_retesting),
        )

        builder.start("mdsol:EditCheckDef", params)
        for step in self.check_steps:
            step.build(builder)

        for action in self.check_actions:
            action.build(builder)
        builder.end("mdsol:EditCheckDef")
687017
def build(self, builder):
        """"""
        builder.start("Symbol", {})
        for child in self.translations:
            child.build(builder)
        builder.end("Symbol")
1343354
function appendData(data, builder) {
  if(Array.isArray(data) || Buffer.isBuffer(data)) {
    data = Buffer.from(data);
  } else {
    data = Buffer.from(data, 'ascii');
  }

  builder.appendBuffer(data);
}