Performs the dxcc lookup against the QRZ.com XML API:
482008
def _lookup_qrz_dxcc(self, dxcc_or_callsign, apikey, apiv="1.3.3"):
        

        response = self._request_dxcc_info_from_qrz(dxcc_or_callsign, apikey, apiv=apiv)

        root = BeautifulSoup(response.text, "html.parser")
        lookup = {}

        if root.error: #try to get a new session key and try to request again

            if re.search('No DXCC Information for', root.error.text, re.I):  #No data available for callsign
                raise KeyError(root.error.text)
            elif re.search('Session Timeout', root.error.text, re.I): # Get new session key
                self._apikey = apikey = self._get_qrz_session_key(self._username, self._pwd)
                response = self._request_dxcc_info_from_qrz(dxcc_or_callsign, apikey)
                root = BeautifulSoup(response.text, "html.parser")
            else:
                raise AttributeError("Session Key Missing") #most likely session key missing or invalid

        if root.dxcc is None:
            raise ValueError

        if root.dxcc.dxcc:
            lookup[const.ADIF] = int(root.dxcc.dxcc.text)
        if root.dxcc.cc:
            lookup['cc'] = root.dxcc.cc.text
        if root.dxcc.cc:
            lookup['ccc'] = root.dxcc.ccc.text
        if root.find('name'):
            lookup[const.COUNTRY] = root.find('name').get_text()
        if root.dxcc.continent:
            lookup[const.CONTINENT] = root.dxcc.continent.text
        if root.dxcc.ituzone:
            lookup[const.ITUZ] = int(root.dxcc.ituzone.text)
        if root.dxcc.cqzone:
            lookup[const.CQZ] = int(root.dxcc.cqzone.text)
        if root.dxcc.timezone:
            lookup['timezone'] = float(root.dxcc.timezone.text)
        if root.dxcc.lat:
            lookup[const.LATITUDE] = float(root.dxcc.lat.text)
        if root.dxcc.lon:
            lookup[const.LONGITUDE] = float(root.dxcc.lon.text)

        return lookup
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
779338
QName constructQName(XMLLibImpl lib, Context cx, Object namespace, Object name) {
        String nameString = null;
        if (name instanceof QName) {
            if (namespace == Undefined.instance) {
                return (QName)name;
            } else {
                nameString = ((QName)name).localName();
            }
        }
        if (name == Undefined.instance) {
            nameString = "";
        } else {
            nameString = ScriptRuntime.toString(name);
        }

        if (namespace == Undefined.instance) {
            if ("*".equals(nameString)) {
                namespace = null;
            } else {
                namespace = lib.getDefaultNamespace(cx);
            }
        }
        Namespace namespaceNamespace = null;
        if (namespace == null) {
            //    leave as null
        } else if (namespace instanceof Namespace) {
            namespaceNamespace = (Namespace)namespace;
        } else {
            namespaceNamespace = lib.newNamespace(ScriptRuntime.toString(namespace));
        }
        String q_localName = nameString;
        String q_uri;
        String q_prefix;
        if (namespace == null) {
            q_uri = null;
            q_prefix = null;    //    corresponds to undefined; see QName class
        } else {
            q_uri = namespaceNamespace.uri();
            q_prefix = namespaceNamespace.prefix();
        }
        return newQName(lib, q_uri, q_localName, q_prefix);
    }
529639
def is_dxlink(x):
    '''
    
    '''
    if not isinstance(x, dict):
        return False
    if '$dnanexus_link' not in x:
        return False
    link = x['$dnanexus_link']
    if isinstance(link, basestring):
        return True
    elif isinstance(link, dict):
        return any(key in link for key in ('id', 'job'))
    return False
1118484
@Override
    public javax.xml.namespace.QName toQName () {
    	String escapedLocal=qnU.escapeToXsdLocalName(qnU.unescapeProvLocalName(local));
	if (qnU.is_NC_Name(escapedLocal)) {
	    if (prefix==null) {
		return new javax.xml.namespace.QName(namespace,escapedLocal);
	    } else {
		return new javax.xml.namespace.QName(namespace,escapedLocal,prefix);
	    }
	} else {
	    throw new QualifiedNameException("PROV-XML QName: local not valid " + local);

	}
    }
317624
function parse_XFCRC(blob) {
	blob.l += 2;
	var o = {cxfs:0, crc:0};
	o.cxfs = blob.read_shift(2);
	o.crc = blob.read_shift(4);
	return o;
}
86518
def _gen_xml(name,
             cpu,
             mem,
             diskp,
             nicp,
             hypervisor,
             os_type,
             arch,
             graphics=None,
             loader=None,
             **kwargs):
    '''
    
    '''
    mem = int(mem) * 1024  # MB
    context = {
        'hypervisor': hypervisor,
        'name': name,
        'cpu': six.text_type(cpu),
        'mem': six.text_type(mem),
    }
    if hypervisor in ['qemu', 'kvm']:
        context['controller_model'] = False
    elif hypervisor == 'vmware':
        # TODO: make bus and model parameterized, this works for 64-bit Linux
        context['controller_model'] = 'lsilogic'

    # By default, set the graphics to listen to all addresses
    if graphics:
        if 'listen' not in graphics:
            graphics['listen'] = {'type': 'address', 'address': '0.0.0.0'}
        elif 'address' not in graphics['listen'] and graphics['listen']['type'] == 'address':
            graphics['listen']['address'] = '0.0.0.0'

        # Graphics of type 'none' means no graphics device at all
        if graphics.get('type', 'none') == 'none':
            graphics = None
    context['graphics'] = graphics

    if loader and 'path' not in loader:
        log.info('`path` is a required property of `loader`, and cannot be found. Skipping loader configuration')
        loader = None
    elif loader:
        loader_attributes = []
        for key, val in loader.items():
            if key == 'path':
                continue
            loader_attributes.append("{key}='{val}'".format(key=key, val=val))
        loader['_attributes'] = ' '.join(loader_attributes)

    if 'boot_dev' in kwargs:
        context['boot_dev'] = []
        for dev in kwargs['boot_dev'].split():
            context['boot_dev'].append(dev)
    else:
        context['boot_dev'] = ['hd']

    context['loader'] = loader

    if os_type == 'xen':
        # Compute the Xen PV boot method
        if __grains__['os_family'] == 'Suse':
            context['kernel'] = '/usr/lib/grub2/x86_64-xen/grub.xen'
            context['boot_dev'] = []

    if 'serial_type' in kwargs:
        context['serial_type'] = kwargs['serial_type']
    if 'serial_type' in context and context['serial_type'] == 'tcp':
        if 'telnet_port' in kwargs:
            context['telnet_port'] = kwargs['telnet_port']
        else:
            context['telnet_port'] = 23023  # FIXME: use random unused port
    if 'serial_type' in context:
        if 'console' in kwargs:
            context['console'] = kwargs['console']
        else:
            context['console'] = True

    context['disks'] = []
    disk_bus_map = {'virtio': 'vd', 'xen': 'xvd', 'fdc': 'fd', 'ide': 'hd'}
    for i, disk in enumerate(diskp):
        prefix = disk_bus_map.get(disk['model'], 'sd')
        disk_context = {
            'device': disk.get('device', 'disk'),
            'target_dev': '{0}{1}'.format(prefix, string.ascii_lowercase[i]),
            'disk_bus': disk['model'],
            'type': disk['format'],
            'index': six.text_type(i),
        }
        if 'source_file' and disk['source_file']:
            disk_context['source_file'] = disk['source_file']

        if hypervisor in ['qemu', 'kvm', 'bhyve', 'xen']:
            disk_context['address'] = False
            disk_context['driver'] = True
        elif hypervisor in ['esxi', 'vmware']:
            disk_context['address'] = True
            disk_context['driver'] = False
        context['disks'].append(disk_context)
    context['nics'] = nicp

    context['os_type'] = os_type
    context['arch'] = arch

    fn_ = 'libvirt_domain.jinja'
    try:
        template = JINJA.get_template(fn_)
    except jinja2.exceptions.TemplateNotFound:
        log.error('Could not load template %s', fn_)
        return ''

    return template.render(**context)
905187
private void loadRepresentativeDomainAssignments() throws IOException {
		AssignmentXMLSerializer results = null;
		try {
			URL u = new URL(url + "getRepresentativeDomains");
			logger.info("Fetching {}",u);
			InputStream response = URLConnectionTools.getInputStream(u);
			String xml = JFatCatClient.convertStreamToString(response);
			results  = AssignmentXMLSerializer.fromXML(xml);

			Map<String,String> data = results.getAssignments();
			logger.info("got {} ranges from server.",data.size());
			for (String key: data.keySet()){
				String range = data.get(key);

				// work around list in results;

				String[] spl = range.split(",");
				SortedSet<String> value = new TreeSet<String>();

				for (String s : spl){
					value.add(s);

				}
				serializedCache.put(key, value);
			}

		} catch (MalformedURLException e){
			logger.error("Malformed Domain server: "+url,e);
			throw new IllegalArgumentException("Invalid Server: "+url, e);
		}
	}
204906
def dtdQAttrDesc(self, elem, name, prefix):
        
        ret = libxml2mod.xmlGetDtdQAttrDesc(self._o, elem, name, prefix)
        if ret is None:raise treeError('xmlGetDtdQAttrDesc() failed')
        __tmp = xmlAttribute(_obj=ret)
        return __tmp
851380
@Override
    @FFDCIgnore(NoSuchMethodException.class)
    public XAResource getXAResource(Serializable xaresinfo) throws XAResourceNotAvailableException {
        XAResource xa = null;
        if (xaresinfo != null) {
            @SuppressWarnings("unchecked")
            ArrayList<Byte> byteList = (ArrayList<Byte>) xaresinfo;
            byte[] bytes = new byte[byteList.size()];
            int i = 0;
            for (Byte b : byteList)
                bytes[i++] = b;
            try {
                ActivationConfig config = (ActivationConfig) Utils.deserialize(bytes);
                Object activationSpec = createActivationSpec(config.getActivationConfigProps(),
                                                             config.getAuthenticationAlias(),
                                                             null,
                                                             config.getDestinationRef(),
                                                             null,
                                                             config.getApplicationName());
                if (qmidenabled) {
                    Class<? extends Object> mcImplClass = activationSpec.getClass();
                    try {
                        String qmid = config.getQmid();
                        Method m = mcImplClass.getMethod("setQmid", new Class[] { String.class });
                        m.invoke(activationSpec, qmid);
                    } catch (NoSuchMethodException nsme) {
                        qmidenabled = false;
                    } catch (InvocationTargetException ite) {
                        qmidenabled = false;
                    }
                }
                BootstrapContextImpl bootstrapContext = bootstrapContextRef.getServiceWithException();
                ActivationSpec[] actspecs = new ActivationSpec[] { (ActivationSpec) activationSpec };
                XAResource[] resources = bootstrapContext.resourceAdapter.getXAResources(actspecs);
                if (resources != null && resources.length == 1) {
                    xa = resources[0];
                } else if (resources != null && resources.length > 1) {
                    throw new IllegalStateException(Utils.getMessage("J2CA8800.multiple.xa.resources", bootstrapContext.getResourceAdapterName(), id));
                }
            } catch (Exception e) {
                throw new XAResourceNotAvailableException(e);
            }
        }
        return xa;
    }
296017
def _loadDeviceDefinitions(self, urlOfXMLDefinition, xml):
        

        # extract the base path of the given XML to make sure any relative URL later will be created correctly
        url = urlparse(urlOfXMLDefinition)
        baseURIPath = url.path.rpartition('/')[0] + "/"

        try:
            root = ET.fromstring(xml)
        except Exception as e:
            raise ValueError("Can not parse CPE definitions '" + urlOfXMLDefinition + "': " + str(e))

        self.__deviceServiceDefinitions = {}
        self.__deviceSCPD = {}
        self.__deviceInformations = {'rootURL': urlOfXMLDefinition}
        self.__deviceUnknownKeys = {}
        self.__deviceXMLInitialized = False

        # iterate through all the informations
        self._iterateToFindSCPDElements(root, baseURIPath)
        self.__deviceXMLInitialized = True
293312
@Override
    public void dtdNotationDecl(String name, String publicId, String systemId, URL baseURL)
        throws XMLStreamException
    {
        if (mDTDHandler != null) {
            /* 24-Nov-2006, TSa: Note: SAX expects system identifiers to
             *  be fully resolved when reported...
             */
            if (systemId != null && systemId.indexOf(':') < 0) {
                try {
                    systemId = URLUtil.urlFromSystemId(systemId, baseURL).toExternalForm();
                } catch (IOException ioe) {
                    throw new WstxIOException(ioe);
                }
            }
            try {
                mDTDHandler.notationDecl(name, publicId, systemId);
            } catch (SAXException sex) {
                throw new WrappedSaxException(sex);
            }
        }
    }
608151
private void doLookups(ClassLoader cl) {
      if (lookupFailed)
         return;
      InitialContext ctx;
      try {
         ctx = new InitialContext();
      }
      catch (NamingException e) {
         log.failedToCreateInitialCtx(e);
         lookupFailed = true;
         return;
      }

      try {
         //probe jndi lookups first
         for (LookupNames.JndiTransactionManager knownJNDIManager : LookupNames.JndiTransactionManager.values()) {
            Object jndiObject;
            try {
               log.debugf("Trying to lookup TransactionManager for %s", knownJNDIManager.getPrettyName());
               jndiObject = ctx.lookup(knownJNDIManager.getJndiLookup());
            }
            catch (NamingException e) {
               log.debugf("Failed to perform a lookup for [%s (%s)]",
                         knownJNDIManager.getJndiLookup(), knownJNDIManager.getPrettyName());
               continue;
            }
            if (jndiObject instanceof TransactionManager) {
               tm = (TransactionManager) jndiObject;
               log.debugf("Found TransactionManager for %s", knownJNDIManager.getPrettyName());
               return;
            }
         }
      } finally {
         Util.close(ctx);
      }

      boolean found = true;
      // The TM may be deployed embedded alongside the app, so this needs to be looked up on the same CL as the Cache
      for (LookupNames.TransactionManagerFactory transactionManagerFactory : LookupNames.TransactionManagerFactory.values()) {
         log.debugf("Trying %s: %s", transactionManagerFactory.getPrettyName(), transactionManagerFactory.getFactoryClazz());
         TransactionManager transactionManager = transactionManagerFactory.tryLookup(cl);
         if (transactionManager != null) {
            log.debugf("Found %s: %s", transactionManagerFactory.getPrettyName(), transactionManagerFactory.getFactoryClazz());
            tm = transactionManager;
            found = false;
         }
      }
      lookupDone = true;
      lookupFailed = found;
   }
916139
def lookup(domain):
    
    xml = domain.XMLDesc(0)
    element = etree.fromstring(xml)
    subelm = element.find('.//interface[@type="network"]')

    if subelm is not None:
        network = subelm.find('.//source').get('network')
        hypervisor = domain.connect()

        return hypervisor.networkLookupByName(network)

    return None
913265
def search(self, spec, operator):
        ''''''
        return self.xmlrpc.search(spec, operator.lower())
117789
function( elem, context, xml ) {
			var data, cache, outerCache,
				dirkey = dirruns + " " + doneName;

			// We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
			if ( xml ) {
				while ( (elem = elem[ dir ]) ) {
					if ( elem.nodeType === 1 || checkNonElements ) {
						if ( matcher( elem, context, xml ) ) {
							return true;
						}
					}
				}
			} else {
				while ( (elem = elem[ dir ]) ) {
					if ( elem.nodeType === 1 || checkNonElements ) {
						outerCache = elem[ expando ] || (elem[ expando ] = {});
						if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) {
							if ( (data = cache[1]) === true || data === cachedruns ) {
								return data === true;
							}
						} else {
							cache = outerCache[ dir ] = [ dirkey ];
							cache[1] = matcher( elem, context, xml ) || cachedruns;
							if ( cache[1] === true ) {
								return true;
							}
						}
					}
				}
			}
		}
520555
function _lookupByNodeIdentifier(nodeIdentifier, timeoutMs) {
        // if the address is cached, return that
        if (cachedNodes[nodeIdentifier]) {
            return rx.of({ destination64: cachedNodes[nodeIdentifier]});
        }

        if (debug) {
            console.log("Looking up", nodeIdentifier);
        }

        return _localCommand("DN", timeoutMs, nodeIdentifier).pipe(
            rx.operators.catchError(function() {
                return rx.throwError(new Error("Node not found"));
            }),
            rx.operators.map(_extractDestination64),
            rx.operators.tap(function(address64) {
                cachedNodes[nodeIdentifier] = address64;
            }),
            rx.operators.map(function(address64) {
                return { destination64: address64 };
            })
        );
    }