[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice-devel
Subject: Re: KoXmlReader
From: Alfredo Beaumont <alfredo.beaumont () gmail ! com>
Date: 2006-12-25 19:58:46
Message-ID: 200612252058.46888.alfredo.beaumont () gmail ! com
[Download RAW message or body]
Astelehena 25 Abendua 2006 20:16(e)an, Ariya Hidayat(e)k idatzi zuen:
> > 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?
Sounds perfect!
--
Alfredo Beaumont Sainz
http://www.alfredobeaumont.org/blog.cgi
_______________________________________________
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