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 baranidharan <ba...@sifycorp.com> on 2009/04/10 14:44:04 UTC
How to get the attribute value in integer format
Hi all,
char *value;
DOMElement* elem = (DOMElement*) nodexml;
XMLCh *xname = XMLString::transcode("id");
value = XMLString::transcode(elem->getAttribute(xname));
printf("id =%s\n",value);
In the above program , i am getting the attribute value in string
fornat, but i need the integer format , how to get that , which xerecs
c++ function i have to use.
Thanks,
Barani
Get your world in your inbox!
Mail, widgets, documents, spreadsheets, organizer and much more with your Sifymail WIYI id!
Log on to http://www.sify.com
********** DISCLAIMER **********
Information contained and transmitted by this E-MAIL is proprietary to
Sify Limited and is intended for use only by the individual or entity to
which it is addressed, and may contain information that is privileged,
confidential or exempt from disclosure under applicable law. If this is a
forwarded message, the content of this E-MAIL may not have been sent with
the authority of the Company. If you are not the intended recipient, an
agent of the intended recipient or a person responsible for delivering the
information to the named recipient, you are notified that any use,
distribution, transmission, printing, copying or dissemination of this
information in any way or in any manner is strictly prohibited. If you have
received this communication in error, please delete this mail & notify us
immediately at admin@sifycorp.com
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org
Re: How to get the attribute value in integer format
Posted by David Bertoni <db...@apache.org>.
baranidharan wrote:
> Hi all,
>
> char *value;
> DOMElement* elem = (DOMElement*) nodexml;
> XMLCh *xname = XMLString::transcode("id");
> value = XMLString::transcode(elem->getAttribute(xname));
> printf("id =%s\n",value);
>
> In the above program , i am getting the attribute value in string
> fornat, but i need the integer format , how to get that , which xerecs
> c++ function i have to use.
You can use the XSValue class to do this. Take a look at
src/xercesc/framework/psvi/XSValue.hpp:
/**
* Get the actual value, in the form of XSValue, for a given string of the
* data type specified
*
* Client application is responsible for the deleletion of the XSValue
returned.
*
* @param content raw data
* @param datatype schema datatype
* @param status validation status which is set upon validation fails
* @param version xml version
* @param toValidate to validate the content before generate actual value
* @param manager memory manager provided
*/
static
XSValue* getActualValue
(
const XMLCh* const content
, DataType datatype
, Status& status
, XMLVersion version = ver_10
, bool toValidate = true
, MemoryManager* const manager =
XMLPlatformUtils::fgMemoryManager
);
The XSValue instance returned will have the actual value in its fData
member. You will need to make sure you access the appropriate field of
the union.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org