/**
   * Process an XmlSchema. This involves creating a NamespaceInfo instance and populating it based
   * on the given XmlSchema.
   *
   * @param xmlBindings
   * @param packageName
   * @see NamespaceInfo
   * @see AnnotationsProcessor
   * @return newly created namespace info, or null if schema is null
   */
  private NamespaceInfo processXmlSchema(XmlBindings xmlBindings, String packageName) {
    XmlSchema schema = xmlBindings.getXmlSchema();
    if (schema == null) {
      return null;
    }
    // create NamespaceInfo
    NamespaceInfo nsInfo = new NamespaceInfo();
    // process XmlSchema
    XmlNsForm form = schema.getAttributeFormDefault();
    nsInfo.setAttributeFormQualified(form.equals(form.QUALIFIED));
    form = schema.getElementFormDefault();
    nsInfo.setElementFormQualified(form.equals(form.QUALIFIED));

    // make sure defaults are set, not null
    nsInfo.setLocation(schema.getLocation() == null ? "##generate" : schema.getLocation());
    nsInfo.setNamespace(schema.getNamespace() == null ? "" : schema.getNamespace());
    NamespaceResolver nsr = new NamespaceResolver();
    // process XmlNs
    for (XmlNs xmlns : schema.getXmlNs()) {
      nsr.put(xmlns.getPrefix(), xmlns.getNamespaceUri());
    }
    nsInfo.setNamespaceResolver(nsr);
    return nsInfo;
  }