@param \SimpleXMLElement $node
@param string            $type

@return MetadataInterface
557811
private function parseMetadataType(\SimpleXMLElement $node, $type)
    {
        $options = $this->parseOptions($node);

        return $this->getMetadataType((string) $node['name'], $type, $options);
    }
729026
public function serializeNode(TreeNodeInterface $node, $language, TokenInterface $token)
    {
        $userRights = $this->nodePermissionResolver->resolve($node, $language, $token);
        if ($userRights === null) {
            return null;
        }

        $eid = $node->getTypeId();
        $element = $this->elementService->findElement($eid);
        $elementVersion = $this->elementService->findLatestElementVersion($element);

        //$identifier = new Makeweb_Elements_Element_Identifier($eid);
        $lockQtip = '';
        /*
        #if ($lockInfo = $lockManager->getLockInformation($identifier))
        #{
        #    if ($lockInfo['lock_uid'] == MWF_Env::getUid())
        #    {
        #        $lockQtip = '<hr>Locked by me.';
        #    }
        #    else
        #    {
        #        try
        #        {
        #            $user = MWF_Core_Users_User_Peer::getByUserID($lockInfo['lock_uid']);
        #        }
        #        catch (Exception $e)
        #        {
        #            $user = MWF_Core_Users_User_Peer::getSystemUser();
        #        }
        #
        #        $lockQtip = '<hr>Locked by '.$user->getUsername().'.';
        #    }
        #}
        */

        $elementtype = $this->elementService->findElementtype($element);
        $allowedElementtypeIds = [];
        foreach ($this->elementService->findAllowedChildren($elementtype) as $allowedElementtype) {
            $allowedElementtypeIds[] = $allowedElementtype->getId();
        }

        $qtip = 'TID: '.$node->getId().'<br />'.
            'EID: '.$element->getEid().'<br />'.
            'Version: '.$elementVersion->getVersion().'<br />'.
            '<hr>'.
            'Element Type: '.$elementtype->getTitle().'<br />'.
            'Element Type Version: '.$elementtype->getRevision().
            $lockQtip;

        $data = [
            'id' => $node->getID(),
            'eid' => $element->getEid(),
            'text' => $elementVersion->getBackendTitle($language, $element->getMasterLanguage()),
            'icon' => $this->iconResolver->resolveTreeNode($node, $language),
            'navigation' => $node->getInNavigation(),
            'restricted' => $node->getNeedAuthentication(),
            'element_type' => $elementtype->getTitle(),
            'element_type_id' => $elementtype->getId(),
            'element_type_type' => $elementtype->getType(),
            'alias' => $node->getTree()->isInstance($node),
            'allow_drag' => true,
            'sort_mode' => $node->getSortMode(),
            'areas' => [355],
            'allowed_et' => $allowedElementtypeIds,
            'is_published' => $this->stateManager->isPublished($node, $language),
            'rights' => $userRights,
            'qtip' => $qtip,
            'allow_children' => $elementtype->getHideChildren() ? false : true,
            'default_tab' => $elementtype->getDefaultTab(),
            'default_content_tab' => $elementtype->getDefaultContentTab(),
            'masterlanguage' => $element->getMasterLanguage(),
        ];

        if (count($node->getTree()->getChildren($node)) && !$elementtype->getHideChildren()) {
            $data['leaf'] = false;
            $data['expanded'] = false;
        } else {
            $data['leaf'] = true;
            $data['expanded'] = false;
        }

        if ($node->isRoot()) {
            $data['cls'] = 'siteroot-node';
            $data['expanded'] = true;
        }

        return $data;
    }
55848
public function addGraphMetadata(GraphNode $node, GraphMetadataInterface $data)
    {
        $this->nodes[] = [
            'node'   => $node,
            'object' => $data,
        ];

        return $this;
    }
436270
public function buildNodeEntityMetadata(\SimpleXMLElement $node, $className)
    {
        $reflection = new \ReflectionClass($className);

        return new NodeEntityMetadata(
            $className,
            $reflection,
            $this->buildNodeMetadata($node, $className),
            $this->idXmlMetadataFactory->buildEntityIdMetadata($node, $className, $reflection),
            $this->propertyXmlMetadataFactory->buildPropertiesMetadata($node, $className, $reflection),
            $this->relationshipXmlMetadataFactory->buildRelationshipsMetadata($node, $className, $reflection)
        );
    }
1278760
public function addNode(ElementtypeStructureNode $node)
    {
        $dsId = $node->getDsId();
        $parentDsId = $node->getParentDsId();

        if (array_key_exists($dsId, $this->dsIdMap)) {
            $msg = "Duplicate node in element structure tree: ds_id=$dsId";
            throw new InvalidArgumentException($msg);
        }

        // add node by node id and ds id to node map
        $this->dsIdMap[$dsId] = $node;
        $this->childrenMap[$parentDsId][] = $dsId;
        $this->parentMap[$dsId] = $parentDsId;

        if (!$this->rootDsId && $node->isRoot()) {
            $this->rootDsId = $dsId;
        }

        return $this;
    }
1139674
private function createTextNodeWithTypeAttribute(\DOMDocument $dom, \DOMNode $node, $value, $type = 'int')
    {
        $text = $dom->createTextNode($value);
        $attr = $dom->createAttribute('type');
        $attr->value = $type;

        $node->appendChild($text);
        $node->appendChild($attr);
    }
1269653
public function node(\DOMNode $node) {
        // A listing of types is at http://php.net/manual/en/dom.constants.php
        switch ($node->nodeType) {
            case XML_ELEMENT_NODE:
                $this->rules->element($node);
                break;
            case XML_TEXT_NODE:
                $this->rules->text($node);
                break;
            case XML_CDATA_SECTION_NODE:
                $this->rules->cdata($node);
                break;
            // FIXME: It appears that the parser doesn't do PI's.
            case XML_PI_NODE:
                $this->rules->processorInstruction($node);
                break;
            case XML_COMMENT_NODE:
                $this->rules->comment($node);
                break;
            // Currently we don't support embedding DTDs.
            default:
                print '<!-- Skipped -->';
                break;
        }
    }
1320094
public function nodeIsHypercube( $node )
	{
		$taxonomyElement = $this->getElementById( $node['label'] );
		if ( ! $taxonomyElement ) return false;
		return $taxonomyElement['substitutionGroup'] === XBRL_Constants::$xbrldtHypercubeItem;
	}
191449
public function appendXml(DOMNode $node)
    {
        $doc = ($node instanceof DOMDocument) ? $node : $node->ownerDocument;

        $tableNode = $node->appendChild($doc->createElement('table'));
        $tableNode->setAttribute('name', $this->getCommonName());

        if ($this->getSchema() !== null) {
            $tableNode->setAttribute('schema', $this->getSchema());
        }

        if ($this->phpName !== null) {
            $tableNode->setAttribute('phpName', $this->phpName);
        }

        if ($this->idMethod !== null) {
            $tableNode->setAttribute('idMethod', $this->idMethod);
        }

        if ($this->skipSql !== null) {
            $tableNode->setAttribute('skipSql', var_export($this->skipSql, true));
        }

        if ($this->readOnly !== null) {
            $tableNode->setAttribute('readOnly', var_export($this->readOnly, true));
        }

        if ($this->treeMode !== null) {
            $tableNode->setAttribute('treeMode', $this->treeMode);
        }

        if ($this->reloadOnInsert !== null) {
            $tableNode->setAttribute('reloadOnInsert', var_export($this->reloadOnInsert, true));
        }

        if ($this->reloadOnUpdate !== null) {
            $tableNode->setAttribute('reloadOnUpdate', var_export($this->reloadOnUpdate, true));
        }

        if ($this->forReferenceOnly !== null) {
            $tableNode->setAttribute('forReferenceOnly', var_export($this->forReferenceOnly, true));
        }

        if ($this->abstractValue !== null) {
            $tableNode->setAttribute('abstract', var_export($this->abstractValue, true));
        }

        if ($this->interface !== null) {
            $tableNode->setAttribute('interface', $this->interface);
        }

        if ($this->description !== null) {
            $tableNode->setAttribute('description', $this->description);
        }

        if ($this->namespace !== null) {
            $tableNode->setAttribute('namespace', $this->namespace);
        }

        if ($this->pkg !== null && !$this->pkgOverridden) {
            $tableNode->setAttribute('package', $this->pkg);
        }

        if ($this->baseClass !== null) {
            $tableNode->setAttribute('baseClass', $this->baseClass);
        }

        if ($this->basePeer !== null) {
            $tableNode->setAttribute('basePeer', $this->basePeer);
        }

        if ($this->getIsCrossRef()) {
            $tableNode->setAttribute('isCrossRef', $this->getIsCrossRef());
        }

        foreach ($this->columnList as $col) {
            $col->appendXml($tableNode);
        }

        foreach ($this->validatorList as $validator) {
            $validator->appendXml($tableNode);
        }

        foreach ($this->foreignKeys as $fk) {
            $fk->appendXml($tableNode);
        }

        foreach ($this->idMethodParameters as $param) {
            $param->appendXml($tableNode);
        }

        foreach ($this->indices as $index) {
            $index->appendXml($tableNode);
        }

        foreach ($this->unices as $unique) {
            $unique->appendXml($tableNode);
        }

        foreach ($this->vendorInfos as $vi) {
            $vi->appendXml($tableNode);
        }
    }
1202250
public function indexXDT( &$types, &$node, &$element )
	{
		$xbrldtAttributes = $node->attributes( XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_XBRLDT ] );
		if ( property_exists( $xbrldtAttributes, 'typedDomainRef' ) )
		{
			$element['typedDomainRef'] = (string) $xbrldtAttributes->typedDomainRef;
		}

		if ( ! empty( $element['substitutionGroup'] ) )
		{
			$id = $element['id'];
			$name = $element['name'];

			if ( $types->resolveToSubstitutionGroup( $element['substitutionGroup'], array( XBRL_Constants::$xbrldtDimensionItem ) ) )
			{
				$this->elementDimensions[] = $name;
			}
			else if ( $types->resolveToSubstitutionGroup( $element['substitutionGroup'], array( XBRL_Constants::$xbrldtHypercubeItem ) ) )
			{
				$this->elementHypercubes[] = $name;
			}
			else if ( $types->resolveToSubstitutionGroup( $element['substitutionGroup'], array( XBRL_Constants::$xlArc ) ) )
			{
				$this->elementArcTypes[] = $name;
			}
			else if ( $types->resolveToSubstitutionGroup( $element['substitutionGroup'], array( XBRL_Constants::$xlExtended ) ) )
			{
				$this->elementLinkTypes[] = $name;
			}
			// else if ( $element['type'] == XBRL_Constants::$enumItemType || $element['type'] == XBRL_Constants::$enumSetItemType )
			else if ( $types->resolvesToBaseType( $element['type'], array( XBRL_Constants::$enumItemType, XBRL_Constants::$enumSetItemType ), false ) )
			{
				// Record that this element is an extensible enumeration concept
				$this->enumerations[  $id ] = $id;

				// Make sure there is a linkrole and domain attribute
				$enumAttributes = $node->attributes( XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_ENUMERATIONS ] );

				if ( property_exists( $enumAttributes, 'domain' ) )
				{
					$element['enumDomain'] = (string)$enumAttributes['domain'];
				}
				else
				{
					if ( $this->isValidating() )
					{
						$this->log()->taxonomy_validation( "Extensible enumerations", "The extensible concept does not include a domain",
							array(
								'id' => $id,
								'name' => $name,
								'type' => $element['substitutionGroup'],
								'error' => 'enumte:MissingDomainError'
							)
						);
					}
				}

				if ( property_exists( $enumAttributes, 'linkrole' ) )
				{
					$element['enumLinkrole'] = (string)$enumAttributes['linkrole'];
				}
				else
				{
					if ( $this->isValidating() )
					{
						$this->log()->taxonomy_validation( "Extensible enumerations", "The extensible concept does not include a linkrole",
							array(
								'id' => $id,
								'name' => $name,
								'type' => $element['substitutionGroup'],
								'error' => 'enumte:MissingLinkRoleError'
							)
						);
					}
				}

				$element['enumHeadUsable'] = property_exists( $enumAttributes, 'headUsable' )
					? filter_var( $enumAttributes['headUsable'], FILTER_VALIDATE_BOOLEAN )
					: false;
			}
		}

	}
391301
private function getDocumentFromNode(NodeInterface $node)
    {
        $metadata = $this->metadataFactory->getMetadataForPhpcrNode($node);

        return $this->instantiateFromMetadata($metadata);
    }
225254
public function addChild(TreeNodeInterface $node)
    {
        $this->children[] = $node;
        $node->setParent($this);

        return $this;
    }
769594
public function addToArrayNode(AbstractNode $node): QueryBuilderInterface
    {
        if (!$this->node instanceof ArrayNode) {
            throw new \Exception(sprintf('You cannot call %s on node type: %s', __FUNCTION__, get_class($this->node)));
        }

        $this->node->add($node);
        $this->reassignParent($node);

        return $this;
    }
1186759
private function createInterface(Interface_ $node)
    {
        $ref = new RefClass();

        $ref->isInterface = true;
        $ref->fileName    = $this->file;
        $ref->name        = $this->getFullClassName((string)$node->name);
        $ref->docComment  = $this->createDocComment($node);

        $ref->startLine = $node->getLine();

        foreach ($node->extends as $implement) {
            $ref->implements[] = $this->getFullClassName($implement);
        }

        return $ref;
    }
333911
protected function numberData(SimpleXmlElement $xml, $node,  $type='latn')
    {

        if (!$xml->numbers) {
            return;
        }

        foreach ($xml->numbers->children() as $child) {
            if ( $child->getName() == $node && $child['numberSystem'] == $type) {
                return $child;
            }
            
        }
    }
75656
public function enterNode(Node $node)
    {
        if ($node instanceof Class_) {
            $this->class = $node;
            $this->abstractMethods = [];
        } elseif ($node instanceof ClassMethod) {
            if ($node->isAbstract()) {
                $name = \sprintf('%s::%s', $this->class->name, $node->name);
                $this->abstractMethods[] = $name;

                if ($node->stmts !== null) {
                    $msg = \sprintf('Abstract function %s cannot contain body', $name);
                    throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine());
                }
            }
        }
    }
117897
protected function compileDoctype(Node $node)
    {

        $name = $node->name;
        $value = isset($this->options['doctypes'][$name]) ? $this->options['doctypes'][$name] : '<!DOCTYPE '.$name.'>';

        if ($name === 'xml') {

            $this->options['mode'] = self::MODE_XML;

            if ($this->options['echo_xml_doctype'])
                $value = "<?='$value'?>";

        } else if (in_array($name, $this->options['xhtml_modes']))
            $this->options['mode'] = self::MODE_XHTML;
        else
            $this->options['mode'] = self::MODE_HTML;

        return $value;
    }