Gets a specific global attribute from all the XML Schema definition language (XSD) schemas in the XmlSchemaSet.
@param QName $qualifiedName
@return XmlSchemaAttribute A specific global attribute.
490674
public function getGlobalAttribute( $qualifiedName )
	{
		if ( isset( $this->schemaAttributeCache[ $qualifiedName->__toString() ] ) )
		{
			return $this->schemaAttributeCache[ $qualifiedName->__toString() ];
		}

		$schemaAttribute = DOMSchemaAttribute::fromQName( $qualifiedName );
		$this->schemaElementCache[ $qualifiedName->__toString() ] = $schemaAttribute;
		return $schemaAttribute;
	}
1112393
public static String determineReadableClassName(String qualifiedName) {

        String readableClassName = StringUtils.removeWhitespace(qualifiedName);
        if (readableClassName == null) {

            throw new IllegalArgumentException("qualifiedName must not be null.");
        } else if (readableClassName.startsWith("[")) {

            StringBuilder classNameBuffer = new StringBuilder();
            while (readableClassName.startsWith("[")) {
                classNameBuffer.append("[]");
                readableClassName = readableClassName.substring(1);
            }
            
            if (PRIMITIVE_MAPPING.containsValue(readableClassName)) {
                
                for (Map.Entry<String,String> next : PRIMITIVE_MAPPING.entrySet()) {
                    if (next.getValue().equals(readableClassName)) {
                        readableClassName = next.getKey() + classNameBuffer.toString();
                        break;
                    }
                }
                
            } else if (readableClassName.startsWith("L") && readableClassName.endsWith(";")) {
                readableClassName = readableClassName.substring(1, readableClassName.length() - 1) + classNameBuffer.toString();
            } else {
                throw new IllegalArgumentException("qualifiedName was invalid {" + readableClassName + "}");                
            }
        } else if (readableClassName.endsWith("]")) {
            throw new IllegalArgumentException("qualifiedName was invalid {" + readableClassName + "}");
        }
        
        return readableClassName;
    }
33452
function expandQname($qname){
		// get element prefix
		if(strpos($qname,':') && !preg_match('/^http:\/\//',$qname)){
			// get unqualified name
			$name = substr(strstr($qname,':'),1);
			// get ns prefix
			$prefix = substr($qname,0,strpos($qname,':'));
			if(isset($this->namespaces[$prefix])){
				return $this->namespaces[$prefix].':'.$name;
			} else {
				return $qname;
			}
		} else {
			return $qname;
		}
	}
1178796
public function setSchemaName($schemaName)
    {
        if (trim($schemaName) == '') {
            $schemaName = null;
        }
        $this->schemaName = $schemaName;

        return $this;
    }
405734
final public function getMapping(SchemaQName $qname): Mapping
    {
        /** @var Message $class */
        $class = MessageResolver::resolveCurie(MessageResolver::resolveQName($qname));
        $schema = $class::schema();
        $curie = NodeV1Mixin::create()->getId()->getCurieMajor();

        if (!$schema->hasMixin($curie)) {
            throw new \InvalidArgumentException(
                sprintf('The SchemaQName [%s] does not have mixin [%s].', $qname, $curie)
            );
        }

        $mapping = $this->getMappingFactory()->create($schema, $this->getDefaultAnalyzer());
        // elastica or elasticsearch throws exception when _id is in the properties
        // likely due to it being a builtin field.
        $properties = $mapping->getProperties();

        // we use multi-field indexing on title to create sortable field
        // on nodes for general search and listing (title.raw)
        if ('text' === $properties['title']['type']) {
            // elastica >=5 uses "text" for string type
            $properties['title']['fields'] = ['raw' => ['type' => 'keyword', 'normalizer' => 'pbj_keyword']];
        } else {
            // elastica <5 uses "string" for string type
            $properties['title']['fields'] = ['raw' => ['type' => 'string', 'analyzer' => 'pbj_keyword_analyzer']];
        }

        unset($properties['_id']);
        $mapping
            ->setAllField(['enabled' => true, 'analyzer' => $this->getDefaultAnalyzer()])
            ->setProperties($properties);

        $dynamicTemplates = $mapping->getParam('dynamic_templates');
        if (!empty($dynamicTemplates)) {
            $mapping->setParam('dynamic_templates', $dynamicTemplates);
        }

        $this->filterMapping($mapping, $schema);
        return $mapping;
    }
1214098
public function addUseStatement(string $qualifiedName, string $alias = null) {
		if (!is_string($alias)) {
			if (false === strpos($qualifiedName, '\\')) {
				$alias = $qualifiedName;
			} else {
				$alias = substr($qualifiedName, strrpos($qualifiedName, '\\') + 1);
			}
		}

		$this->useStatements->set($alias, $qualifiedName);

		return $this;
	}
1186409
private static function getSchemaClassName($schemaName)
    {
        // Upgrade from pre 2.0.4
        if (strtolower($schemaName) == 'myisam'
            || empty($schemaName)) {
            $schemaName = self::DEFAULT_SCHEMA;
        }

        $class = str_replace(' ', '\\', ucwords(str_replace('_', ' ', strtolower($schemaName))));
        return '\Piwik\Db\Schema\\' . $class;
    }
1201017
public function loadSchema($filename)
    {
        if (!file_exists($filename)) {
            throw new FileNotFoundException($filename);
        }

        $xml = simplexml_load_file($filename);

        $tables = $this->loadTables($xml->xpath('//table'));
        return new Schema($tables);
    }
655733
public static function fromQName( $name )
	{
		$types = SchemaTypes::getInstance();

		if ( $name instanceof QName )
		{
			// If prefix is empty try looking it up
			if ( empty( $name->prefix ) )
			{
				$prefix = $types->getPrefixForNamespace( $name->namespaceURI );
				if ( $prefix ) $name->prefix = $prefix;
			}
			$qname = "{$name->prefix}:{$name->localName}";
		}
		else if ( is_string( $name ) )
		{
			$qname = $name;
		}
		else
		{
			throw new \InvalidArgumentException( "$qname must be string or a QName instance" );
		}

		$element = $types->getElement( $qname );

		if ( ! $element )
		{
			return null;
		}

		$result = new DOMSchemaElement();
		$result->QualifiedName = $name;
		$type = is_array( $element['types'][0] ) && isset( $element['types'][0]['parent'] )
			? $element['types'][0]['parent']
			: $element['types'][0];
		// if ( is_array( $element['types'][0] ) )
		// {
		// 	$x = 1;
		// }
		$elementType = is_array( $type ) ? false : $types->getType( $type );
		$result->ElementSchemaType = $elementType;
		$result->SchemaTypeName = $elementType['name'];
		$result->SubstitutionGroup = isset( $element['substitutionGroup'] ) ? $element['substitutionGroup'] : $type;
		// error_log( __CLASS__ . " need to populate the DOMSchemaElement instance" );
		return $result;
	}
315907
private String translateSchema(String schemaName) throws SQLException {

        if (useSchemaDefault && schemaName != null
                && schemaName.length() == 0) {
            ResultSet rs = executeSelect("SYSTEM_SCHEMAS", "IS_DEFAULT=TRUE");

            if (rs.next()) {
                return rs.getString(1);
            }

            return schemaName;
        }

        return schemaName;
    }
983527
function contractQname($qname){
		// get element namespace
		//$this->xdebug("Contract $qname");
		if (strrpos($qname, ':')) {
			// get unqualified name
			$name = substr($qname, strrpos($qname, ':') + 1);
			// get ns
			$ns = substr($qname, 0, strrpos($qname, ':'));
			$p = $this->getPrefixFromNamespace($ns);
			if ($p) {
				return $p . ':' . $name;
			}
			return $qname;
		} else {
			return $qname;
		}
	}
697603
public function getDefinition($definitionName)
    {
        if (!$this->hasDefinition($definitionName)) {
            throw new DcGeneralInvalidArgumentException(
                'Definition ' . $definitionName . ' is not registered in the configuration ' . $this->getName() . '.'
            );
        }

        return $this->definitions[$definitionName];
    }
874544
public function removeByQualifiedName($qualifiedName) {
		$this->ensureNotReadOnly('remove');
	
		$fileEngine = $this->getFileEngine();
		$fileEngine->removeByQualifiedName($qualifiedName);
		if (!$this->tm->hasOpenTransaction()) {
			$fileEngine->flush();
		}
	}
1201677
public function getTaxonomyForQName( $qname )
	{
		$prefix = $qname instanceof \QName
			? $qname->localName
			: strstr( $qname, ":", true );
		return $this->getTaxonomyForPrefix( $prefix );
	}
1356558
final static public Element newElement(QualifiedName elementName, QualifiedName value) {
	org.w3c.dom.Document doc = builder.newDocument();
	Element el = doc.createElementNS(elementName.getNamespaceURI(),
					 qualifiedNameToString(elementName.toQName()));
	
	// 1. we add an xsi:type="xsd:QName" attribute
	//   making sure xsi and xsd prefixes are appropriately declared.
	el.setAttributeNS(NamespacePrefixMapper.XSI_NS, "xsi:type", "xsd:QName");
	el.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xsd", XSD_NS_FOR_XML);

	// 2. We add the QualifiedName's string representation as child of the element
	//    This representation depends on the extant prefix-namespace mapping
	String valueAsString=qualifiedNameToString(value.toQName());
	el.appendChild(doc.createTextNode(valueAsString));
	
	// 3. We make sure that the QualifiedName's prefix is given the right namespace, or the default namespace is declared if there is no prefix
	int index=valueAsString.indexOf(":");
	if (index!=-1) {
	    String prefix = valueAsString.substring(0, index);
	    el.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:"+prefix, convertNsToXml(value.getNamespaceURI()));
	} else {
	    el.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns", convertNsToXml(value.getNamespaceURI()));
	}
	
	doc.appendChild(el);
	return el;
    }
835369
public IAnnotation getAnnotation(IAnnotatable element, String qualifiedName) {
		if (element != null) {
			try {
				final int separator = qualifiedName.lastIndexOf('.');
				final String simpleName;
				if (separator >= 0 && separator < (qualifiedName.length() - 1)) {
					simpleName = qualifiedName.substring(separator + 1, qualifiedName.length());
				} else {
					simpleName = qualifiedName;
				}
				for (final IAnnotation annotation : element.getAnnotations()) {
					final String name = annotation.getElementName();
					if (name.equals(simpleName) || name.equals(qualifiedName)) {
						return annotation;
					}
				}
			} catch (JavaModelException e) {
				//
			}
		}
		return null;
	}
687502
public static function classname($qualifiedName)
    {
        if (false !== $pos = strrpos($qualifiedName, '.')) {
            return substr($qualifiedName, $pos + 1); // start just after '.'
        } elseif (false !== $pos = strrpos($qualifiedName, '\\')) {
            return substr($qualifiedName, $pos + 1);
        } else {
            return $qualifiedName;  // there is no '.' in the qualified name
        }

    }