[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: KoXmlReader
From:       "Ariya Hidayat" <ariya () kde ! org>
Date:       2006-12-25 19:16:14
Message-ID: ba035dd10612251116k7e7856b2oc62de51398221718 () mail ! gmail ! com
[Download RAW message or body]

> In KFormula 2 we want to switch from QDom* classes to KoXmlReader and
> KoXmlWriter for loading and saving. We have also a method in a base class
> that does the task of reading all the attributes of each element. The problem
> is that we use QDomNode::attributes() method but there's no such a method in
> KoXmlNode. Is there any plan to add such method or should I think about a
> workaround ?

Good news !

As for QDomNodeMap necessary for QDomNode::attributes(), implementing
this would make the whole node a bit heavier. I must think for a way
to do this without losing the lightweightness of KoXmlReader. So I'd
rather not implement it unless it's absolutely necessary.

Looking at how QDomNode::attributes() used in KFormula, how about the
following workaround? First I'm going to implement function
attributeNames() in the namespace KoXml which returns a QStringList
containing the name of all attributes (this way,
KoXml::attributeNames() can also work if we use the fall-back QDom).
Then you can iterate for each name and get the attribute value.

The pseudo-code will be:

QStringList attrList = KoXml::attributeNames(node);
foreach(QString attrName, attrList)
{
  QString attrValue = node.attribute(attrName);

  // do something with attribute name and value
}

Is that good enough?


Regards,

Ariya
_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic