[webkit-help] How can I create a QualifiedName and AtomicString object from a String literal

Julien Chaffraix julien.chaffraix at gmail.com
Sat Jan 30 10:53:37 PST 2010


Hi,

> Can you please tell me how can i create a  QualifiedName object and a
> AtomicString object from a String literal ("value")?

A QualifiedName is created from 3 AtomicString's: a namespace, a
prefix and a local name. See the XML specification for the explanation
of those 3 strings (http://www.w3.org/TR/xml-names11/#ns-qualnames).
To limit the memory footprint, the common tags and attributes are
already defined as statics so you should use them instead of creating
your own. I would advise you to have a look at the generated *Names.*
files (for example, HTMLNames.{h|cpp} or SVGNames.{h|cpp}) as it will
give you the different QualifiedName's that are already supported and
you will see how a QualifiedName is created.
The second conversion from String to AtomicString is easy: there is a
constructor that will do it for you (see in
WebCore/platform/text/AtomicString.h).

Regards,
Julien


More information about the webkit-help mailing list