Tabnine Logo
CmsXmlContent.setAutoCorrectionEnabled
Code IndexAdd Tabnine to your IDE (free)

How to use
setAutoCorrectionEnabled
method
in
org.opencms.xml.content.CmsXmlContent

Best Java code snippets using org.opencms.xml.content.CmsXmlContent.setAutoCorrectionEnabled (Showing top 16 results out of 315)

origin: org.opencms/opencms-core

/**
 * Unmarshal the XML content with auto-correction.
 * @param file the file that contains the XML
 * @return the XML read from the file
 * @throws CmsXmlException thrown if the XML can't be read.
 */
private CmsXmlContent unmarshalXmlContent(CmsFile file) throws CmsXmlException {
  CmsXmlContent content = CmsXmlContentFactory.unmarshal(m_cms, file);
  content.setAutoCorrectionEnabled(true);
  content.correctXmlStructure(m_cms);
  return content;
}
origin: org.opencms/opencms-core

/**
 * Corrects the XML structure of the edited content according to the XSD.<p>
 *
 * @throws CmsException if the correction fails
 */
private void correctXmlStructure() throws CmsException {
  m_content.setAutoCorrectionEnabled(true);
  m_content.correctXmlStructure(getCms());
  // write the corrected temporary file
  writeContent();
}
origin: org.opencms/opencms-solr

/**
 * Corrects the XML structure of the edited content according to the XSD.<p>
 * 
 * @throws CmsException if the correction fails
 */
private void correctXmlStructure() throws CmsException {
  m_content.setAutoCorrectionEnabled(true);
  m_content.correctXmlStructure(getCms());
  // write the corrected temporary file
  writeContent();
}
origin: org.opencms/opencms-core

/**
 * Check if automatic content correction is required. Returns <code>true</code> if the content was changed.<p>
 *
 * @param cms the cms context
 * @param content the content to check
 *
 * @return <code>true</code> if the content was changed
 * @throws CmsXmlException if the automatic content correction failed
 */
private boolean checkAutoCorrection(CmsObject cms, CmsXmlContent content) throws CmsXmlException {
  boolean performedAutoCorrection = false;
  try {
    content.validateXmlStructure(new CmsXmlEntityResolver(cms));
  } catch (CmsXmlException eXml) {
    // validation failed
    content.setAutoCorrectionEnabled(true);
    content.correctXmlStructure(cms);
    performedAutoCorrection = true;
  }
  return performedAutoCorrection;
}
origin: org.opencms/org.opencms.workplace.tools.modules

if (CmsResourceTypeXmlContent.isXmlContent(file)) {
  CmsXmlContent xmlContent = CmsXmlContentFactory.unmarshal(getCms(), file);
  xmlContent.setAutoCorrectionEnabled(true);
  file = xmlContent.correctXmlStructure(getCms());
origin: org.opencms/opencms-core

/**
 * Writes the new detail page information to the configuration file.<p>
 *
 * @param infos the new detail page information
 * @param newId the id to use for new pages
 *
 * @throws CmsException if something goes wrong
 */
public void updateAndSave(List<CmsDetailPageInfo> infos, CmsUUID newId) throws CmsException {
  //lock(m_cms, m_resource);
  getDocument();
  removeOldValues();
  writeDetailPageInfos(infos, newId);
  m_document.setAutoCorrectionEnabled(true);
  m_document.correctXmlStructure(m_cms);
  byte[] content = m_document.marshal();
  m_file.setContents(content);
  m_cms.writeFile(m_file);
  //m_cms.unlockResource(m_cms.getSitePath(m_resource));
}
origin: org.opencms/org.opencms.workplace.tools.modules

  /**
   * Reads a file into a string, applies a transformation to the string, and writes the string back to the file.<p>
   *
   * @param resource the resource to transform
   * @param transformation the transformation to apply
   * @throws CmsException if something goes wrong
   * @throws UnsupportedEncodingException in case the encoding is not supported
   */
  private void transformResource(CmsResource resource, Function<String, String> transformation)
  throws CmsException, UnsupportedEncodingException {

    CmsFile file = getCms().readFile(resource);
    if (CmsResourceTypeXmlContent.isXmlContent(file)) {
      CmsXmlContent xmlContent = CmsXmlContentFactory.unmarshal(getCms(), file);
      xmlContent.setAutoCorrectionEnabled(true);
      file = xmlContent.correctXmlStructure(getCms());
    }
    String encoding = CmsLocaleManager.getResourceEncoding(getCms(), file);
    String content = new String(file.getContents(), encoding);
    content = transformation.apply(content);
    file.setContents(content.getBytes(encoding));
    lockResource(getCms(), file);
    getCms().writeFile(file);

  }
}
origin: org.opencms/org.opencms.workplace.tools.modules

if (CmsResourceTypeXmlContent.isXmlContent(file)) {
  CmsXmlContent xmlContent = CmsXmlContentFactory.unmarshal(getCms(), file);
  xmlContent.setAutoCorrectionEnabled(true);
  file = xmlContent.correctXmlStructure(getCms());
origin: org.opencms/org.opencms.workplace.tools.modules

if (CmsResourceTypeXmlContent.isXmlContent(file)) {
  CmsXmlContent xmlContent = CmsXmlContentFactory.unmarshal(getCms(), file);
  xmlContent.setAutoCorrectionEnabled(true);
  file = xmlContent.correctXmlStructure(getCms());
origin: org.opencms/opencms-solr

content.setAutoCorrectionEnabled(autoCorrectionEnabled);
origin: org.opencms/org.opencms.workplace.tools.modules

/**
 * Replaces the referenced formatters within the new XSD files with the new formatter paths.<p>
 *
 * @param targetModule the target module
 *
 * @throws CmsException if something goes wrong
 * @throws UnsupportedEncodingException if the file content could not be read with the determined encoding
 */
private void replaceFormatterPaths(CmsModule targetModule) throws CmsException, UnsupportedEncodingException {
  CmsResource formatterSourceFolder = getCms().readResource(
    "/system/modules/" + m_cloneInfo.getFormatterSourceModule() + "/");
  CmsResource formatterTargetFolder = getCms().readResource(
    "/system/modules/" + m_cloneInfo.getFormatterTargetModule() + "/");
  for (I_CmsResourceType type : targetModule.getResourceTypes()) {
    String schemaPath = type.getConfiguration().get("schema");
    CmsResource res = getCms().readResource(schemaPath);
    CmsFile file = getCms().readFile(res);
    if (CmsResourceTypeXmlContent.isXmlContent(file)) {
      CmsXmlContent xmlContent = CmsXmlContentFactory.unmarshal(getCms(), file);
      xmlContent.setAutoCorrectionEnabled(true);
      file = xmlContent.correctXmlStructure(getCms());
    }
    String encoding = CmsLocaleManager.getResourceEncoding(getCms(), file);
    String content = new String(file.getContents(), encoding);
    content = content.replaceAll(formatterSourceFolder.getRootPath(), formatterTargetFolder.getRootPath());
    file.setContents(content.getBytes(encoding));
    getCms().writeFile(file);
  }
}
origin: org.opencms/opencms-core

    locale).setStringValue(m_cms, Boolean.TRUE.toString());
content.setAutoCorrectionEnabled(true);
content.correctXmlStructure(m_cms);
file.setContents(content.marshal());
origin: org.opencms/opencms-core

content.setAutoCorrectionEnabled(autoCorrectionEnabled);
origin: org.opencms/opencms-core

CmsFile file = cms.readFile(resource);
newContent = CmsXmlContentFactory.unmarshal(cms, file);
newContent.setAutoCorrectionEnabled(true);
resource = newContent.getHandler().prepareForWrite(cms, newContent, file);
origin: org.opencms/opencms-core

xmlContent.setAutoCorrectionEnabled(true);
origin: org.opencms/opencms-solr

xmlContent.setAutoCorrectionEnabled(true);
org.opencms.xml.contentCmsXmlContentsetAutoCorrectionEnabled

Javadoc

Sets the flag to control if auto correction is enabled when saving this XML content.

Popular methods of CmsXmlContent

  • getValue
  • getStringValue
  • getValues
  • hasLocale
  • getFile
  • getLocales
  • marshal
  • addValue
    Adds a new XML schema type with the default value to the given parent node.
  • getIndexCount
  • hasValue
  • addLocale
  • copyLocale
    Copies the content of the given source locale to the given destination locale in this XML document.
  • addLocale,
  • copyLocale,
  • correctXmlStructure,
  • getEncoding,
  • getLocaleNode,
  • initDocument,
  • removeLocale,
  • toString,
  • visitAllValuesWith

Popular in Java

  • Finding current android device location
  • getSystemService (Context)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • compareTo (BigDecimal)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • Permission (java.security)
    Legacy security code; do not use.
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • BoxLayout (javax.swing)
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now