N
Nicolas VanOrton
Hi all,
When XercesDOMParser parses an XML document in a file, if a Schema is
attached, it automatically adds all attributes with default values to
the corresponding nodes...
I'm trying to obtain the above behavior when adding nodes with
createElementNS but I cannot do so. No default attributes are
automatically added. Shouldn't it be doing so?... Here's my code for
that:
DOMNode* AddChildElement(wchar_t* nodeTitle, DOMNode* toNode)
{
if (!toNode)
return NULL;
if (toNode->getNodeType()!=DOMNode::ELEMENT_NODE)
return NULL;
if (!nodeTitle)
nodeTitle = FindNewName(toNode, DOMNode::ELEMENT_NODE);
// XMLDocument is a DOMDocument*
DOMNode* newNode =
XMLDocument->createElementNS(toNode->getNamespaceURI(), nodeTitle);
// newNode does not have any attribute nodes, although it should
// according to the XML Schema
toNode->appendChild(newNode);
return newNode;
}
Any help would be deeply appreciated...
Nicolas
When XercesDOMParser parses an XML document in a file, if a Schema is
attached, it automatically adds all attributes with default values to
the corresponding nodes...
I'm trying to obtain the above behavior when adding nodes with
createElementNS but I cannot do so. No default attributes are
automatically added. Shouldn't it be doing so?... Here's my code for
that:
DOMNode* AddChildElement(wchar_t* nodeTitle, DOMNode* toNode)
{
if (!toNode)
return NULL;
if (toNode->getNodeType()!=DOMNode::ELEMENT_NODE)
return NULL;
if (!nodeTitle)
nodeTitle = FindNewName(toNode, DOMNode::ELEMENT_NODE);
// XMLDocument is a DOMDocument*
DOMNode* newNode =
XMLDocument->createElementNS(toNode->getNamespaceURI(), nodeTitle);
// newNode does not have any attribute nodes, although it should
// according to the XML Schema
toNode->appendChild(newNode);
return newNode;
}
Any help would be deeply appreciated...
Nicolas