473,394 Members | 2,063 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,394 software developers and data experts.

Attribute function getValue(...)

Fuy
Hi, i have a next problem:

In the method

startElement(const XMLCh* const uri,
const XMLCh *const localname,
const XMLCh *const qname,
const Attributes &attrs
){

string identifier = atts.getValue("id");
}
send next the error:

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
error C2664: 'const XMLCh *xercesc_2_7::Attributes::getValue(const
unsigned int) const' : cannot convert parameter 1 from 'const char
[12]' to 'const unsigned int'
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////

try this

startElement(const XMLCh* const uri,
const XMLCh *const localname,
const XMLCh *const qname,
const Attributes &attrs
){

for (int i = 0; i < atts.getLength(); i++) {
string value = atts.getValue(i);
}
}

and work,

In the first case why the error?, i see the code´s and no problems
using

string identifier = atts.getValue("id");

Any idea?

ok

ATTE
Fuy

Sep 27 '06 #1
2 1761
It might help to tell us what library you're working with. I presume
it's something in C++, judging from the syntax.

From what you've shown us, looks like the Attributes object is behaving
like an array and wants you to give the getValue operation an integer
offset into that array. There may be a completely different function for
retrieving attribute value by name. Read The Fine Manual?

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Sep 27 '06 #2
Fuy
It true.

Use Xercesc, and lenguaje is C++.

The next link is the documentation the Attributes Class

http://xml.apache.org/xerces-c/apiDo...ttributes.html

and show howto get atributes

//////////////////////////////////////////////////////////////////////////////////////////////////////////////

There are two ways for the SAX application to obtain information from
the Attributes. First, it can iterate through the entire list:

public void startElement (String uri, String localpart, String qName,
Attributes atts) {
for (int i = 0; i < atts.getLength(); i++) {
String Qname = atts.getQName(i);
String URI = atts.getURI(i)
String local = atts.GetLocalName(i)
String type = atts.getType(i);
String value = atts.getValue(i);
[...]
}
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
****2

As an alternative, the application can request the value or type of
specific attributes:

public void startElement (String uri, String localpart, String qName,
Attributes atts) {
String identifier = atts.getValue("id");
String label = atts.getValue("label");
[...]
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////

I use the ****2 but when compile the next
public void startElement (String uri, String localpart, String qName,
Attributes atts) {
String identifier = atts.getValue("id");
}

send this error:

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
error C2664: 'const XMLCh *xercesc_2_7::Attributes::getValue(const
unsigned int) const' : cannot convert parameter 1 from 'const char
[12]' to 'const unsigned int'
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
any of you have the error using Visual Studio 2005 C++ ??

ok

ATTE
Fuy

Joe Kesselman ha escrito:
It might help to tell us what library you're working with. I presume
it's something in C++, judging from the syntax.

From what you've shown us, looks like the Attributes object is behaving
like an array and wants you to give the getValue operation an integer
offset into that array. There may be a completely different function for
retrieving attribute value by name. Read The Fine Manual?

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Sep 28 '06 #3

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

Similar topics

8
by: mjm | last post by:
Folks, I have the following problem: when using arrays or matrices I often write past the index bounds. To prevent this from happening I check the bounds and return an error message such as ...
4
by: orekinbck | last post by:
Hi There I am learning about reflection so apologies if this post is vague ... I am doing some unit testing and have written a function that accepts two objects and tests to see if their...
1
by: Ben | last post by:
Hi There I am learning about reflection so apologies if this post is vague ... I am doing some unit testing and have written a function that accepts two objects and tests to see if their...
5
by: Bert Jansen | last post by:
There seems to be a bug in de VS .net C++ compiler (optimization) when using inline functions that return static data. The following code demonstrates this (Win32 console app with ATL support): ...
2
by: Roy | last post by:
I have a problem with displaying data from a repeater where the data has to be converted in a function. The repeater with PagedDataSource works fine and all data is displayed except the columns...
0
by: Niklas | last post by:
Hi this is my test class which I want to use in COM: <System.Runtime.InteropServices.InterfaceType(Runtime.InteropServices.ComInterfaceType.InterfaceIsDual), _ ...
3
by: RSH | last post by:
Hi, I have a situation where I need to send a Datarow.tiem to a function for processing. I cant figure out the right type to specify in the function to receive the item. What should it be? ...
0
by: xirowei | last post by:
I try to search information from many websites, but what i can found is they only demonstrate the example with ONE ATTRIBUTE in a Cookie only. What i want is how to set more than 1 attribute in a...
2
by: mdock | last post by:
Hello, I have a javascript grid on my ASP page which displays information about the history of specific units produced in our manufacturing facility. One of the results is the order number on...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.