oracle.cloud.scanning.api.config

## Interface IXMLFileConfiguration

-     public interface IXMLFileConfiguration

  This represents the configration that are defined against an XML file identified by its resource Path

       Sample pseudo code
        IXMLFileConfiguration xml = fileconfiguration.checkXMLFileConfiguration(path);
        if (xml == null) {
          // success
        } else {
          testElementRecursively(rootElement, xml);
        }

          public void testElementRecursively(Element e,  IXMLFileConfiguration c) {
           XMLElementResult r = c.checkXMLElement(e);
            if (!r.isAllowed()) {
                  if (r.getSeverity() == ERROR) {
                    //error, No need to further process this element.
                  } else {
                    //warn
                  }
             }

             List<MissingXMLNodeResult> missingNodes = c.checkMissingNodes(org.w3c.dom.Element)(e);
             //report missing nodes

            if (!r.isToProcessFurther()) {
                // success
            } else {
                //process all attributes using checkAttribute(org.w3c.dom.Element, java.lang.String)
                //process all attribute values checkAttributeValue(org.w3c.dom.Element, java.lang.String, java.lang.String)
                //check #text value checkXMLElementValue(org.w3c.dom.Element, java.lang.String)
                //call testElementRecursively for its child elements.

            }
          }

  See Also:
    `IFileConfiguration.checkXMLFileConfiguration(java.lang.String)`, `ConfigurationFactory`

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Result` | `checkAttribute(Element e, String name)` Checks if an attribute is allowed
    `Result` | `checkAttributeValue(Element e, String name, String value)` Checks if a value of an attribute is valid
    `List<MissingXMLNodeResult>` | `checkMissingNodes(Element e)` Checks if an XML element is missing any important elements or attributes.
    `XMLElementResult` | `checkXMLElement(Element e)` Checks if an XML element is allowed in the file
    `Result` | `checkXMLElementValue(Element e, String val)` Checks if a value for the text node of an element is valid

- - ### Method Detail

    - #### checkXMLElement

          XMLElementResult checkXMLElement(Element e)

      Checks if an XML element is allowed in the file
      Parameters:
        `e` - the XML element to be checked
      Returns:
        XMLElementResult that indicates if the element is allowed, if yes, it also indicates the the elment needs to be further scanned for its attibutes and children.
      See Also:
        `XMLElementResult.isToProcessFurther()`

    - #### checkMissingNodes

          List<MissingXMLNodeResult> checkMissingNodes(Element e)

      Checks if an XML element is missing any important elements or attributes.
      Parameters:
        `e` - the XML element to be checked.
      Returns:
        List that contains the list of errors related to missing direct child elements or attributes.

        Some important nodes may not be mandatory, those will be returned with appropriate severity levels if they dont exist. mandatory nodes will have the severity level of ERROR.

    - #### checkXMLElementValue

          Result checkXMLElementValue(Element e,
                                    String val)

      Checks if a value for the text node of an element is valid
      Parameters:
        `e` - the parent element
        `val` - the text value of the element
      Returns:
        Result object that contains the status and the localized message when the value is not allowed.

    - #### checkAttribute

          Result checkAttribute(Element e,
                              String name)

      Checks if an attribute is allowed
      Parameters:
        `e` - the element of the attribute
        `name` - the name of the attribute to be checked
      Returns:
        Result object that contains the status and the localized message when the attribute is not allowed.

    - #### checkAttributeValue

          Result checkAttributeValue(Element e,
                                   String name,
                                   String value)

      Checks if a value of an attribute is valid
      Parameters:
        `e` - the element of the attribute
        `name` - the name of the attribute
        `value` - the value of the attribute
      Returns:
        Result object that contains the status and the localized message when the attribute value is not allowed.

Copyright © 2018 Oracle. All rights reserved.