Why this removeChile function can not work

Dear All
can any one help me fix this problem? i can not delete one job record from XML file, and there is no any error message, don't know why can not remove the node from XML file. Thanks!
XML File:
<Job_ad>
<job>
<title>ABC
<detail>123
</job>
</job_ad>
the Java code
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder parser = factory.newDocumentBuilder();
File fn = new File(fileName);
Document doc = parser.parse(fn);
NodeList ReportDate = doc.getElementsByTagName("job_ad");
NodeList job = doc.getElementsByTagName("job");
for (int i = 0; i < job.getLength(); i++) {
Element jobDetail = (Element)job.item(i);
String jobTitle = jobDetail.getElementsByTagName("title").item(0).getFirstChild().getNodeValue();
if (jobTitle.equals("ABC")) {
System.out.println("record found");
Node deadElement = (Node)jobDetail.getParentNode().removeChild(jobDetail);
catch (Exception e) {
System.out.println(e);

if (jobTitle.equals("ABC"))The actual value of jobTitle is "ABC\n", if your posted XML is accurate. You forgot to account for the new-line character after the text.
A little debugging (such as System.out.println(jobTitle)) might have told you that.

Similar Messages

  • Why this character \ it is not working in action scrip?

    Hi...
    Why this character \ it is not working in action scrip? And
    how can I solve it?
    on (release) {
    text.text = text.text + "l"
    Please your help ASAP
    thank you

    yea, that's true, but I don't think that is the problem.. I
    use it every once in a while, and it doesn't break the script.
    "I’m trying to make bush button if i press it, the
    action script it well write the text in text area and I’m
    using Flash MX 2004"
    This statement makes
    zero sense.. please clean it up and make it understandable,
    and tell what version of Actionscript you are publishing to.

  • Can any one please tell me why this e-class is not working

    Hi
    I want to listen the following e-class. But its not running. Can any one please tell me why its not working
    I have windows media player 11 in my system
    <a href="https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/media/uuid/34b9359e-0701-0010-f59d-ee014d5079b3?prtmode=navigate"></a>
    Best Regards
    Ravi Shankar B

    Hi
    I want to listen the following e-class. But its not running. Can any one please tell me why its not working
    I have windows media player 11 in my system
    <a href="https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/media/uuid/34b9359e-0701-0010-f59d-ee014d5079b3?prtmode=navigate"></a>
    Best Regards
    Ravi Shankar B

  • Why this logic:present can't work?

    Hi everyone:
    I am writing a registe jsp page.I want to use the struts validator.I had written a registeform extends ActionForm.I want to display a picture if user don't fill the password field,so I use the taglib : <logic:present and <html:img
    I add all the error in my registeform.In actionform I use the method:
    if(password1==null){
    ActionErrors errors=new ActionErrors();
    errors.add("password1",new ActionError("user.password1.required"));
    In jsp page:
    <logic:present name="password1"> /* or use name="<%=Action.ERROR_KEY%>"*/
    <html:img page="/jsp/images/error.gif"/>
    <html:errors property="password1"/>
    </logic:present>
    But failed.It can't display anything even there are error in the ActionErrors.
    If I change the code to:
    <html:errors property="password1"/>
    It works well.But it can't display the picture that I want.
    someone has good idea to do this?
    thks!

    Hi:
    I used the <html:errors tag but it can't work also.The main problem is: there is any tag that can store the error according to the field's property?For example:If the name field isn't be filled, only the name's error will be stored in name's property tag.
    What I want to see is only the name field's picture display if user don't fill the name field.
    As is: <table>
    1.name text field (not filled) display images
    2.email text field (filled ) don't display!
    3.password text field (not filled) display images
    4.work text field (filled) don't display
    What I want to get is above.Can the logic and html taglib do this? Have you some good idea?

  • Any ideas why this "if" statement is not working?

    I have this code inside a click command. The first part works, will change variable to 5. But if variable = 5 animation does not play: 
    if (position != "5"){
                                  sym.setVariable("position", "5");
                                  var position = sym.getVariable("position");
                                            sym.$("Text3").html(""+position);
    else if(position==5)
    sym.play("animation")
    Thanks

    Hi there, can you put a console log before the if statement to confirm that you have a valid value for the "position" variable, at that click scope?
    console.log('position = '+position);
    Run it in your browser and open the JS console to check the log output of the above test.

  • Why this WLST script does not work from ant a task

    Hi,
              The following is my lovely WLST script to disable managed server hostname verification in a cluster environment.
              It works perfect if I run it from the OS command line,
              java -cp $WL_HOME/server/lib/weblogic.jar sslSetting.py weblogic weblogic t3://localhost:7001
              But if I run it from ant task, it never works. Nothing happens, not even any messages. Any idea?
              ------ sslSetting.py -----------
              # Disable HostnameVerification on managed servers
              # This is a ONLINE script. The admin server must be running
              # @param $1 BEA_USER_NAME
              # @param $2 BEA_USER_PWD
              # @param $3 admin server URL
              if (len(sys.argv) != 4):
              print "usage: " + sys.argv[0] + " domain-home "
              sys.exit()
              beaUserName=sys.argv[1]
              beaUserPwd=sys.argv[2]
              adminServerUrl=sys.argv[3]
              def handleServer(server):
              SSLPath="/Servers/" + server.getName() + "/SSL/" + server.getName()
              print("handleServer(1): " + SSLPath)
              try:
              cd (SSLPath)
              print("handleServer(2): " + SSLPath)
              set("HostnameVerificationIgnored", "true")
              except Exception, inst:
              dumpStack()
              print ("FAILED handleServer(): " + SSLPath)
              else:
              print ("DONE handleServer(): " + SSLPath)
              #===============================================================================
              # Main
              #===============================================================================
              try:
              connect(beaUserName, beaUserPwd, adminServerUrl)
              edit()
              startEdit()
              adminServerName=cmo.getAdminServerName()
              for server in cmo.getServers():
              if adminServerName != server.getName():
              handleServer(server)
              save()
              activate()
              except Exception:
              dumpStack()
              else:
              print ("=== DONE ===")

    OK, when I run the WLST script from command java, I only need the weblogic.jar in the classpath. But I'll need a couple other jar file for it to work inside an ant target, as showing below.
              <target name="run-wlst">
              <java classname="weblogic.WLST" fork="true">
              <classpath>
              <pathelement path="${props.JAVA_HOME}/lib/tools.jar"/>
              <pathelement path="${props.WL_HOME}/server/lib/weblogic_sp.jar"/>
              <pathelement path="${props.WL_HOME}/server/lib/weblogic.jar"/>
              <pathelement path="${props.WL_HOME}/server/lib/webservices.jar"/>
              </classpath>
              <sysproperty key="weblogic.Home" value="${props.WL_HOME}" />
              <arg line="sslSetting.py weblogic weblogic t3://localhost:7001"/>
              </java>
              </target>

  • WHY this DB view is not working

    REPORT  ZMYTESTPRG24                            .
    DATA : IVIEW LIKE ZMYDBVIEW OCCURS 0 WITH HEADER LINE.
           SELECT * FROM ZMYDBVIEW INTO TABLE IVIEW.
           LOOP AT IVIEW.
             WRITE: / IVIEW-MATNR, IVIEW-BISMT, iview-saiso,
             IVIEW-VARIANTE, IVIEW-CKMACHAR, IVIEW-REPORT.
           ENDLOOP.

    What exactly is the problem? Syntax error?
    The view must be defined as either a projection view or a database view. Is it?
    Rob
    Message was edited by:
            Rob Burbank

  • Why my PermissionsCommand can not work?

    Thers is a SAP standard command named "permissions" that you can find in "System Admin>System configuration>content management>user interface>commands".It is drived from the java class "com.sapportals.wcm.rendering.uicommand.cm.UIPermissionsCommand".
    I download the java class and decompile into java file.In netweaver development studio,I create a new project and copy the java code into a new class of the project and deploy it into my portal.In portal I link the class to a command named "permisssiontest",but unlucky the command doesnot work.
    Why my permission command can not work?

    Hi Shi,
        Could you give me more details about this issue ? After deploy, have you created a new command and assign it a group command in a layout set.
       Here:
       https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/kmc/Knowledge%20Management%20and%20Collaboration%20Developers%20Guide.html
       You can find this example: SimpleOneStepScreenFlow. You can use it as template.
       We had to write a new permission command and it worked fine.
    Patricio.

  • Why this simple assingment is not possible in Generics ?

    Hi
    Just curious to know why this simple conversion does not work and requires casting ?
    List<? super Integer> list = new ArrayList<Integer>();
    List<? super Number> listN = list; //Requires Casting
    List<? extends Number> listExNu = new ArrayList<Number>();
    List<? extends Integer> listExIn = listExNu; //Requires CastingAs per my understanding ,
    A List<? super Number> can fit inside a List<? super Integer> ...
    So what really happens here to force casting ? Any ideas ?

    ejp wrote:
    List<? super Integer> list = new ArrayList<Integer>();The only two classes that are superclasses of Integer are Number and Object.Not quite. Please note that the clause *? super Integer* is inclusive, i.e. it also matches List<Integer>.
    Additionally, it matches all interfaces implemented by Integer. Thus, the following types can be assigned to list:
    List<Integer>
    List<Serializable>
    List<Comparable<Integer>>
    List<Comparable<? extends Integer>>
    List<Comparable<? super Integer>>
    List<Comparable<? extends Number>>
    List<Comparable<? extends Serializable>>
    List<Comparable<?>>
    List<Number>
    List<Object>And the following types can be assigned to listN:
    List<Serializable>
    List<Number>
    List<Object>Since the latter is a genuine subset of the former, an implicit conversion such as listN = list is impossible.

  • My copy and paste functions are not working, does anyone know why this might be happening?, my copy and paste functions are not working, does anyone know why this might be happening?

    my copy and post functions are not working, does any one know why this may be happening and what I could do to fix it? Thanks!

    Have you tried rebooting?

  • The 'Swipe to Camera app icon' function is not working.  I swipe across but the camera app doesn't start up at all.  Does anyone else have this problem?  Can it be fixed?

    The 'Swipe to Camera app icon' function is not working.  I swipe across but the camera app doesn't start up at all.  Does anyone else have this problem?  Can it be fixed?

    You don't swipe but actually press, hold and push up.

  • How to delete multiple songs from iPhone 5S without losing form iTunes? The unchek function has not worked. Why?

    How to delete multiple songs from iPhone 5S without losing form iTunes? The unchek function has not worked. Why?

    Sorry I had to reply through your profile Gail from Maine, my PC has java issues. In any event, when I delete them directly from my device everything is perfect and cool. However, in the rare instance I want to add new music that I actually buy in stores (I know, quite the unique and old-fashioned idea...but hey Im an audiophile) once I upload the tunes, everytime I sync my library it re-adds everything that I spent hours deleting. In a perfect world, I thought I could maintain a massive iTunes Library, and add or delete (remove) songs from my iPhone to save both memory or keep my iPhone selections more current/apt to my musical "tastes" at that time. I know about the whole playlist thing, but thought there might be an easier way. ie - checking/un-checking the little box next to the song name, and then doing a sync. Again, everytime I do this however, whether everything is checked or un-checked it adds the entire library! So frustrating. Any suggestions. Thank you graiously in advance for your help.

  • HT1409 I have done this but it does not work with one of my albums and I dont know why??

    I have done this but it does not work with one of my albums and I dont know why??

    That would be it. Sometimes you can tweak the album & artist names enough for iTunes to download matching art from the store, or you could add a bonus track featuring 1 second of silence and attach artwork to that, or you could convert the files to Apple Lossless.
    tt2

  • Why GWt suggest box is not working in the latest versions of Firefox ? It was working only in Firefox 3 and not other versions. could you please assist in this regards.,

    Why GWt suggest box is not working in the latest versions of Firefox ?
    It was working only in Firefox 3 and not other versions. could you please assist in this regards.,

    jbren wrote:
    I repeatedly have problems with playback on my STB's. Go thru all the motions, inhouse agent, fix multi room dvr problems. Unplug unit, unplug dvr, etc. etc. etc.  The DVR'd show will play on the DVR but not on the STB's. What's up with that?
    Sorry to hear the auto fix suggested early did not fix your problem. So we can get more information from you, I have copied your post to our private support board. Please refer all correspondences to there from here on out. You can easily get to the private support one of two ways. In the email you signed up for the forums with, you will receive a link to click on. Make sure you are already signed into the forums before clicking on this link. Another way of getting there is by clicking on your username anywhere you see it in the forums. This brings you to your account profile. Scroll down to the section labeled "My Support Cases" . In there you will see the link to your case.
    Anthony_VZ
    **If someones post has helped you, please acknowledge their assistance by clicking the red thumbs up button to give them Kudos. If you are the original poster and any response gave you your answer, please mark the post that had the answer as the solution**
    Notice: Content posted by Verizon employees is meant to be informational and does not supersede or change the Verizon Forums User Guidelines or Terms or Service, or your Customer Agreement Terms and Conditions or plan

  • Every time I open a pdf file which includes a javascript, a dialogue box pops up. I have a question why 'Do not show this message again' is not working even I checked on the checkbox. It should block the dialogue next time when I open the same pdf file bu

    Every time I open a pdf file which includes a javascript, a dialogue box pops up. I have a question why 'Do not show this message again' is not working even I checked on the checkbox. It should block the dialogue next time when I open the same pdf file but not working. What is the matter and how can I deal with it?

    I am trying it on Adobe Acrobat Reader 9.2.1. Tried to fix Hex code, and also tried 'edit-preference-trust manager'. I focusing on Adobe registries but still couldn't fix the problem.

Maybe you are looking for

  • Wireless mouse on my macbook pro

    can I use a logitech  m315 wireless mouse on my macbook pro?I plugged in and it's not working. Works on HP laptop. Very new to Mac.

  • How to avoid BPM SYSFAILerror in queue

    Hi Friends, I just designed a sync/asynch bridge. sender abap proxy synch... whenever there is any failure, the message goes to sysfail status in smq2 and sxmb_moni. I am using dedeline/exception branch also ? I just want to make sure if any message

  • Passing umlaut character as a SOAP message

    I'm using German umlaut inside a serialised XML string. The output file replaces the umlauts with question mark(?) character in unix environment. I am using ISO-8859-1 encoding. PS: This works fine In windows environment. Suggestions are welcome.

  • Photoshop CC 3D Rendering

    I just recently got Adobe CC apps and now am trying to see whats new in each application and I do not have the processing power to support the 3D rendering needed in Photoshop, has anyone done anything with the 3D tools in Photoshop CC? If so can you

  • Pull the data from ORACLE

    Hi Guru's, I would like to know ,How to pull the Data from Oracle tables to BW. tell me scratch onwards... regards sekhar ch