congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
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

  • Start an intent from android
  • findViewById (Activity)
  • addToBackStack (FragmentTransaction)
  • startActivity (Activity)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • JOptionPane (javax.swing)
  • 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