Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-99612

Implement QDomDocument::elementById

    XMLWordPrintable

Details

    • Task
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • 5.15.7, 6.1
    • XML: DOM
    • None
    • All

    Description

      The method QDomElement QDomDocument::elementById(const QString &elementId) is implemented and documented as this:

      /*!
          Returns the element whose ID is equal to \a elementId. If no
          element with the ID was found, this function returns a
          \l{QDomNode::isNull()}{null element}.
      
          Since the QDomClasses do not know which attributes are element
          IDs, this function returns always a
          \l{QDomNode::isNull()}{null element}.
          This may change in a future version.
      */
      QDomElement QDomDocument::elementById(const QString& /*elementId*/)
      {
          qWarning("elementById() is not implemented and will always return a null node.");
          return QDomElement();
      }
      

      First, I do not see a reason to have a method which does nothing, especially not what one expects it should do.

      Second, why is it not implemented? I understand that xml has no defined id attribute, but that could be given as a second parameter, defaulting to id, which presumably most people use:

      QDomElement QDomDocument::elementById(const QString &elementId, const QString& idAttribute = "id")

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            moerkb Markus Bader
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes