code: URI getUrlAttribute(org.w3c.dom.Node attribute) throws InvalidInputException {
      String s = getStringAttribute(attribute);
  
      if (s == null) {
        return null;
      }
  
      try {
        return new URI(s);
      } catch (URISyntaxException e) {
        throw new InvalidInputException("Invalid input: " + attribute.getLocalName()
            + " must be a URI value not \"" + s + "\"");
      }
    }
docs: Get a DOM attribute as a URI.