thomas silver

Ranch Hand
+ Follow
since Jun 20, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by thomas silver

Ganesan Ponnusamy wrote:Pavan,

Java EE 6 introduced new package to deal with RESTful webservices named JAX-RS.



With the arrival of JAX-RS, when does one use Jersey or Apach CXF or Metro? What about Restlet? Thank you.
9 years ago
Eric, yes that was what I did

I figured it out. I will post solution later. Thanks.
Hi Bear, row is any singular one dimensional extraction from json object. For example (have not been tested),


I am aware that an array of keys can be obtained as follows:



I was just wondering if there is a way to obtain array of values for a row. TIA.
Yes, it is true that I edited the original JSON string that I should have left alone and added new post with correction instead. Also, the eval(str) should be eval("("+str+")"). So you both were right. Sorry about the confusion.
Yes, it was due to syntax errors and http://www.jsonlint.com helped me found them. Thanks again.
I figured it out now. Thank you very much for the helpful links.
Could someone please show me what I am missing below? I got nothing back on lines a and b. TIA.

var str='{"head":{"eyes":2,"teeth":{"front":4,"incisor":4,"molar":4}}, "body":{"trachae":1, "lungs":[{"left":1, "status":"normal"},{"right":1, "status":"injured"}]}}'

var jsonObject=eval(str);
var trachaeNumber=leftLungStatus=jsonObject.body.trachae;//a
var leftLungStatus=jsonObject.body.lungs[0].status;//b

I extracted line 66-70 to made another method which was called after line 83, but still I got the following printout:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<SevenDwarfs>
<Row>
<name>Doc</name>
<status>oldest</status>
</Row>
</SevenDwarfs>
Thanks for reading, but if I take out line 79, it prints as follows:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<SevenDwarfs>
<Row>
<name>Doc</name>
<status>oldest</status>
</Row>
</SevenDwarfs>

That is not what I want.
Could someone show me how to make the following codes to print out only once?

=========
For example, the code above prints

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<SevenDwarfs>
<Row>
<name>Dopey</name>
<status>youngest</status>
</Row>
</SevenDwarfs>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<SevenDwarfs>
<Row>
<name>Dopey</name>
<status>youngest</status>
</Row>
<Row>
<name>Doc</name>
<status>oldest</status>
</Row>
</SevenDwarfs>

==========
I would like to have only the latter portion printed as follows:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<SevenDwarfs>
<Row>
<name>Dopey</name>
<status>youngest</status>
</Row>
<Row>
<name>Doc</name>
<status>oldest</status>
</Row>
</SevenDwarfs>
=========
Also, how can I get rid of "<?xml version="1.0" encoding="UTF-8" standalone="no"?>" and just have the rootNode(<SevenDwarfs>) and the children nodes? I think it might have something to do with the way DOMSource is setup but I could be wrong. TIA.
Could someone let me know if it is possible to dynamically import Java classes? My plan is have a generic 'controller' to instantiate Java object (POJO) depending on the read-in configuration/properties file which contains structure for each POJO. There are many (100's) different Java classes (and their corresponding configuration/properties files) to import so I was just wondering if there is a better way to implement this. Thank you.
10 years ago

Raj S Kumar wrote:Hi Thomas,
Posting some sample strings would help us understand the problem better.



Hi Raj,

It's just any text String with some form of date (in more than one possible formats) in it. The goal is to parse this date (in all possible formats) and print out the first occurrence. I hope I made myself clear. Thanks for reading.
10 years ago