code: public void setFragment(String p_fragment) throws MalformedURIException
    {
  
      if (p_fragment == null)
      {
        m_fragment = null;
      }
      else if (!isGenericURI())
      {
        throw new MalformedURIException(
          XMLMessages.createXMLMessage(XMLErrorResources.ER_FRAG_FOR_GENERIC_URI, null)); //"Fragment can only be set for a generic URI!");
      }
      else if (getPath() == null)
      {
        throw new MalformedURIException(
          XMLMessages.createXMLMessage(XMLErrorResources.ER_FRAG_WHEN_PATH_NULL, null)); //"Fragment cannot be set when path is null!");
      }
      else if (!isURIString(p_fragment))
      {
        throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_FRAG_INVALID_CHAR, null)); //"Fragment contains invalid character!");
      }
      else
      {
        m_fragment = p_fragment;
      }
    }
docs: Set the fragment for this URI. A non-null value is valid only
  if this is a URI conforming to the generic URI syntax and
  the path value is not null.
  
  @param p_fragment the fragment for this URI
  
  @throws MalformedURIException if p_fragment is not null and this
  URI does not conform to the generic
  URI syntax or if the path is null