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;
	}