コード例 #1
0
  public String getAsXML() throws ParserConfigurationException, IOException, TransformerException {

    // Create the Document and the top-level node
    Document doc = ValidatorsCore.getDocument();
    Element config = doc.createElement(NODE_VALIDATOR_SETTINGS);
    doc.appendChild(config);

    // Create a node for each validator type represented in this container
    for (Iterator i = fValidatorsByType.entrySet().iterator(); i.hasNext(); ) {
      final Map.Entry entry = (Map.Entry) i.next();
      final IValidatorType validatorType = (IValidatorType) entry.getKey();
      if (validatorType.isConfigurable()) {
        Element valiatorTypeElement =
            validatorTypeAsElement(doc, validatorType, (List) entry.getValue());
        config.appendChild(valiatorTypeElement);
      }
    }

    // Serialize the Document and return the resulting String
    return ValidatorsCore.serializeDocument(doc);
  }