Package org.eclipse.wst.sse.core.internal.cleanup

Examples of org.eclipse.wst.sse.core.internal.cleanup.IStructuredCleanupPreferences


  public void cleanupModel(IDOMModel model) {
    if (model == null)
      return;

    HTMLCleanupProcessorImpl processor = new HTMLCleanupProcessorImpl();
    IStructuredCleanupPreferences pref = processor.getCleanupPreferences();

    // backup options
    boolean compressEmptyElementTags = pref.getCompressEmptyElementTags();
    boolean insertRequiredAttrs = pref.getInsertRequiredAttrs();
    boolean insertMissingTags = pref.getInsertMissingTags();
    boolean quoteAttrValues = pref.getQuoteAttrValues();
    boolean formatSource = pref.getFormatSource();
    int tagNameCase = pref.getTagNameCase();
    int attrNameCase = pref.getAttrNameCase();

    // setup options
    pref.setCompressEmptyElementTags(true);
    pref.setInsertRequiredAttrs(true);
    pref.setInsertMissingTags(true);
    pref.setQuoteAttrValues(true);
    pref.setFormatSource(false);
    if (model.getDocument().isXMLType()) { // XHTML
      pref.setTagNameCase(HTMLCorePreferenceNames.LOWER);
      pref.setAttrNameCase(HTMLCorePreferenceNames.LOWER);
    }
    else {
      pref.setTagNameCase(HTMLCorePreferenceNames.ASIS);
      pref.setAttrNameCase(HTMLCorePreferenceNames.ASIS);
    }

    processor.cleanupModel(model);

    // set back options
    pref.setCompressEmptyElementTags(compressEmptyElementTags);
    pref.setInsertRequiredAttrs(insertRequiredAttrs);
    pref.setInsertMissingTags(insertMissingTags);
    pref.setQuoteAttrValues(quoteAttrValues);
    pref.setFormatSource(formatSource);
    pref.setTagNameCase(tagNameCase);
    pref.setAttrNameCase(attrNameCase);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.wst.sse.core.internal.cleanup.IStructuredCleanupPreferences

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.