RE: [libxml++] [patch] Namespace class and custom_dom example
- From: Dan Dennedy <dan dennedy org>
- To: libxmlpp <Libxmlplusplus-general lists sourceforge net>
- Cc: kino-dev <kino-dev lists sourceforge net>
- Subject: RE: [libxml++] [patch] Namespace class and custom_dom example
- Date: 11 Aug 2003 15:22:13 -0400
On Sat, 2003-08-09 at 08:48, Murray Cumming Comneon com wrote:
> > I implemented XML Namespaces support against the current CVS.
> Patches should really go in the sourceforge patch manager rather than the
> mailing list.
OK, will do on next submission.
> > I also
> > made an example custom_dom that demonstrates deriving classes from
> > Element and using a SAX parser to build a tree of these
> > derived objects
> > to make it easy to serialize and deserialize a custom DOM.
> I'm sorry, I don't understand what this is trying to do. I think it needs
> some comments to explain what it tries to do, and how it does it.
OK, will do, but it is a rather fundamental concept. In an application,
I want to store document state, but I don't want to use a generic DOM.
For example, there is HTML DOM and SVG DOM, and even an abandoned draft
SMIL DOM all from the W3C. This example shows how to derive a more
application-specific DOM leveraging the libxml++ generic facilities.
> > This example
> > also tests the Namespace.
> Could we please test the Namespace feature separately? I would be happy to
> have _some_ use of namespaces in one of the existing simple examples.
I feel my example is a good exercise of namespaces, but since you missed
the point of the example....
> > There are overloaded methods that can take a Namespace object as a
> > parameter, but I have not tested these. The example, just uses the
> > methods with prefix or prefix/uri parameters.
> Wouldn't it be simpler to just add the namespace parameter to the existing
> methods (with a = std::string() default argument) instead of adding all the
> methods overloads?
In some cases, yes, I can and will do this. Sometimes, the
implementation is different enough that perhaps an overloaded method is
cleaner than a if/else? Nevertheless, I will reduce the number of
> > I imagine the
> > methods that
> > take a Namespace object might be useful with DOM
> > manipulations.
> You mean when converting from one XML format to another? If you can do both
> (use a prefix in the name, or specify the namespace prefix separately) then
> I guess we could ask the libxml people why that possiblility exists.
No, I mean a libxml++ Namespace object versus prefix string as a method
parameter. The methods that take strings are useful in a sax parser such
as my example. However, if I were adding and removing nodes in code, I
will hold a Namespace object in memory so libxml++/libxml does not need
to lookup the namespace based upon a prefix string.
] [Thread Prev