It compiles and it does run, but I don't understand what you are trying to
do in a couple of spots.
1) unless you are deliberately trying to hide DOM_Node in that struct, or
unless you deliberately left some additional stuff out of that struct for
the sake of simplifying your email, I don't see why you don't just put the
'DOM_Node' directly in your class. You have a class that wraps a struct that
wraps a DOM_Node. Why not just have a class that wraps DOM_Node ?
class Xml_DOM_Node
{
public:
Xml_DOM_Node(DOM_Node); // Xerces Referencing counting makes
this essentially the same as 'DOM_Node&'
~Xml_DOM_Node();
DOMString getNodeName() const;
Xml_DOM_Node getParentNode() const;
private:
DOM_Node domnode;
};
2) I don't understand why you are reassiging your DOM_Node value in this
routine, but I don't know what you attend to do with your application. You
will be pointing your wrapper class to some other node on the tree; maybe
that's what you intended.
Xml_DOM_Node Xml_DOM_Node::getParentNode() const
{
DOM_Node node =
pdomnodeimpl->domnode.getParentNode();
pdomnodeimpl->domnode = node;
return Xml_DOM_Node(pdomnodeimpl);
}
/*
// could this be what you really wanted?
Xml_DOM_Node Xml_DOM_Node::getParentNode() const
{
DOM_Node node =
pdomnodeimpl->domnode.getParentNode();
return Xml_DOM_Node(node);
}
*/
> -----Original Message-----
> From: anand awasthi [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, June 12, 2001 9:28 AM
> To: [EMAIL PROTECTED]
> Subject: wrapping Xerces API in my code !!
>
> Hi,
>
> I am trying to wrap Xerces API in my code in following
> manner :
>
>
> oni.h
> ----------
>
> struct Xml_DOM_Node_Impl;
> struct Xml_DOM_Node_Impl
> {
> DOM_Node domnode;
> };
>
> class Xml_DOM_Node
> {
> public:
> Xml_DOM_Node(Xml_DOM_Node_Impl*);
> ~Xml_DOM_Node();
> DOMString getNodeName() const;
> Xml_DOM_Node getParentNode() const;
> private:
> Xml_DOM_Node_Impl* pdomnodeimpl;
> };
>
>
> -------------------------------------------
>
> oni.cpp
> ---------
>
> #include "oni.h"
> #include <xercesheaders>
>
>
> Xml_DOM_Node::Xml_DOM_Node(Xml_DOM_Node_Impl* impl) :
> pdomnodeimpl(impl)
> {
> }
>
> DOMString Xml_DOM_Node::getNodeName() const
> {
> return (pdomnodeimpl->domnode.getNodeName());
> }
>
> Xml_DOM_Node Xml_DOM_Node::getParentNode() const
> {
> DOM_Node node =
> pdomnodeimpl->domnode.getParentNode();
> pdomnodeimpl->domnode = node;
> return Xml_DOM_Node(pdomnodeimpl);
> }
>
> Xml_DOM_Node::~Xml_DOM_Node()
> {
> delete pdomnodeimpl;
> }
>
> could C++/Xerces gurus pls tell me that above code is
> correct or not ?? if notr then pls suggest me better
> ways.
>
> i would really appreciate that.
>
> thanks
>
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail - only $35
> a year! http://personal.mail.yahoo.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]