Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Access violation while trying to create an element

adidasadidas Member Posts: 2
Hey guys!

I'm kind of new to XML using VC++ 6.0.
I know XML DOM and XML MiniDOM from python...

anyway, I try to create an element, or a node,
and as I run my little application it carshed due to "Access violation"
the exception occures in the functions
raw_createElement(...) and raw_createNode(...)

it happens all the time, and frankly I really don't know what the heck is wrong in there....

here is a fragment of my source:

#define PHONEBOOK_NODE _T("Node")
sprintf(node, "%ld", m_NodeID);
l_XMLNode = m_pDomDocument->createNode(l_vtType, _T(node), _T(""));
l_XMLElement = m_pDomDocument->createElement(PHONEBOOK_NODE);

where:
m_pDomDocument is IXMLDOMDocument2Ptr
l_XMLNode is IXMLDOMNodePtr
l_XMLElement is IXMLDOMElementPtr

I'll be very glad (and so my boss) if someone will be kind to
share his or her opinion about that...

thanx,
Adidas

Comments

  • zibadianzibadian Member Posts: 6,349
    : Hey guys!
    :
    : I'm kind of new to XML using VC++ 6.0.
    : I know XML DOM and XML MiniDOM from python...
    :
    : anyway, I try to create an element, or a node,
    : and as I run my little application it carshed due to "Access violation"
    : the exception occures in the functions
    : raw_createElement(...) and raw_createNode(...)
    :
    : it happens all the time, and frankly I really don't know what the heck is wrong in there....
    :
    : here is a fragment of my source:
    :
    : #define PHONEBOOK_NODE _T("Node")
    : sprintf(node, "%ld", m_NodeID);
    : l_XMLNode = m_pDomDocument->createNode(l_vtType, _T(node), _T(""));
    : l_XMLElement = m_pDomDocument->createElement(PHONEBOOK_NODE);
    :
    : where:
    : m_pDomDocument is IXMLDOMDocument2Ptr
    : l_XMLNode is IXMLDOMNodePtr
    : l_XMLElement is IXMLDOMElementPtr
    :
    : I'll be very glad (and so my boss) if someone will be kind to
    : share his or her opinion about that...
    :
    : thanx,
    : Adidas
    :
    Did you initialize the interfaces? If you didn't then you must do that before trying to call any of their members.
  • adidasadidas Member Posts: 2
    : : Hey guys!
    : :
    : : I'm kind of new to XML using VC++ 6.0.
    : : I know XML DOM and XML MiniDOM from python...
    : :
    : : anyway, I try to create an element, or a node,
    : : and as I run my little application it carshed due to "Access violation"
    : : the exception occures in the functions
    : : raw_createElement(...) and raw_createNode(...)
    : :
    : : it happens all the time, and frankly I really don't know what the heck is wrong in there....
    : :
    : : here is a fragment of my source:
    : :
    : : #define PHONEBOOK_NODE _T("Node")
    : : sprintf(node, "%ld", m_NodeID);
    : : l_XMLNode = m_pDomDocument->createNode(l_vtType, _T(node), _T(""));
    : : l_XMLElement = m_pDomDocument->createElement(PHONEBOOK_NODE);
    : :
    : : where:
    : : m_pDomDocument is IXMLDOMDocument2Ptr
    : : l_XMLNode is IXMLDOMNodePtr
    : : l_XMLElement is IXMLDOMElementPtr
    : :
    : : I'll be very glad (and so my boss) if someone will be kind to
    : : share his or her opinion about that...
    : :
    : : thanx,
    : : Adidas
    : :
    : Did you initialize the interfaces? If you didn't then you must do that before trying to call any of their members.
    :

    yes, off-course, I initialized the m_pDomDocument.

Sign In or Register to comment.