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 "jerome.mariette" <je...@mbari.org> on 2007/07/20 20:43:41 UTC

xs:dateTime

Hi everybody,
I'd like to use the xs:dateTime type in my XML, but the formatting is kind
of tricky. There is in the xerces functions to create it easily in order to
export it into my XML ?
thx,
Jerome
-- 
View this message in context: http://www.nabble.com/xs%3AdateTime-tf4118903.html#a11713850
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


Re: xs:dateTime

Posted by frere tuck <ul...@yahoo.fr>.
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


Re: xs:dateTime

Posted by "jerome.mariette" <je...@mbari.org>.

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-tf4118903.html#a11754853
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


Re: xs:dateTime

Posted by David Bertoni <db...@apache.org>.
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


Re: xs:dateTime

Posted by "jerome.mariette" <je...@mbari.org>.

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 ?



Alberto Massari wrote:
> 
> At 11.43 20/07/2007 -0700, jerome.mariette wrote:
> 
>>Hi everybody,
>>I'd like to use the xs:dateTime type in my XML, but the formatting is kind
>>of tricky. There is in the xerces functions to create it easily in order
to
>>export it into my XML ?
> 
> Use XMLDateTime from xercesc/util/XMLDateTime.hpp
> 
> Alberto
> 
>>thx,
>>Jerome
>>--
>>View this message in context: 
>>http://www.nabble.com/xs%3AdateTime-tf4118903.html#a11713850
>>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
> 
> 
> ---------------------------------------------------------------------
> 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-tf4118903.html#a11750227
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


Re: xs:dateTime

Posted by Alberto Massari <am...@datadirect.com>.
At 11.43 20/07/2007 -0700, jerome.mariette wrote:

>Hi everybody,
>I'd like to use the xs:dateTime type in my XML, but the formatting is kind
>of tricky. There is in the xerces functions to create it easily in order to
>export it into my XML ?

Use XMLDateTime from xercesc/util/XMLDateTime.hpp

Alberto

>thx,
>Jerome
>--
>View this message in context: 
>http://www.nabble.com/xs%3AdateTime-tf4118903.html#a11713850
>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


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