473,324 Members | 2,193 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

createElementNS and attributes with default values

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
Jul 20 '05 #1
0 1192

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Francis Avila | last post by:
A little annoyed one day that I couldn't use the statefulness of generators as "resumable functions", I came across Hettinger's PEP 288 (http://www.python.org/peps/pep-0288.html, still listed as...
50
by: Dan Perl | last post by:
There is something with initializing mutable class attributes that I am struggling with. I'll use an example to explain: class Father: attr1=None # this is OK attr2= # this is wrong...
2
by: Bob Parnes | last post by:
In its default configuration, my version of pylint (0.5.0) sets the maximum number of class attributes at 7. This seems low to me, but I can see how an excessive number might make maintenance more...
2
by: Marc A. Criley | last post by:
First off, I'm an experienced software developer but new to XML, so be gentle :-) I've put together a schema that defines optional attributes for some of the elements. Some of these attributes...
1
by: Gérard Talbot | last post by:
Hello, According to DOM 2 Core, the attribute "nodeRef.attributes" is "A NamedNodeMap containing the attributes of this node (if it is an Element) or null otherwise."...
10
by: James Black | last post by:
It appears that this is actually a difference between whether to use DOM2 or DOM1. I am trying to write my programs using XHTML for the webpage, but, I have to use DOM2 for xhtml 1.1. Now,...
4
by: mentor | last post by:
The following code catch an exception in IE, with number -2146827850 var xmldoc=XmlDocument.create("1str","2str"); xmldoc.documentElement.setAttribute('code',code); ...
4
by: praskuma | last post by:
Hi All document.createElementNS works fine on firefox, but not on IE. I use this fuction to create SVG objects on the fly for example..... SVG.ns = "http://www.w3.org/2000/svg"; var svg...
4
by: ashish.sadanandan | last post by:
Hi, I'm new to XML and just started reading some documentation on W3C compliant schemas recently. The XML file I'm generating is for an embedded application and so size is of extreme importance....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.