xmldoc is an XML document tree, process is the row in the process
	table for which these are the parameters, and params is a list of
	(name, type, value) tuples one for each parameter.

	See also process_params_from_dict(), register_to_xmldoc().
175232
def append_process_params(xmldoc, process, params):
	
	try:
		paramtable = lsctables.ProcessParamsTable.get_table(xmldoc)
	except ValueError:
		paramtable = lsctables.New(lsctables.ProcessParamsTable)
		xmldoc.childNodes[0].appendChild(paramtable)

	for name, typ, value in params:
		row = paramtable.RowType()
		row.program = process.program
		row.process_id = process.process_id
		row.param = unicode(name)
		if typ is not None:
			row.type = unicode(typ)
			if row.type not in ligolwtypes.Types:
				raise ValueError("invalid type '%s' for parameter '%s'" % (row.type, row.param))
		else:
			row.type = None
		if value is not None:
			row.value = unicode(value)
		else:
			row.value = None
		paramtable.append(row)
	return process
1057183
def process_children(self, node, path, level, parent=None):
        
        data_parent = parent if parent else node
        chs = node.i_children
        for ch in chs:
            if ch.keyword in ["choice", "case"]:
                self.process_children(ch, path, level, node)
                continue
            p = path + "/" + self.qname(ch)
            tmpl = self.xsl_template(p)
            ct = self.xsl_calltemplate(ch.keyword, tmpl)
            self.xsl_withparam("level", "%d" % level, ct)
            if (data_parent.i_module is None or
                ch.i_module.i_modulename != data_parent.i_module.i_modulename):
                self.xsl_withparam("nsid", ch.i_module.i_modulename + ":", ct)
            if ch.keyword in ["leaf", "leaf-list"]:
                self.type_param(ch, ct)
            elif ch.keyword != "anyxml":
                offset = 2 if ch.keyword == "list" else 1
                self.process_children(ch, p, level + offset)
648019
def methodResponse(is_ret, *params)

      if is_ret
        resp = params.collect do |param|
          @writer.ele("param", conv2value(param))
        end

        resp = [@writer.ele("params", *resp)]
      else
        if params.size != 1 or params[0] === XMLRPC::FaultException
          raise ArgumentError, "no valid fault-structure given"
        end
        resp = @writer.ele("fault", conv2value(params[0].to_h))
      end


      tree = @writer.document(
               @writer.pi("xml", 'version="1.0"'),
               @writer.ele("methodResponse", resp)
             )

      @writer.document_to_str(tree) + "\n"
    end
827748
def _xml_update_modules(self, xmldict, modules):
        """"""
        for kdecor in xmldict:
            modname, memname = kdecor.split(".")
            if modname in modules:
                module = modules[modname]
                #We only need to check the members, types and executables
                memname = memname.lower()
                if memname in module.members:
                    docs = self.to_doc(xmldict[kdecor], modname)
                    self.process_memberdocs(docs, module)
                elif memname in module.types:
                    member = module.types[memname]
                    docs = self.to_doc(xmldict[kdecor], memname)
                    member.docstring.extend(docs)
                elif memname in module.executables:
                    member = module.executables[memname]
                    docs = self.to_doc(xmldict[kdecor], memname)
                    self.process_execdocs(docs, member, kdecor)
                else:
                    msg.warn("orphaned docstring. No member {} in module {}.".format(
                        memname, modname))
            else:
                msg.warn("orphaned docstring from XML docfile for {}".format(kdecor))
716554
private XmlDocument makeDocument(String name, String document)
            throws XmlException, PolicyIndexException {
        Map<String, String> metadata =
                m_utils.getDocumentMetadata(document
                        .getBytes());
        XmlDocument doc = m_dbXmlManager.manager.createDocument();
        String docName = name;

        if (docName == null || docName.isEmpty()) {
            docName = metadata.get("PolicyId");
        }

        if (docName == null || docName.isEmpty()) {
            throw new PolicyIndexException("Could not extract PolicyID from document.");
        }

        doc.setMetaData("metadata", "PolicyId", new XmlValue(XmlValue.STRING,
                                                             docName));
        doc.setContent(document);
        doc.setName(docName);

        // FIXME:
        // this is probably redundant as the xpath queries now directly query the policy
        // for the "any" scenarios
        String item = null;
        item = metadata.get("anySubject");
        if (item != null) {
            doc.setMetaData("metadata",
                            "anySubject",
                            new XmlValue(XmlValue.STRING, item));
        }

        item = metadata.get("anyResource");
        if (item != null) {
            doc.setMetaData("metadata",
                            "anyResource",
                            new XmlValue(XmlValue.STRING, item));
        }

        item = metadata.get("anyAction");
        if (item != null) {
            doc.setMetaData("metadata",
                            "anyAction",
                            new XmlValue(XmlValue.STRING, item));
        }

        item = metadata.get("anyEnvironment");
        if (item != null) {
            doc.setMetaData("metadata",
                            "anyEnvironment",
                            new XmlValue(XmlValue.STRING, item));
        }

        return doc;
    }
696197
public void process(RootDoc root) throws IOException {
        // out.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
        out.println("<XMI xmi.version=\"1.1\" >");

        out.println(" <XMI.header>");
        out.println("  <XMI.metamodel href=\"/vol/acfiles7/egonw/SourceForge/CDK/cdk/reports/javadoc/test2.xmi\" version=\"1.1\" name=\"UML\" />");
        out.println("  <XMI.model href=\"/vol/acfiles7/egonw/SourceForge/CDK/cdk/reports/javadoc/test2.xmi\" version=\"1\" name=\"/vol/acfiles7/egonw/SourceForge/CDK/cdk/reports/javadoc/test2.xmi\" />");
        out.println(" </XMI.header>");

        out.println(" <XMI.content>");
        out.println("  <docsettings viewid=\"-1\" documentation=\"\" uniqueid=\"1\" />");
        out.println("  <umlobjects>");
        generateUMLClass(root.specifiedPackages());
        out.println("  </umlobjects>");
        out.println("  <diagrams/>");
        out.println("  <listview>");
        out.println("   <listitem open=\"1\" type=\"800\" id=\"-1\" label=\"Views\" >");
        generateLogicalView(root.specifiedPackages());
        out.println("    <listitem open=\"1\" type=\"802\" id=\"-1\" label=\"Use Case View\" />");
        out.println("   </listitem>");
        out.println("  </listview>");
        out.println(" </XMI.content>");
        out.println("</XMI>");
    }
325876
private function processLinkbases()
	{
		// Begin processing any in the appinfo element
		$this->xbrlDocument->registerXPathNamespace( 'link', XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_LINK ] );
		$this->xbrlDocument->registerXPathNamespace( 'xlink', XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_XLINK ] );
		$this->xbrlDocument->registerXPathNamespace( 'xs', SCHEMA_NAMESPACE );
		$linkbases = $this->xbrlDocument->xpath("/xs:schema/xs:annotation/xs:appinfo/link:linkbase");

		foreach ( $linkbases as $linkbase )
		{
			// Look inside

			$arcRole = XBRL_Constants::$arcRoleAll;
			$title = "Custom linkbase";
			$function = 'processCustomLinkbaseXml';
			$usedOn = '';

			foreach ( XBRL_Constants::$standardLinkElements as $linkElement => $value )
			{
				if ( ! count( $linkbase->children( XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_LINK ] )->$linkElement ) ) continue;

				switch ( $linkElement )
				{
					case 'definitionLink':

						$arcRole = XBRL_Constants::$DefinitionLinkbaseRef;
						$title = 'Definition linkbase';
						$function = 'processDefinitionLinkbaseXml';
						$usedOn = 'link:definitionLink';

						break;

					case 'calculationLink':

						$arcRole = XBRL_Constants::$CalculationLinkbaseRef;
						$title = 'Calculation linkbase';
						$function = 'processCalculationLinkbaseXml';
						$usedOn = 'link:calculationLink';

						break;

					case 'presentationLink':

						$arcRole = XBRL_Constants::$PresentationLinkbaseRef;
						$title = 'Presentation linkbase';
						$function = 'processPresentationLinkbaseXml';
						$usedOn = 'link:presentationLink';

						break;

					case 'labelLink':

						$arcRole = XBRL_Constants::$LabelLinkbaseRef;
						$title = 'Label linkbase';
						$function = 'processLabelLinkbaseXml';
						$usedOn = 'link:label';

						break;

					case 'referenceLink':

						$arcRole = XBRL_Constants::$ReferenceLinkbaseRef;
						$title = 'Reference linkbase';
						$function = 'processReferenceLinkbaseXml';
						$usedOn = 'link:referenceLink';

						break;
				}
			}

			$linkbaseRef = array(
				'type' => 'simple',
				'href' => $this->schemaLocation,
				'role' => XBRL_Constants::$defaultLinkRole,
				'arcrole' => $arcRole,
				'title' => $title,
				'base' => "",
			);

			$this->$function( $linkbaseRef, $linkbase, basename( $linkbaseRef['href'] ), $usedOn );
		}

		foreach ( $this->linkbaseTypes as $linkbaseTypesKey => &$linkbaseType )
		{
			switch ( $linkbaseTypesKey )
			{
				case XBRL_Constants::$anyLinkbaseRef:
					$this->processPresentationLinkbases( $linkbaseType );
					$this->processLabelLinkbases( $linkbaseType );
					$this->processDefinitionLinkbases( $linkbaseType );
					$this->processCalculationLinkbases( $linkbaseType );
					$this->processReferenceLinkbases( $linkbaseType );
					// Handle custom linkbases
					$this->processCustomLinkbases( $linkbaseType );
					break;

				case XBRL_Constants::$PresentationLinkbaseRef:
					$this->processPresentationLinkbases( $linkbaseType );
					break;

				case XBRL_Constants::$LabelLinkbaseRef:
					$this->processLabelLinkbases( $linkbaseType );
					break;

				case XBRL_Constants::$DefinitionLinkbaseRef:
					$this->processDefinitionLinkbases( $linkbaseType );
					break;

				case XBRL_Constants::$CalculationLinkbaseRef:
					$this->processCalculationLinkbases( $linkbaseType );
					break;

				case XBRL_Constants::$ReferenceLinkbaseRef:
					$this->processReferenceLinkbases( $linkbaseType );
					break;

				default:
					// Handle custom linkbases
					$this->processCustomLinkbases( $linkbaseType );
					break;
			}
		}
	}
1168977
private static org.w3c.dom.Document toDom(final Document doc) {
        try {
            val xmlOutputter = new XMLOutputter();
            val elemStrWriter = new StringWriter();
            xmlOutputter.output(doc, elemStrWriter);
            val xmlBytes = elemStrWriter.toString().getBytes(Charset.defaultCharset());
            val dbf = DocumentBuilderFactory.newInstance();
            dbf.setNamespaceAware(true);
            dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
            dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
            dbf.setFeature("http://apache.org/xml/features/validation/schema/normalized-value", false);
            dbf.setFeature("http://javax.xml.XMLConstants/feature/secure-processing", true);
            dbf.setFeature("http://xml.org/sax/features/external-general-entities", false);
            dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);

            return dbf.newDocumentBuilder().parse(new ByteArrayInputStream(xmlBytes));
        } catch (final Exception e) {
            LOGGER.trace(e.getMessage(), e);
            return null;
        }
    }
1196705
def process_xml(self, xml):
        '''
        
        '''
        root = objectify.fromstring(xml)
        self.message_identifier = str(
            root.imsx_POXHeader.imsx_POXRequestHeaderInfo.
            imsx_messageIdentifier)
        try:
            result = root.imsx_POXBody.replaceResultRequest
            self.operation = REPLACE_REQUEST
            # Get result sourced id from resultRecord
            self.lis_result_sourcedid = result.resultRecord.\
                sourcedGUID.sourcedId
            self.score = str(result.resultRecord.result.
                             resultScore.textString)
        except:
            pass

        try:
            result = root.imsx_POXBody.deleteResultRequest
            self.operation = DELETE_REQUEST
            # Get result sourced id from resultRecord
            self.lis_result_sourcedid = result.resultRecord.\
                sourcedGUID.sourcedId
        except:
            pass

        try:
            result = root.imsx_POXBody.readResultRequest
            self.operation = READ_REQUEST
            # Get result sourced id from resultRecord
            self.lis_result_sourcedid = result.resultRecord.\
                sourcedGUID.sourcedId
        except:
            pass
839466
def _process_params(self):
        
        # transform sort dict into str
        self._sort_to_str()

        if 'rows' not in self._solr_params:
            self._solr_params['rows'] = self._cfg['row_size']

        for key, val in self._solr_params.items():
            if isinstance(val, str) and six.PY2:
                self._solr_params[key] = val.encode(encoding='UTF-8')
        return self._solr_params
800845
def append_search_summary(xmldoc, process, shared_object = "standalone", lalwrapper_cvs_tag = "", lal_cvs_tag = "", comment = None, ifos = None, inseg = None, outseg = None, nevents = 0, nnodes = 1):
	
	row = lsctables.SearchSummary()
	row.process_id = process.process_id
	row.shared_object = shared_object
	row.lalwrapper_cvs_tag = lalwrapper_cvs_tag
	row.lal_cvs_tag = lal_cvs_tag
	row.comment = comment or process.comment
	row.instruments = ifos if ifos is not None else process.instruments
	row.in_segment = inseg
	row.out_segment = outseg
	row.nevents = nevents
	row.nnodes = nnodes

	try:
		tbl = lsctables.SearchSummaryTable.get_table(xmldoc)
	except ValueError:
		tbl = xmldoc.childNodes[0].appendChild(lsctables.New(lsctables.SearchSummaryTable))
	tbl.append(row)

	return row
1068304
def process_document(self, doc):
        
        d = doc.select_segments("$.raw_content")[0]

        tables = doc.extract(self.table_extractor, d)
        for t in tables:
            doc.store([t], t.tag, group_by_tags=False)

        table_data_extractor = EntityTableDataExtraction()
        table_data_extractor.add_glossary(etk.load_glossary("./resources/address_dict.txt"), "address")
        table_data_extractor.add_glossary(etk.load_glossary("./resources/calibre_dict.txt"), "caliber")
        table_data_extractor.add_glossary(etk.load_glossary("./resources/capacity_dict.txt"), "capacity")
        table_data_extractor.add_glossary(etk.load_glossary("./resources/manufacturer_dict.txt"), "manufacturer")
        table_data_extractor.add_glossary(etk.load_glossary("./resources/price_dict.txt"), "price")

        tables = doc.select_segments("$.tables[*]")

        for t in tables:
            extractions = doc.extract(table_data_extractor, t)
            doc.store(extractions, "table_data_extraction")
        return list()
1247501
function processXML(name, uri, processor, resp, callback) {
  var parser = new xml2js.Parser();

  parser.parseString(resp, function (err, xml) {
    if (err) {
      GLOBAL.error(name, err);
      return;
    } else {
      processor.getAnnotations(name, uri, xml, function(err, annoRows) {
        callback(err, {name: name, uri: uri, annoRows: annoRows});
      });
    }
  });
}
1079370
def process(self, content):
        
        log.debug('processing:\n%s', content)
        self.reset()
        if content.tag is None:
            content.tag = content.value.__class__.__name__
        document = Document()
        self.append(document, content)
        return document.root()
379684
def xml(self, fn=None, src='word/document.xml', XMLClass=XML, **params):
        ""
        if src in self.xml_cache: return self.xml_cache[src]
        if src not in self.zipfile.namelist(): return
        x = XMLClass(
                fn=fn or (self.fn and self.fn.replace('.docx', '.xml')) or None,
                root=self.zipfile.read(src))
        self.xml_cache[src] = x
        return x
50004
def xml_params
      @xml_params ||= begin
        if Merb::Const::XML_MIME_TYPE_REGEXP.match(content_type)
          Hash.from_xml(raw_post) rescue Mash.new
        end
      end
    end
703980
function(xmlBody) {

        var parser = new DOMParser();
        var doc = parser.parseFromString(xmlBody, "application/xml");

        var resolver = function(foo) {
            var ii;
            for(ii in this.xmlNamespaces) {
                if (this.xmlNamespaces[ii] === foo) {
                    return ii;
                }
            }
        }.bind(this);

        var responseIterator = doc.evaluate('/d:multistatus/d:response', doc, resolver, XPathResult.ANY_TYPE, null);

        var result = [];
        var responseNode = responseIterator.iterateNext();

        while(responseNode) {

            var response = {
                href : null,
                propStat : []
            };

            response.href = doc.evaluate('string(d:href)', responseNode, resolver, XPathResult.ANY_TYPE, null).stringValue;

            var propStatIterator = doc.evaluate('d:propstat', responseNode, resolver, XPathResult.ANY_TYPE, null);
            var propStatNode = propStatIterator.iterateNext();

            while(propStatNode) {
                var propStat = {
                    status : doc.evaluate('string(d:status)', propStatNode, resolver, XPathResult.ANY_TYPE, null).stringValue,
                    properties : {},
                };

                var propIterator = doc.evaluate('d:prop/*', propStatNode, resolver, XPathResult.ANY_TYPE, null);

                var propNode = propIterator.iterateNext();
                while(propNode) {
                    var content = this._parsePropNode(propNode);
                    propStat.properties['{' + propNode.namespaceURI + '}' + propNode.localName] = content;
                    propNode = propIterator.iterateNext();

                }
                response.propStat.push(propStat);
                propStatNode = propStatIterator.iterateNext();


            }

            result.push(response);
            responseNode = responseIterator.iterateNext();

        }

        return result;

    }