Hey common...
You can either have minOccurs=0 and leave the nodes out, or populate them
with valid data.
my problem is when i create nodes and leave out ONLY....
It expects somevalue and parser does not let me leave the nodes out....
Actually i want to leave the nodes created
<Tracking\>
<CreateTime\>
but the parser complains....
Error at file "prodInfo", line 32, column 24
Message: buffer not initialized
Error at file "prodInfo", line 36, column 26
Message: buffer not initialized
Error at file "prodInfo", line 37, column 24
Message: buffer not initialized
Error at file "prodInfo", line 39, column 19
Message: value '' not in enumeration
Error at file "prodInfo", line 40, column 28
Message: value '' is invalid boolean
Error at file "prodInfo", line 49, column 24
Message: buffer not initialized
Please tell me how to create these empty tags..
at present...i create in this way...what is wrong in this....
DOMElement* prodElem = xmldoc->createElement("tracking");
rootElem->appendChild(prodElem);
when i fill in some data...i do it this way..
DOMText* prodDataVal = xmldoc->createTextNode(X(datastr.c_str()));
prodElem ->appendChild(prodDataVal);
this works fine with string datatype but not with datatime and boolean....
please help me.......thanks
On Wed, Aug 19, 2009 at 11:44 AM, David Bertoni <[email protected]> wrote:
> ss ak wrote:
>
>> I am creating text node
>> DOMText* prodDataVal = xmldoc->createTextNode(XMLString::transcode("0"));
>>
> This is a memory leak. You need to free the pointer returned from
> XMLString::transcode() by calling XMLString::release().
>
> currentNode->appendChild(prodDataVal);
>>
>> But this text node has a value of boolean
>> and sometimes my node is empty,basically value is not set...as minOccurs=0
>>
> An empty string is not a valid lexical value for xsd:boolean or
> xsd:dateTime.
>
>
>> can i have empty tags of boolean without values in it???
>> same is the case when i use datetime type...
>>
> No
>
>
>> schema is <xs:element name="Tracking" type="xs:boolean" minOccurs="0"/>
>>
>> <xs:element name="CreateTime" type="xs:dateTime" minOccurs="0"/>
>>
>> Please i have to create XML and set values to those element minOccurs=1 by
>> creating the textnodes as above and leave the rest blank ...so my parser
>> complains abt the boolean and datatime being empty.
>>
> You can either have minOccurs=0 and leave the nodes out, or populate them
> with valid data.
>
> Dave
>