This method saves the XML version of this plugin in DB, for this pageId
Automatically called from savePageSession listenner in PageEdition
7980
public function savePluginConfigToXml($parameters)
    {
        $xmlValueFormatted = '';

        // Something has been saved, let's generate an XML for DB
        $xmlValueFormatted = "\t" . '<' . $this->pluginXmlDbKey . ' id="' . $parameters['melisPluginId'] . '">' .
            $xmlValueFormatted .
            "\t" . '</' . $this->pluginXmlDbKey . '>' . "\n";

        return $xmlValueFormatted;
    }
37904
protected void updatePluginConfiguration(PluginConfiguration value, String xmlTag, Counter counter,
            Element element)
   {
      boolean shouldExist = value != null;
      Element root = updateElement(counter, element, xmlTag, shouldExist);
      if (shouldExist)
      {
         Counter innerCount = new Counter(counter.getDepth() + 1);
         updatePluginManagement(value.getPluginManagement(), "pluginManagement", innerCount, root);
         iteratePlugin(innerCount, root, value.getPlugins(), "plugins", "plugin");
      }
   }
145642
def save(connection)
      xml = '<EngineSaveRequest session-id="' + connection.session_id + '">'
      xml << to_xml
      xml << '</EngineSaveRequest>'

      r = connection.execute(xml, '1.2')
      if r.success
        r.res.elements.each('EngineSaveResponse/EngineConfig') do |v|
          return @id = v.attributes['id'].to_i
        end
      end
    end
176856
def save_xml(self, doc, element):
        ''''''
        element.setAttributeNS(XSI_NS, XSI_NS_S + 'type', 'rtsExt:serviceport_ext')
        element.setAttributeNS(RTS_NS, RTS_NS_S + 'name', self.name)
        if self.comment:
            element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + 'comment',
                                   self.comment)
        if self.visible != True:
            element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + 'visible',
                                   str(self.visible).lower())
        for p in self.properties:
            new_prop_element = doc.createElementNS(RTS_EXT_NS,
                                                   RTS_EXT_NS_S + 'Properties')
            properties_to_xml(new_prop_element, p, self.properties[p])
            element.appendChild(new_prop_element)
1272916
public function saveXML()
    {

        $config = new DOMDocument('1.0', 'UTF-8');
        $config->formatOutput = true;

        $cartridge = $config->createElementNS(self::LTICC, 'cartridge_basiclti_link');
        $config->appendChild($cartridge);
        $cartridge->setAttributeNS(self::XMLNS, 'xmlns:blti', self::BLTI);
        $cartridge->setAttributeNS(self::XMLNS, 'xmlns:lticm', self::LTICM);
        $cartridge->setAttributeNS(self::XMLNS, 'xmlns:lticp', self::LTICP);
        $cartridge->setAttributeNS(self::XMLNS, 'xmlns:xsi', self::XSI);
        $cartridge->setAttributeNS(
            self::XSI,
            'xsi:schemaLocation',
            self::LTICC . ' ' . self::LTICC . '.xsd ' .
            self::BLTI . ' ' . self::BLTI . '.xsd ' .
            self::LTICM . ' ' . self::LTICM . '.xsd ' .
            self::LTICP . ' ' . self::LTICP . '.xsd'
        );

        $cartridge->appendChild($config->createElementNS(
            self::BLTI,
            'blti:title',
            $this->name
        ));

        /*
         * TODO CDATA wrapper?
         */
        if ($this->description) {
            $cartridge->appendChild($config->createElementNS(
                self::BLTI,
                'blti:description',
                $this->description
            ));
        }

        if ($this->iconURL) {
            $cartridge->appendChild($config->createElementNS(
                self::BLTI,
                'blti:icon',
                $this->iconURL
            ));
        }

        $cartridge->appendChild($config->createElementNS(
            self::BLTI,
            'blti:launch_url',
            $this->launchURL
        ));

        $extensions = $config->createElementNS(self::BLTI, 'blti:extensions');
        $cartridge->appendChild($extensions);
        $extensions->setAttribute('platform', 'canvas.instructure.com');

        $property = $config->createElementNS(
            self::LTICM,
            'lticm:property',
            $this->id
        );
        $property->setAttribute('name', 'tool_id');
        $extensions->appendChild($property);

        $property = $config->createElementNS(
            self::LTICM,
            'lticm:property',
            $this->launchPrivacy
        );
        $property->setAttribute('name', 'privacy_level');
        $extensions->appendChild($property);

        if (!empty($this->domain)) {
            $property = $config->createElementNS(
                self::LTICM,
                'lticm:property',
                $this->domain
            );
            $property->setAttribute('name', 'domain');
            $extensions->appendChild($property);
        }

        /* if no options are configured, create a default course navigation option */
        if (empty($this->options)) {
            $extensions->appendChild($this->getOptionsElement(
                $config,
                Option::COURSE_NAVIGATION(),
                []
            ));
        } else {
            foreach ($this->options as $option => $properties) {
                $extensions->appendChild($this->getOptionsElement(
                    $config,
                    $option,
                    $properties
                ));
            }
        }

        $bundle = $config->createElement('cartridge_bundle');
        $cartridge->appendChild($bundle);
        $bundle->setAttribute('identiferref', 'BLT001_Bundle');

        $icon = $config->createElement('cartridge_icon');
        $cartridge->appendChild($icon);
        $icon->setAttribute('identifierref', 'BLT001_Icon');

        return $config->saveXML();
    }
463683
static String setRegistrationId(Context context, String regId) {
        final SharedPreferences prefs = getGCMPreferences(context);
        String oldRegistrationId = prefs.getString(PROPERTY_REG_ID, "");
        int appVersion = getAppVersion(context);
        Log.v(TAG, "Saving regId on app version " + appVersion);
        Editor editor = prefs.edit();
        editor.putString(PROPERTY_REG_ID, regId);
        editor.putInt(PROPERTY_APP_VERSION, appVersion);
        editor.commit();
        return oldRegistrationId;
    }
950108
function(newnode, oldnode, lastnode, id, ids) {
		var result = true;
		var isSoftUpdate = false;
		var isPluginUpdate = false; // TODO: plugins...
		if ((newnode && !oldnode) || (!newnode && oldnode)) {
			result = false;
		} else if ((result = newnode.nodeType === oldnode.nodeType)) {
			switch (oldnode.nodeType) {
				case Node.TEXT_NODE:
					if (newnode.data !== oldnode.data) {
						result = false;
					}
					break;
				case Node.ELEMENT_NODE:
					if ((result = this._familiar(newnode, oldnode))) {
						if ((result = this._checkatts(newnode, oldnode, ids))) {
							if (this._maybesoft(newnode, oldnode)) {
								if (this._confirmsoft(newnode, oldnode)) {
									this._updatesoft(newnode, oldnode, ids);
									isSoftUpdate = true; // prevents the replace update
								}
								result = false; // crawling continued in _updatesoft
							} else {
								if (oldnode.localName !== "textarea") { // TODO: better forms support!
									result = newnode.childNodes.length === oldnode.childNodes.length;
									if (!result && oldnode.id) {
										lastnode = newnode;
										id = oldnode.id;
									}
								}
							}
						}
					}
					break;
			}
		}
		if (!result && !isSoftUpdate && !isPluginUpdate) {
			this._updates.collect(new edbml.FunctionUpdate(this._doc).setup(id));
			this._updates.collect(new edbml.HardUpdate(this._doc).setup(id, lastnode));
		}
		return result;
	}
1222673
def addReplaceDBPage( dbid, pageid, pagename, pagetype, pagebody, ignoreError = nil )

      @dbid, @pageid, @pagename, @pagetype, @pagebody, @ignoreError = dbid, pageid, pagename, pagetype, pagebody, ignoreError

      if pageid
         xmlRequestData = toXML( :pageid, @pageid )
      elsif pagename
         xmlRequestData = toXML( :pagename, @pagename )
      else
         raise "addReplaceDBPage: missing pageid or pagename"
      end

      xmlRequestData << toXML( :pagetype, @pagetype )
      xmlRequestData << toXML( :pagebody, encodeXML( @pagebody ) )
      xmlRequestData << toXML( :ignoreError, "1" ) if @ignoreError

      sendRequest( :addReplaceDBPage, xmlRequestData )

      @pageid = getResponseValue( :pageid )
      @pageid ||= getResponseValue( :pageID ) # temporary

      return self if @chainAPIcalls
      @pageid
    end
1315939
def save(connection)
      request = @id > 0 ? 'EnginePoolUpdateRequest' : 'EnginePoolCreateRequest'
      xml = %(<#{request} session-id="#{connection.session_id}">)
      xml << '<EnginePool'
      xml << %( id="#{@id}") if @id > 0
      xml << %( name="#{@name}" scope="#{@scope}">)
      @engines.each do |engine|
        xml << %(<Engine name="#{engine.name}" />)
      end
      xml << '</EnginePool>'
      xml << %(</#{request}>)

      r = connection.execute(xml, '1.2')
      if r.success
        r.res.elements.each(request.gsub('Request', 'Response')) do |v|
          return @id = v.attributes['id'].to_i
        end
      end
    end
352065
private function SaveNew()
    {
        $treeBuilder = new TreeBuilder(new PageTreeProvider($this->site));
        $treeBuilder->Insert($this->page, $this->parent, $this->previous);
    }
492127
protected void performSaveContent(String body, Locale locale) throws CmsException {

        // prepare the content for saving
        String content = prepareContent(true);

        String contentConversion = m_page.getConversion();
        // check if cleanup was selected in the editor, we have to add the cleanup parameter
        if (EDITOR_CLEANUP.equals(getParamAction())) {
            if ((contentConversion == null) || (contentConversion.equals(CmsHtmlConverter.PARAM_DISABLED))) {
                // if the current conversion mode is "false" only, we have to remove the "false" value and set it to "cleanup", as "false" will be stronger than all other values
                contentConversion = CmsHtmlConverter.PARAM_WORD;
            } else {
                // add "cleanup" to the already existing values
                contentConversion += ";" + CmsHtmlConverter.PARAM_WORD;
            }
        }
        m_page.setConversion(contentConversion);

        // create the element if necessary and if content is present
        if (!m_page.hasValue(body, locale) && !"".equals(content)) {
            m_page.addValue(body, locale);
        }

        // get the enabled state of the element
        boolean enabled = m_page.isEnabled(body, locale);

        // set the element data
        if (m_page.hasValue(body, locale)) {
            m_page.setStringValue(getCms(), body, locale, content);
        }

        // write the file
        m_file.setContents(m_page.marshal());
        m_file = getCms().writeFile(m_file);

        // content might have been modified during write operation
        m_page = CmsXmlPageFactory.unmarshal(getCms(), m_file);
        if (m_page.hasValue(body, locale)) {
            getCms().getRequestContext().setAttribute(CmsRequestContext.ATTRIBUTE_EDITOR, Boolean.TRUE);
            content = m_page.getStringValue(getCms(), body, locale);
            if (content == null) {
                content = "";
            }
            setParamContent(content);
            prepareContent(false);
            m_page.setEnabled(body, locale, enabled);
        }
    }
219768
public String getXmlVersion() {
	// dynamic load to support jre 1.4 and 1.5
	try {
	    Method m = doc.getClass().getMethod("getXmlVersion", new Class[] {});
	    return Caster.toString(m.invoke(doc, ArrayUtil.OBJECT_EMPTY));
	}
	catch (Exception e) {
	    throw new PageRuntimeException(Caster.toPageException(e));
	}
    }
844867
public function savePluginConfigToXml($parameters)
    {
        $xmlValueFormatted = '';

        // template_path is mendatory for all plugins
        if (!empty($parameters['template_path']))
            $xmlValueFormatted .= "\t\t" . '<template_path><![CDATA[' . $parameters['template_path'] . ']]></template_path>';

        if(!empty($parameters['pageIdFolder']))
            $xmlValueFormatted .= "\t\t" . '<pageIdFolder><![CDATA[' . $parameters['pageIdFolder'] . ']]></pageIdFolder>';

        // Something has been saved, let's generate an XML for DB
        $xmlValueFormatted = "\t" . '<' . $this->pluginXmlDbKey . ' id="' . $parameters['melisPluginId'] . '">' .
            $xmlValueFormatted .
            "\t" . '</' . $this->pluginXmlDbKey . '>' . "\n";

        return $xmlValueFormatted;
    }
990871
def save_xml(self, doc, element):
        ''''''
        element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + 'x', str(self.x))
        element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + 'y', str(self.y))
        element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + 'height',
                               str(self.height))
        element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + 'width',
                               str(self.width))
        element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + 'direction',
                               dir.to_string(self.direction).lower())
102284
@Override
    public void actionSave() throws JspException {

        CmsFile editFile = null;
        try {
            editFile = getCms().readFile(getParamResource(), CmsResourceFilter.ALL);
            String decodedContent = decodeContentParameter(getParamContent(), getFileEncoding(), editFile);
            try {
                editFile.setContents(decodedContent.getBytes(getFileEncoding()));
            } catch (UnsupportedEncodingException e) {
                throw new CmsException(
                    Messages.get().container(Messages.ERR_INVALID_CONTENT_ENC_1, getParamResource()),
                    e);
            }
            if (OpenCms.getWorkplaceManager().isXmlContentAutoCorrect()
                && (CmsResourceTypeXmlContent.isXmlContent(editFile))) {
                // enable auto correction in case of XML content (if configured)
                getCms().getRequestContext().setAttribute(CmsXmlContent.AUTO_CORRECTION_ATTRIBUTE, Boolean.TRUE);
            }
            // the file content might have been modified during the write operation
            CmsFile writtenFile = getCms().writeFile(editFile);
            decodedContent = CmsEncoder.createString(writtenFile.getContents(), getFileEncoding());
            setParamContent(encodeContent(decodedContent));
            // set the modified parameter
            setParamModified(Boolean.TRUE.toString());
        } catch (CmsException e) {
            showErrorPage(e);
        }

        if (getAction() != ACTION_CANCEL) {
            // save successful, set save action
            setAction(ACTION_SAVE);
        }
    }
1056697
public void savePreviousPageInfo( ActionForward forward, ActionForm form, ActionMapping mapping,
                                      HttpServletRequest request, ServletContext servletContext,
                                      boolean isSpecialForward )
    {
        if ( forward != null )
        {
            //
            // If previous-page is disabled (unused in this pageflow), or if we've already saved prevous-page info in
            // this request (for example, forward to foo.faces which forwards to foo.jsp), just return.
            //
            if ( request.getAttribute( SAVED_PREVIOUS_PAGE_INFO_ATTR ) != null || isPreviousPageInfoDisabled() ) return;

            String path = forward.getPath();
            int queryPos = path.indexOf( '?' );
            if ( queryPos != -1 ) path = path.substring( 0, queryPos );

            //
            // If a form bean was generated in this request, add it to the most recent PreviousPageInfo, so when we
            // go back to that page, the *updated* field values are restored (i.e., we don't revert to the values of
            // the form that was passed into the page originally).
            //
            if ( form != null && _currentPageInfo != null )
            {
                ActionForm oldForm = _currentPageInfo.getForm();
                if ( oldForm == null || oldForm.getClass().equals( form.getClass() ) )
                {
                    _currentPageInfo.setForm( form );
                    _currentPageInfo.setMapping( mapping );
                }
            }

            //
            // Only keep track of *pages* forwarded to -- not actions or pageflows.
            //
            if ( ! FileUtils.osSensitiveEndsWith( path, ACTION_EXTENSION ) )
            {
                //
                // Only save previous-page info if the page is within this pageflow.
                //
                if ( isLocalFile( forward ) ) // || PageFlowUtils.osSensitiveEndsWith( path, JPF_EXTENSION ) )
                {
                    _previousPageInfo = _currentPageInfo;
                    _currentPageInfo = new PreviousPageInfo( forward, form, mapping, request.getQueryString() );
                    request.setAttribute( SAVED_PREVIOUS_PAGE_INFO_ATTR, Boolean.TRUE );
                }
            }
        }
    }
616423
public function saveExtension(
        $uuid,
        $data,
        $extensionName,
        $webspaceKey,
        $locale,
        $userId
    ) {
        $document = $this->loadDocument(
            $uuid,
            $locale,
            [
                'exclude_ghost' => true,
            ]
        );

        if (null === $document) {
            throw new TranslatedNodeNotFoundException($uuid, $locale);
        }

        if (!$document instanceof ExtensionBehavior) {
            throw new \RuntimeException(
                sprintf(
                    'Document of class "%s" must implement the ExtensionableBehavior if it is to be extended',
                    get_class($document)
                )
            );
        }

        // save data of extensions
        $extension = $this->extensionManager->getExtension($document->getStructureType(), $extensionName);
        $node = $this->inspector->getNode($document);

        $extension->save($node, $data, $webspaceKey, $locale);
        $extensionData = $extension->load($node, $webspaceKey, $locale);

        $document->setExtension($extension->getName(), $extensionData);

        $this->documentManager->flush();

        $structure = $this->documentToStructure($document);

        $event = new ContentNodeEvent($node, $structure);
        $this->eventDispatcher->dispatch(ContentEvents::NODE_POST_SAVE, $event);

        return $structure;
    }