You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by frere tuck <ul...@yahoo.fr> on 2009/08/27 17:20:15 UTC

Re: xs:dateTime

Hi,
I know it's not really the purpose of this specific thread but I'd just like
to share with you what i've used for parsing an XML datetime. In case that
helps...

[code]
#include <xercesc/framework/psvi/XSValue.hpp>

XSValue::Status statusXSValue = XSValue::st_UnknownType;
XSValue* xsValue = XSValue::getActualValue(	<<your_XMLCh_string_to_parse>>,
								XSValue::dt_dateTime,
								statusXSValue);

if (xsValue)
{
	if (statusXSValue == XSValue::st_Init)
	{
		COleDateTime oDateTime(	xsValue->fData.fValue.f_datetime.f_year,
							xsValue->fData.fValue.f_datetime.f_month,
							xsValue->fData.fValue.f_datetime.f_day,
							xsValue->fData.fValue.f_datetime.f_hour,
							xsValue->fData.fValue.f_datetime.f_min,
							xsValue->fData.fValue.f_datetime.f_second);

		..........
	}

	delete xsValue;
}
[/code]

Frere Tuck


jerome.mariette wrote:
> 
> 
> Hi,
> well I'm kind of overheaded by this xerces library ... I never succed to
> figure out how it works !! 
> Do u have an exemple ? I just want to write the date of the day into my
> XMLFile.
> 
> thnks so much for your help !!! 
> 
> 
> 
> 
> David Bertoni wrote:
>> 
>> jerome.mariette wrote:
>>> 
>>> Thanks for your answer,
>>> I catch this error when I try to parse the date (to get the dday):
>>>      terminate called after throwing an instance of
>>> 'xercesc_2_7::SchemaDateTimeException'
>>> 
>>> when executing the following code:
>>>      XMLDateTime* creationdate = new XMLDateTime();
>>>      creationdate->parseDateTime();
>>> 
>>> what am I doing wrong ?
>> You haven't provided a string for it to parse, so what could calling 
>> parseDateTime() possibly do?
>> 
>> You need to call XMLDateTime::setBuffer() with the string you want
>> parsed.
>> 
>> Dave
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
>> For additional commands, e-mail: c-dev-help@xerces.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/xs%3AdateTime-tp11713850p25170941.html
Sent from the Xerces - C - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org