@param XmlSerializationVisitor $visitor
@param type $entity
@param array $type
@param Context $context

@return \DOMElement
423096
public function serializeToXml(XmlSerializationVisitor $visitor, $entity, array $type, Context $context)
    {
        $visitor->getCurrentNode()->appendChild(
            $formNode = $visitor->getDocument()->createElement('id', $type['params']['id'])
        );

        return $formNode;
    }
757663
public function visit(Visitor $visitor, Generator $generator, $data)
    {
        $generator->startObjectElement('RoleAssignment');
        $visitor->setHeader('Content-Type', $generator->getMediaType('RoleAssignment'));

        $roleAssignment = $data->roleAssignment;
        $role = $roleAssignment->getRole();

        $generator->startAttribute(
            'href',
            $this->router->generate(
                'ezpublish_rest_loadRoleAssignmentForUserGroup',
                array(
                    'groupPath' => trim($data->id, '/'),
                    'roleId' => $role->id,
                )
            )
        );
        $generator->endAttribute('href');

        $roleLimitation = $roleAssignment->getRoleLimitation();
        if ($roleLimitation instanceof RoleLimitation) {
            $this->visitLimitation($generator, $roleLimitation);
        }

        $generator->startObjectElement('Role');
        $generator->startAttribute(
            'href',
            $this->router->generate('ezpublish_rest_loadRole', array('roleId' => $role->id))
        );
        $generator->endAttribute('href');
        $generator->endObjectElement('Role');

        $generator->endObjectElement('RoleAssignment');
    }
746250
public function visit(Visitor $visitor, Generator $generator, $data)
    {
        $generator->startObjectElement('ContentTypeInfoList');
        $visitor->setHeader('Content-Type', $generator->getMediaType('ContentTypeInfoList'));
        //@todo Needs refactoring, disabling certain headers should not be done this way
        $visitor->setHeader('Accept-Patch', false);

        $generator->startAttribute('href', $data->path);
        $generator->endAttribute('href');

        $generator->startList('ContentType');
        foreach ($data->contentTypes as $contentType) {
            $visitor->visitValueObject(
                new Values\RestContentType($contentType)
            );
        }
        $generator->endList('ContentType');

        $generator->endObjectElement('ContentTypeInfoList');
    }
809429
private function doRefresh($xmlEntity, array &$visited)
    {
        $oid = spl_object_hash($xmlEntity);
        if (isset($visited[$oid])) {
            return; // Prevent infinite recursion
        }

        $visited[$oid] = $xmlEntity; // mark visited

        $class = $this->xem->getClassMetadata(get_class($xmlEntity));
        if ($this->getXmlEntityState($xmlEntity) == self::STATE_MANAGED) {
            // @todo refresh xml-entity
        } else {
            throw new \InvalidArgumentException("XmlEntity is not MANAGED.");
        }
    }
373147
public function visit(Visitor $visitor, Generator $generator, $data)
    {
        $generator->startObjectElement('ContentObjectStates');
        $visitor->setHeader('Content-Type', $generator->getMediaType('ContentObjectStates'));

        $generator->startList('ObjectState');

        foreach ($data->states as $state) {
            $generator->startObjectElement('ObjectState');
            $generator->startAttribute(
                'href',
                $this->requestParser->generate(
                    'objectstate',
                    array(
                        'objectstategroup' => $state->groupId,
                        'objectstate' => $state->objectState->id,
                    )
                )
            );
            $generator->endAttribute('href');
            $generator->endObjectElement('ObjectState');
        }

        $generator->endList('ObjectState');

        $generator->endObjectElement('ContentObjectStates');
    }
581839
public function visit(Visitor $visitor, Generator $generator, $data)
    {
        $generator->startObjectElement('Role');
        $visitor->setHeader('Content-Type', $generator->getMediaType($data instanceof RoleDraft ? 'RoleDraft' : 'Role'));
        $visitor->setHeader('Accept-Patch', $generator->getMediaType('RoleInput'));
        $this->visitRoleAttributes($visitor, $generator, $data);
        $generator->endObjectElement('Role');
    }
827745
public function setVisitorType(\BlackForest\PiwikBundle\Entity\PiwikVisitorType $visitorType = null)
    {
        $this->visitorType = $visitorType;

        return $this;
    }
782732
public function serialize(VisitorInterface $visitor, ?UuidInterface $uuid, Type $type, Context $context): ?string
    {
        if (null === $uuid) {
            return $visitor->visitNull(null, Type::null(), $context);
        }

        return $visitor->visitString($uuid->toString(), $type, $context);
    }
25183
@Override
	public void traverse(SchemaVisitor visitor) {
    	visitor.initialize(m_xsdpackageName, m_targetNamespace,m_classes);
    	for (Map.Entry<String,ObjectDescriptor> entry: m_elements.entrySet()) {
    		ObjectDescriptor objectDescriptor = entry.getValue();
    		// get the type and call the visitor for it.
    		objectDescriptor.traverse(visitor);
    	}
    	visitor.terminate();
    }
709754
public function serializeToJson(
        JsonSerializationVisitor $visitor,
        \Exception $exception,
        array $type,
        Context $context
    ) {
        $data = $this->convertToArray($exception, $context);

        return $visitor->visitArray($data, $type, $context);
    }
962044
public function deserializeExtReferenceFromJson(
        JsonDeserializationVisitor $visitor,
        $url,
        array $type,
        Context $context
    ) {
        try {
            return $this->converter->getExtReference(
                $visitor->visitString($url, $type, $context)
            );
        } catch (\InvalidArgumentException $e) {
            return null;
        }
    }
584635
public function visit(Visitor $visitor, Generator $generator, $data)
    {
        $generator->startObjectElement('Location');
        $visitor->setHeader('Content-Type', $generator->getMediaType('Location'));
        $visitor->setHeader('Accept-Patch', $generator->getMediaType('LocationUpdate'));

        $location = $data->location;
        $contentInfo = $location->getContentInfo();

        $generator->startAttribute(
            'href',
            $this->router->generate(
                'ezpublish_rest_loadLocation',
                array('locationPath' => trim($location->pathString, '/'))
            )
        );
        $generator->endAttribute('href');

        $generator->startValueElement('id', $location->id);
        $generator->endValueElement('id');

        $generator->startValueElement('priority', $location->priority);
        $generator->endValueElement('priority');

        $generator->startValueElement(
            'hidden',
            $this->serializeBool($generator, $location->hidden)
        );
        $generator->endValueElement('hidden');

        $generator->startValueElement(
            'invisible',
            $this->serializeBool($generator, $location->invisible)
        );
        $generator->endValueElement('invisible');

        $generator->startObjectElement('ParentLocation', 'Location');
        if (trim($location->pathString, '/') !== '1') {
            $generator->startAttribute(
                'href',
                $this->router->generate(
                    'ezpublish_rest_loadLocation',
                    array(
                        'locationPath' => implode('/', array_slice($location->path, 0, count($location->path) - 1)),
                    )
                )
            );
            $generator->endAttribute('href');
        }
        $generator->endObjectElement('ParentLocation');

        $generator->startValueElement('pathString', $location->pathString);
        $generator->endValueElement('pathString');

        $generator->startValueElement('depth', $location->depth);
        $generator->endValueElement('depth');

        $generator->startValueElement('childCount', $data->childCount);
        $generator->endValueElement('childCount');

        $generator->startValueElement('remoteId', $location->remoteId);
        $generator->endValueElement('remoteId');

        $generator->startObjectElement('Children', 'LocationList');
        $generator->startAttribute(
            'href',
            $this->router->generate(
                'ezpublish_rest_loadLocationChildren',
                array(
                    'locationPath' => trim($location->pathString, '/'),
                )
            )
        );
        $generator->endAttribute('href');
        $generator->endObjectElement('Children');

        $generator->startObjectElement('Content');
        $generator->startAttribute(
            'href',
            $this->router->generate('ezpublish_rest_loadContent', array('contentId' => $contentInfo->id))
        );
        $generator->endAttribute('href');
        $generator->endObjectElement('Content');

        $generator->startValueElement('sortField', $this->serializeSortField($location->sortField));
        $generator->endValueElement('sortField');

        $generator->startValueElement('sortOrder', $this->serializeSortOrder($location->sortOrder));
        $generator->endValueElement('sortOrder');

        $generator->startObjectElement('UrlAliases', 'UrlAliasRefList');
        $generator->startAttribute(
            'href',
            $this->router->generate(
                'ezpublish_rest_listLocationURLAliases',
                array('locationPath' => trim($location->pathString, '/'))
            )
        );
        $generator->endAttribute('href');
        $generator->endObjectElement('UrlAliases');

        $generator->startObjectElement('ContentInfo', 'ContentInfo');
        $generator->startAttribute(
            'href',
            $this->router->generate(
                'ezpublish_rest_loadContent',
                array('contentId' => $contentInfo->id)
            )
        );
        $generator->endAttribute('href');
        $visitor->visitValueObject(new RestContentValue($contentInfo));
        $generator->endObjectElement('ContentInfo');

        $generator->endObjectElement('Location');
    }
948618
public function visit(Visitor $visitor, Generator $generator, $data)
    {
        parent::visit($visitor, $generator, $data->version);
        $visitor->setHeader(
            'Location',
            $this->router->generate(
                'ezpublish_rest_loadContentInVersion',
                array(
                    'contentId' => $data->version->content->id,
                    'versionNumber' => $data->version->content->getVersionInfo()->versionNo,
                )
            )
        );
        $visitor->setStatus(201);
    }
27741
public function serializeHashToJson(
        JsonSerializationVisitor $visitor,
        Hash $data,
        array $type,
        Context $context
    ) {
        return new Hash($data);
    }
1166779
public function visit(Visitor $visitor, Generator $generator, $data)
    {
        $generator->startObjectElement('UserGroupRefList');
        $visitor->setHeader('Content-Type', $generator->getMediaType('UserGroupRefList'));
        //@todo Needs refactoring, disabling certain headers should not be done this way
        $visitor->setHeader('Accept-Patch', false);

        $generator->startAttribute('href', $data->path);
        $generator->endAttribute('href');

        $groupCount = count($data->userGroups);

        $generator->startList('UserGroup');
        foreach ($data->userGroups as $userGroup) {
            $generator->startObjectElement('UserGroup');

            $generator->startAttribute(
                'href',
                $this->router->generate(
                    'ezpublish_rest_loadUserGroup',
                    array(
                        'groupPath' => trim($userGroup->mainLocation->pathString, '/'),
                    )
                )
            );
            $generator->endAttribute('href');

            if ($data->userId !== null && $groupCount > 1) {
                $generator->startHashElement('unassign');

                $generator->startAttribute(
                    'href',
                    $this->router->generate(
                        'ezpublish_rest_unassignUserFromUserGroup',
                        array(
                            'userId' => $data->userId,
                            'groupPath' => $userGroup->mainLocation->path[count($userGroup->mainLocation->path) - 1],
                        )
                    )
                );
                $generator->endAttribute('href');

                $generator->startAttribute('method', 'DELETE');
                $generator->endAttribute('method');

                $generator->endHashElement('unassign');
            }

            $generator->endObjectElement('UserGroup');
        }
        $generator->endList('UserGroup');

        $generator->endObjectElement('UserGroupRefList');
    }
588229
public function addVisitor($location, RequestVisitorInterface $visitor)
    {
        $this->factory->addRequestVisitor($location, $visitor);

        return $this;
    }
1352029
public function visit(Visitor $visitor, Generator $generator, $data)
    {
        $generator->startObjectElement('Tag');
        $visitor->setHeader('Content-Type', $generator->getMediaType('Tag'));
        $visitor->setHeader('Accept-Patch', $generator->getMediaType('TagUpdate'));

        $tag = $data->tag;

        $generator->startAttribute(
            'href',
            $this->router->generate(
                'ezpublish_rest_eztags_loadTag',
                ['tagPath' => trim($tag->pathString, '/')]
            )
        );
        $generator->endAttribute('href');

        $generator->startValueElement('id', $tag->id);
        $generator->endValueElement('id');

        $tagPath = explode('/', trim($tag->pathString, '/'));
        $parentPathString = implode('/', array_slice($tagPath, 0, count($tagPath) - 1));

        if (!empty($tag->parentTagId)) {
            $generator->startObjectElement('ParentTag', 'Tag');
            $generator->startAttribute(
                'href',
                $this->router->generate(
                    'ezpublish_rest_eztags_loadTag',
                    [
                        'tagPath' => $parentPathString,
                    ]
                )
            );
            $generator->endAttribute('href');
            $generator->endObjectElement('ParentTag');
        }

        if (!empty($tag->mainTagId)) {
            $generator->startObjectElement('MainTag', 'Tag');
            $generator->startAttribute(
                'href',
                $this->router->generate(
                    'ezpublish_rest_eztags_loadTag',
                    [
                        // Main tags always have a same parent tag ID
                        'tagPath' => $parentPathString . '/' . $tag->mainTagId,
                    ]
                )
            );
            $generator->endAttribute('href');
            $generator->endObjectElement('MainTag');
        }

        $this->visitTranslatedList($generator, $tag->keywords, 'keywords');

        $generator->startValueElement('depth', $tag->depth);
        $generator->endValueElement('depth');

        $generator->startValueElement('pathString', $tag->pathString);
        $generator->endValueElement('pathString');

        $generator->startValueElement(
            'modificationDate',
            $tag->modificationDate->format('c')
        );
        $generator->endValueElement('modificationDate');

        $generator->startValueElement('remoteId', $tag->remoteId);
        $generator->endValueElement('remoteId');

        $generator->startValueElement(
            'alwaysAvailable',
            $this->serializeBool($generator, $tag->alwaysAvailable)
        );
        $generator->endValueElement('alwaysAvailable');

        $generator->startValueElement('mainLanguageCode', $tag->mainLanguageCode);
        $generator->endValueElement('mainLanguageCode');

        $generator->startValueElement(
            'languageCodes',
            implode(',', $tag->languageCodes)
        );
        $generator->endValueElement('languageCodes');

        if (empty($tag->mainTagId)) {
            $generator->startValueElement('childrenCount', $data->childrenCount);
            $generator->endValueElement('childrenCount');

            $generator->startObjectElement('Children', 'TagList');
            $generator->startAttribute(
                'href',
                $this->router->generate(
                    'ezpublish_rest_eztags_loadTagChildren',
                    [
                        'tagPath' => trim($tag->pathString, '/'),
                    ]
                )
            );
            $generator->endAttribute('href');
            $generator->endObjectElement('Children');

            $generator->startValueElement('synonymsCount', $data->synonymsCount);
            $generator->endValueElement('synonymsCount');

            $generator->startObjectElement('Synonyms', 'TagList');
            $generator->startAttribute(
                'href',
                $this->router->generate(
                    'ezpublish_rest_eztags_loadTagSynonyms',
                    ['tagPath' => trim($tag->pathString, '/')]
                )
            );
            $generator->endAttribute('href');
            $generator->endObjectElement('Synonyms');
        }

        $generator->startObjectElement('RelatedContent', 'ContentList');
        $generator->startAttribute(
            'href',
            $this->router->generate(
                'ezpublish_rest_eztags_getRelatedContent',
                [
                    'tagPath' => trim($tag->pathString, '/'),
                ]
            )
        );
        $generator->endAttribute('href');
        $generator->endObjectElement('RelatedContent');

        $generator->endObjectElement('Tag');
    }