|
If you already know how to read and write the XML to and from a DOM, then what is your problem?
|
|
|
|
|
ya but there is ip address i cant display that
NodeList childNodeList15 = element.getElementsByTagName("ue_ip_address");
for (i = 0; i < childNodeList15.getLength(); i++) {
Node childNode15 = childNodeList15.item(i);
if (childNode15.getNodeType() == Node.ELEMENT_NODE) {
libElement = (Element) childNode15;
ip1 = Integer.parseInt(libElement.getFirstChild().getNodeValue());
NamedNodeMap var2 = childNode15.getAttributes();
Node var3 = var2.getNamedItem("default");
cell18 = var3.getTextContent();
Node desc = var2.getNamedItem("Description");
cdes18 = desc.getTextContent();
}
}
this how im reading xml element and storing ip address in ip1 if i run
im gating error in this line
ip1 = Integer.parseInt(libElement.getFirstChild().getNodeValue());
|
|
|
|
|
Well, I'm afraid we cannot guess what that error could be. I suggest you step through the code with your debugger and look at the error that is produced, and the values of all variables that are being used in that statement.
|
|
|
|
|
thank u Richard MacCutchan
1st error is ip1 variable i declared as double
2nd i used Integer.parseInt i think it wont match
so please don't mistake me
i need two solutions
1.on which data type my variable have to declare
2.how to convert string to declared variable dataype
|
|
|
|
|
Member 10039109 wrote: 1st error is ip1 variable i declared as double Assuming that ip1 is part of an IP address, I cannot see any reason why you would declare it as a double . You could make things simpler by using the InetAddress class[^] to do the conversions.
|
|
|
|
|
thank u Richard MacCutchan!!!
please can u explain some detail im new for this
|
|
|
|
|
I have given you the link to the documentation, so you should go there, read it, and try some of the methods for yourself. Learning by doing is much more useful than having someone else do it for you.
|
|
|
|
|
thank u Richard MacCutchan!!!
what ever u sent right now im reading if i got any doubts i ask you thank u
|
|
|
|
|
I'm curious. Can you provide a snippet of the XML file you are trying to read?
-chronodekar
|
|
|
|
|
You replied to the wrong person.
|
|
|
|
|
I just ran an internet search for "eclipse java profiler". The results are confusing. I was expecting to find a list of tools or at least a simple tutorial on how to use a free one, but haven't seen anything of the such.
I find it hard to believe that an OSS profiler doesn't exist. Can someone point me to a tutorial on how to use one? Preferably with eclipse integration.
Or should I switch over to netbeans?
-chronodekar
|
|
|
|
|
|
I've seen that too, but if you download the newer eclipse releases, you'll see that it doesn't even have the "Profiling and Logging" perspective mentioned in that tutorial. Furthermore, the tutorial link itself indicates that its a part of "TPTP", the "Eclipse Test & Performance Tools Platform Project", which hasn't been updated since Feb-2011 !
-chronodekar
|
|
|
|
|
There were other links[^] but that seemed the most appropriate. If Google does not find you anything better then the chances are that nothing better exists.
|
|
|
|
|
Hello every one ..emm a beginner in progmming . And I have a problem while printing a asterisks patter pattern is :
i have to print the patter as per th user input like {3,2,4}
*
* *
* * *
* * *
this pattern should be for n inputs.MY problem is after printing a vertical line how could i go back to top to print another line. I have understood that first i have to find the max among all the inputs then have to print the max-input no blank in every vertical line but i dnn knw how can i print vertically
|
|
|
|
|
Well the numbers (3,2,4) don't seem to match your pattern anywhere so it is difficult to see the connection between the two. However, in order to print patterns of stars you print rows first. So it is just a matter of using the counts to decide how many to print on each row. If you try figuring out how you would do it using pen and paper, then coverting that to code should be quite easy.
Veni, vidi, abiit domum
|
|
|
|
|
opp!!! that was my typing mistake first i want to print the 3 stars then 2 and then 4 means basically depending upon the oder of input given by user ..
|
|
|
|
|
So what is the problem? Just use each number to create a loop and print that number of stars.
Veni, vidi, abiit domum
|
|
|
|
|
i have to print the stars in vertical manner mean first three stars vertical line then 4 stars vertical line and so on basically like the tower of asterisks . the problem is that after printing a line how can i take back control to the top to print another asterisks tower ??
|
|
|
|
|
You need to save these numbers in an array which you then use to calculate how many stars to print across each line. It's just a question of a bit of logic and mathematics.
Veni, vidi, abiit domum
|
|
|
|
|
Try changing your approach to the problem. Let's try this.
Input : 2, 4, 3
Desired output:
*
**
***
***
For graphical purposes let me remake the output as follows
*OO
**O
***
***
Replace the "O" with spaces. Does it help?
-chronodekar
|
|
|
|
|
How exactly does that help?
|
|
|
|
|
There might be a more efficient way of doing it, but here's my thinking.
1. Arrange all the numbers in descending order. Make note of the largest one ( = A). Also store the numbers in an array ( = ARRAY)
2. Count the number of inputs ( = B).
3. Visualize the output in the form of a rectangle - you need to draw (with ASCII) a rectangle whose height is A and width B. Alternatively, you need to print A no. of lines with B characters.
Now we come to implementation. In pseudo-code;
for (i = A ; i>0; i--)
{
for (j = 0; j<B; j++)
{
if (ARRAY(j) > i)
print("*");
else
print("O");
}
print("\n");
}
I think that should do it. Any edge case I missed?
-chronodekar
|
|
|
|
|
If I understand you post your 'algorithm' is incorrect.
You do not print vertically - Instead you print horizontally.
Hopefully you have already learned about loops and arrays. So
1. Put the values in an array
2. Write a method that finds the maximum value in the array. When if finds it set the array location to -1 (this is how you 'remove' it.)
3. Write a method that takes a X value and prints that many stars.
4. Put 2 and 3 together to print all the rows.
5. Think about how you know it will end (the '-1' is a hint.)
|
|
|
|
|
yeah i have read about loops and array.i can also find the max among all the elements of an array but what are you saying about location and all couldn't understand...
|
|
|
|