I am a so-called newbie at this -- here goes.

I am trying to exract the value "double startTime" from the xml below. I have an "Element" but don't know
how to "decode" or "transcode" the attribute value into a "double"


<timeBlock>
<startTime value="0.336"/>
<timeIncrement value=".0003"/>
</timeBlock>

double getStarTimet(Element e){
String startTime = new String("startTime");
String value = e.getAttribute(startTime);
double value = ????
return value;
}


Also, when I print "value"; say like "System.out.println(value)" I get an empty string?
Can someone point me in the right direction here?


Here is the c++ that I have effectively used in the past (but now I need the Java):
double Jpp_ParsedValues::getDoubleAttribute(DOMElement* e, const char* name){


// This function retrieves the value of the attribute "name" on the element
const XMLCh* start = XMLString::transcode(name);
const XMLCh* c = e->getAttribute( start );
delete start;


 char* s = XMLString::transcode(c);
 double value = atof(s);
 delete s;

 return value;

}


Now I need to do this in "Java" using xerces-j

I don't know where to look to figure this out.







---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to