Challenging issue for Java and XML Gurus.Please advise

An extremely tricky and challenging code.
I have been able to add 2 XML documents together
using importNode().
xmlDoc1
<?xml version="1.0" encoding="UTF-8"?>
<i:Interest xmlns:i="common">
<i:Details xsi.type="i:vanilla.details.stock">
  <i:Strategy xsi.type="strategies:call">
     <strategies.Expiry>2009-12-01</strategies.Expiry>
  </i:Strategy>
<i:Ref/>
</i:Details>
</i:Interest>
xmlDoc2
<?xml version="1.0" encoding="UTF-8"?>
<i:Underlying value="KGF">
<common:Currency>GBP</common:Currency>
</i:Underlying>
My Java Code to append them together
NodeList list = xmlDoc2.getChildNodes();
for (int i=0; i< list .getLength(); i++) {
     Element element = (Element)list.item(i);
     Node dup = xmlDoc1.importNode(element, true);
     xmlDoc1.getDocumentElement().appendChild(dup);
Output:
<?xml version="1.0" encoding="UTF-8"?>
<i:Interest xmlns:i="common">
<i:Details xsi.type="i:vanilla.details.stock">
     <strategies.Description>Call</strategies.Description>
     <strategies.Expiry>2009-12-01</strategies.Expiry>
   </i:Strategy>
<i:Ref/>
</i:Details>
<i:Underlying value="KGF">
<common:Currency>GBP</common:Currency>
</i:Underlying>
</i:Interest>     Query:
I would like to add the 2nd XML Document after element <i:Ref> . How to do this? I dont want the 2nd XML doc after <i:details> but before it.
Please help.

Well. You say you want to insert a node as a child of another node, and it needs to be inserted before a certain other child node.
There's an insertBefore() method in the Node interface. Use that.
And if you thought that was a challenging issue then you might as well give up writing DOM code right now.

Similar Messages

  • Java and XML . PLEASE help

    Hi,
    I am using a SAX Parser to create XML documnets on the fly
    I am creating an xml document with some elements
    <name> userName </name>
    <pwd> pwd </pwd>
    Is there any class which can be used to create tag names
    like CreateTag("name") and endTag();
    which will create <name> </name>

    wouldn't be hard to write a method to do that:
    public String createTag(String tag) {
      StringBuffer buffer = new StringBuffer();
      buffer.append("<").append(name).append(">");
      return buffer.toString();
    }

  • Why can't I use WebCT chat with my computer?  I get the 'spiral of death' every time I try to type in my chat.  I have a feeling it has to do with compatibility issues between Java and Tiger.

    Why can't I use WebCT chat with my computer?  I get the 'spiral of death' every time I try to type in my chat.  I have a feeling it has to do with compatibility issues between Java and Tiger.

    Hi Elizabeth,
    Do your Mac meet any of these requirements?
    http://www.wvnet.edu/services/webct/requirements.html
    From this it appears to be PC only!???
    http://sourceforge.net/projects/awebctcclient/files/Pancake%20%28it%20own%20proj ect%20now%29/Pancake%20Console%20V1.0.0/PancakeConsole-1.0.0-src.zip/download
    Can you provide any more info on which bersion or file you have?
    Can you tell us why you need this for your use?

  • Can somebody explain to me how java and xml are related?

    Hi guys
    im new to java and xml.Been reading a lot regarding java and don't seem to have a problem with it...
    the problem is the xml part...im doing a simple GUI project using swing(online store) and i have to convert it to xml
    I have absolutely NO IDEA why i must convert my java to xml and have no idea how to do that.I been reading on the net that xml is a exten~ markup language and it is better and useful.
    Can somebody explain to me in layman terms
    1)how is java and xml related in?
    2)why do ppl want to convert java to xml when they can just stick to java
    3)what is actually xml...
    4)Do i need a program to create xml like i need jcreater to create java application
    5)How do we actually convert?is there any links that you guys could tell me?
    thank you
    tomleo

    im new to java and xml.Been reading a lot regarding
    java and don't seem to have a problem with it...Okay.
    the problem is the xml part...im doing a simple GUI
    project using swing(online store) and i have to
    o convert it to xmlYou have to? So presumably somebody in a position of authority told you that?
    I have absolutely NO IDEA why i must convert my java
    to xml and have no idea how to do that.I been reading
    on the net that xml is a exten~ markup language and
    it is better and useful.I have no idea either (besides which, it doesn't make sense). But why ask us? Somebody told you to do that, ask them why.
    Sure, XML is useful. But it isn't a programming language so it can't be used as a substitute for Java.
    Can somebody explain to me in layman terms
    1)how is java and xml related in?They aren't related, except perhaps in that they are both used in computers.
    2)why do ppl want to convert java to xml when they
    can just stick to javaThey don't.
    3)what is actually xml...Start here for numerous definitions:
    http://www.google.ca/search?hl=en&lr=&oi=defmore&q=define:XML
    4)Do i need a program to create xml like i need
    jcreater to create java applicationNo, XML is just text. But then Java code is just text too.
    5)How do we actually convert?is there any links that
    you guys could tell me?You don't convert Java to XML. My guess is that because you don't know much about Java or XML, you have misinterpreted something that somebody told you.

  • TS1702 On my Page Tool Bar I don't get the icons for info and insert. Please help

    When I open my Pages Program I don't get the icons for 'info' and 'insert'. Please help

    I'm having the exact same issue.  Any help is appreciated!
    Thanks!

  • ITunes 11 freezing while transfering music, and can't eject it, so I need to disconnect the cable, then iTunes works just fine and my iPod Shuffle is in restoring mode. I've been having this issue for weeks, and never had it before with iTunes 10.

    iTunes 11 freezes and can't eject my iPod, so I need to disconnect the cable, then iTunes works just fine and my iPod Shuffle is in restoring mode. I've been having this issue for weeks, and never had it before with iTunes 10. Please tell me at least a way to eject it without losing all my data and being forced to format/restore the iPod.    I've got 2GB iPod Shuffle 2nd generation(:D)

    As a test, shut down (power off) your computer and disconnect all USB devices including hub (except for standard keyboard and mouse if normally used).  If your computer is a laptop, connect its power adapter (so that it's not running on battery power).  Do this to reset the shuffle
    http://support.apple.com/kb/HT1655
    Start up the computer, run iTunes, and connect the shuffle to a direct USB port on the computer.  Does this problem recur when the shuffle is the only USB device?
    If it does (as another test), select the shuffle in iTunes, so that its Settings screen is showing.  Check the box for Enable disk use, and Apply.  Does that make any difference regarding this problem?

  • Java and XML or XHTML Journey Planner Project

    Hello chaps,
    I need some help with a project I am doing.
    This project will be focusing on the area of information visualisation and the phenomena surrounding how data can be optimised in a confined space. Expanding on this, confined space can be a mobile phone screen, and personal organisers where information is shown in a limited area.
    I plan to use Java and XML. (or XHTML)
    I want to have a running application where raw data is transformed into a combination of graphics and information. To achieve this, I will be looking at route planning for mobile phones and how route instructions can be represented in a visual but a sophisticated way.
    My focus will be on the London transport.
    Here is a link to the London transport journey planner
    http://www.tfl.gov.uk/journeyplanner
    Using WAP, I surfed the website on my phone and there seems to be a lot of writing and there is a lot to process before understanding what is going on. I want to transform words into pictures e.g., the word underground or bus into a logo of a red bus or underground logo or Instead of ?walk?, a picture of a walking pedestrian. Picture are good connotations as we can easily recognise rather than processing words. I would also like to represent the time taken in a graph format, again, to easily visualise.
    The application can be on a phone or on Windows simulating a mobile phone.
    Can anyone help me with this mammoth task or at least point me out in the correct direction?
    Looking forward to your reply.

    1st, ) Raw Data e.g, journey time, journey distance
    2nd, ) I would want the system to recognise the 'raw data' mentioned before and transform this into graphical image(s).
    3rd ) a complete visualisation would look like,
    modes of transport represented by pics or logos, showing the time to get to from A to B.
    Showing various routes, eg, walking, and/or bus and/or tube

  • Java and xml option necessary?

    Hi,
    first when i build the repository database, i choose java and xml option, is this necessary or i waste my time.
    When i read Building a Help Desk Connector, i'm not sure, do i need the Diagnostic Pack.
    Best regards
    Thomas
    (Narri, Narro)

    This is the defacto site for xpath stuff for java
    http://xml.apache.org/xalan-j/

  • Java and XML Doc

    I am new to Java and XML, I want to know the steps i should follow to work with XML document using XPATH. also the APIs and Technologies i shoud work. If possible guide me any examples or tutorials for that.

    This is the defacto site for xpath stuff for java
    http://xml.apache.org/xalan-j/

  • I just ran a software update for Java and MacBook Pro SMC, now my Mini Display Port to HDMI TV is not working. The TV is flickering. The Mac Display is fine.

    I was just watching / streaming TV off Safari on my actual TV.
    I'm using a Mini-Display Port to HDMI cable for the connection to the external display.
    Software update popped-up and said there was an update for Java and for SMC.
    I ran the update and upon the computer restarting, my external display (my TV) is no longer working. It is now flickering.
    It won't work in Mirroring or set up as an extended display.
    I've reset SMC / PRAM / Safe Mode / Even restored from a Time Machine backup (From before the updates were done).
    What could it be?!

    I keep saying this over and over, in the hope that people who do a search will find it.  Apple cannot possibly test for or be reponsible for the bazillion combinations of adapter, cables, and TV's out there.  The only monitors that are 100% guaranteed to work with the MacBook Pro are the Cinema Displays and Thunderbolt Displays, because, they're made by Apple.  They're expensive, but they work perfectly.
    My guess is that you bought a cheap MDP to HDMI cable, or have a defective one.  From my reading of these boards over the past few months, cheap cables have a high failure rate.  And the regular priced ones have only a slightly less of one.  Try a new one.  Make sure you do not damage the Thunderbolt port.

  • I wish to del one apple id and make one common for mac and i phone, please suggest

    i wish to del one apple id and make one common for mac and i phone, please suggest

    You cannot delete an Apple ID, you just stop using it. Understand that any apps purchased using that ID can only be updated with it. Apps are tied that ID used to purchase them. If you want to use a new ID for everything, you will need to repurchase any old apps using the new ID.

  • I have a problem with itunes when I sync the saved music and want to sync my iphone 5 ios 7.0.6 no longer passes the music thing is that just stays on "waiting for sync" and not worry please help are more than 400 songs that do not want to hear who are wi

    I have a problem with itunes when I sync the saved music and want to sync my iphone 5 ios 7.0.6 no longer passes the music thing is that just stays on "waiting for sync" and not worry please help are more than 400 songs that do not want to hear who are wi

    Plawexki wrote:
    ...  do you know if the contacts, photos, messages etc will be wiped?
    Yes... Everything will be Wiped and Replaced with what is currently on Your Mac.
    SYNCING with iTunes
    See here  >  http://support.apple.com/kb/HT1386
    From Here  >  http://www.apple.com/support/iphone/syncing/
    You may find this information of interest...
    Have a read here...
    https://discussions.apple.com/message/18409815?ac_cid=ha
    And See Here...
    How to Use Multiple iDevices with One Computer

  • Any difference between webdynpro for java and webdynpro for abap ?

    Hi all:
       I would like to build one small system in EP.
       I can choose to use webdynpro for java and webdynpro for abap.
       I would like to ask any major difference between webdynpro for abap and webdynpro for java ?
       Is fpm supported in webdynpro for abap ?

    Hi,
    see this thread,
    ABAP Vs JAVA WebDynpro
    Regads,
    J.Joe

  • By mistake I uninstalled my Acrobat someting, which gave me the opportunity to print .pdf and color-mark text. My licence key is [removed by moderator]. What is the name of the product? Where is the link for download and reinstall? Please help me r

    By mistake I uninstalled my Acrobat someting, which gave me the opportunity to print .pdf and color-mark text. My licence key is [removed by moderator - never disclose publicly]. What is the name of the product? Where is the link for download and reinstall? Please help me rapidly, Best regards / Stefan

    Sign in to your Adobe account online and look in the Plans/Products sections to see which program it might have been.

  • Hi. I tried switching my Apple ID email address to my new email address and I don't know how to switch it for iCloud and iTunes. Please help!! It seems like Apple thinks I have two separate accounts, when I just tried to simply change it!

    Hi. I tried switching my Apple ID email address to my new email address and I don't know how to switch it for iCloud and iTunes. Please help!! It seems like Apple thinks I have two separate accounts, when I just tried to simply change it!

    Settings > Store > Sign Out.
    Sign in with the correct ID.

Maybe you are looking for

  • LSMW-Uploading G/l master Data

    Hello, we are migrating Data from R/3 4.6 to ECC 6.0.We need all the G/l from 4.6  exactly same way in ECC 6.0 without new G/l features. Please let me which table I should use to extract  g/l master  data (SKA1or SKB1) from 4.6.I am going to do recor

  • XML Publisher Report Question

    Hi, can anyone tell me where do the report definition files get stored when we create a custom report? Where does it store the xml file after creating the data definition and where the rtf file after creating the template? Thanks.

  • Oracle 8.1.5 Linux Memory Leak?

    We have been running Oracle 8.1.5 Server and Client on Redhat 6.1 kernel 2.2.12-20 glibc-2.1.2-11 Blackdown's JDK 1.2 RC3 We are having bad memory leaks and we have verified that they are not in our source code using a memory profiler for Java-linux.

  • Increasing the ipod's preamp level output

    Hello everyone, I'm not sure if it's possible or not, but is there a way to increase the preamp output level through the dock connector? I'm using the ipod video 60 gig with my Alpine car audio system, and I would like to increase the output to match

  • When trying to use my banking apps I get the error "Network Required  This application requires an active Internet Connection.  Please try again"

    When trying to use my banking apps I get the error "Network Required  This application requires an active Internet Connection.  Please try again".  This happens with two different apps from two different banks.  One of them works occasionally and hav