Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. reading ipaddress from xml file

reading ipaddress from xml file

Scheduled Pinned Locked Moved Java
htmlxmlannouncement
11 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 10003387
    wrote on last edited by
    #1

    hi this nagaraj,im doing gui for 4g so i want to read ip address from xml file and it will be display in textbox and if user enters the ip address i want update it in to xml file alredy im using DOM for reading&updating xml file

    L 1 Reply Last reply
    0
    • U User 10003387

      hi this nagaraj,im doing gui for 4g so i want to read ip address from xml file and it will be display in textbox and if user enters the ip address i want update it in to xml file alredy im using DOM for reading&updating xml file

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      If you already know how to read and write the XML to and from a DOM, then what is your problem?

      U C 2 Replies Last reply
      0
      • L Lost User

        If you already know how to read and write the XML to and from a DOM, then what is your problem?

        U Offline
        U Offline
        User 10003387
        wrote on last edited by
        #3

        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());

        L 1 Reply Last reply
        0
        • U User 10003387

          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());

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          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.

          U 1 Reply Last reply
          0
          • L Lost User

            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.

            U Offline
            U Offline
            User 10003387
            wrote on last edited by
            #5

            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

            L 1 Reply Last reply
            0
            • U User 10003387

              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

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              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.

              U 1 Reply Last reply
              0
              • L Lost User

                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.

                U Offline
                U Offline
                User 10003387
                wrote on last edited by
                #7

                thank u Richard MacCutchan!!! please can u explain some detail im new for this

                L 1 Reply Last reply
                0
                • U User 10003387

                  thank u Richard MacCutchan!!! please can u explain some detail im new for this

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  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.

                  U 1 Reply Last reply
                  0
                  • L Lost User

                    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.

                    U Offline
                    U Offline
                    User 10003387
                    wrote on last edited by
                    #9

                    thank u Richard MacCutchan!!! what ever u sent right now im reading if i got any doubts i ask you thank u

                    1 Reply Last reply
                    0
                    • L Lost User

                      If you already know how to read and write the XML to and from a DOM, then what is your problem?

                      C Offline
                      C Offline
                      chronodekar
                      wrote on last edited by
                      #10

                      I'm curious. Can you provide a snippet of the XML file you are trying to read? -chronodekar

                      L 1 Reply Last reply
                      0
                      • C chronodekar

                        I'm curious. Can you provide a snippet of the XML file you are trying to read? -chronodekar

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #11

                        You replied to the wrong person.

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups