Question regarding DOM, XML and how to insert child nodes...

Hi,
I'm a QA student working on some big project.
Say you have an XML library holding some symbols by their categories, there are many categories, say we have two 'Miscellaneous' and 'Categories'.
I want to add to both categories another child:
the problem is that the way it is done now is:
symbolCategoryItem.appendChild(newSymbolNode)As you probably know, appendChild(newChild) deletes from the tree the newChild if exists, before inserting it again...
What should I do to avoid it?

http://www.cafeconleche.org/books/xmljava/chapters/

Similar Messages

  • I have questions regarding notes section , like how I write notes and they end up my my wife's phone !!!!!!

    I have questions regarding notes section , like how I write notes and they end up my my wife's phone !!!!!!

    Yes, as Josh P said, I can see that happening if you sync with iTunes on the same Computer and the same mail account.  Under the info section, advanced, I bet notes is checked for both of the devices..everything else might be un-checked, but notes might be checked for both devices...

  • Could someone help me out how to insert a Node properly into a DOM?

    I am trying to insert a Node built from a String to a DOM.
    Here is how I created the Node
                   Detail = "<Detail><Msg>Detail Message</Msg></Detail>";
                   prolog = "<?xml version="1.0" encoding="UTF-8"?>";
                   Node DetailNode = null;
                   Document DetailDoc = null;
                   if( Detail != null ){
                        Detail = prolog + BiometricDetail;
                        DetailDoc = xp.XML2DOM( BiometricDetail ); // transform a XML String into a DOM.
                        DetailNode = BiometricDetailDoc.getDocumentElement();                    
    Here is how I created the DOM
                   javax.xml.parsers.DocumentBuilderFactory factory = javax.xml.parsers.DocumentBuilderFactory.newInstance();
                   javax.xml.parsers.DocumentBuilder builder = factory.newDocumentBuilder();
                   Document document = builder.newDocument();
                   Element beeE = document.createElement("BeeSets");
                   Element grpE = document.createElement("Group");          
                   bioE.appendChild( grpE );
                   // the document looks like "<BeeSets><Group></Group><BeeSets>";
                   // After inserting the Node DetailNode, I want it to look like
                   // "<BeeSets><Group><Detail><Msg>Detail Message</Msg></Detail></Group><BeeSets>";
    Now when I tried to insert the node DetailNode to the DOM document, I tried
    1) document.importNode( DetailNode, true );               
    No exception was thrown. But when I transformed the DOM document back to a String, I could not see the information from the newly imported Node DetailNode.
    When I tried
              grpE.insertBefore( BiometricDetailNode, dataE );
    I got the following exception.
         org.w3c.dom.DOMException: WRONG_DOCUMENT_ERR: A node is used in a different document than the one that created it.
         at org.apache.xerces.dom.ParentNode.internalInsertBefore(Unknown Source)
         at org.apache.xerces.dom.ParentNode.insertBefore(Unknown Source)
         at com.jadcs.bioidentity.role.base.RP.getNodes(RP.java:497)
    2) document.adoptNode( DetailNode );
    I got the following exception.
         java.lang.ClassCastException: org.apache.xerces.dom.DocumentImpl
         at org.apache.xerces.dom.DeferredTextImpl.synchronizeData(Unknown Source)
         at org.apache.xerces.dom.NodeImpl.setOwnerDocument(Unknown Source)
         at org.apache.xerces.dom.ParentNode.setOwnerDocument(Unknown Source)
         at org.apache.xerces.dom.ElementImpl.setOwnerDocument(Unknown Source)
         at org.apache.xerces.dom.ParentNode.setOwnerDocument(Unknown Source)
         at org.apache.xerces.dom.ElementImpl.setOwnerDocument(Unknown Source)
         at org.apache.xerces.dom.CoreDocumentImpl.adoptNode(Unknown Source)
         at com.jadcs.bioidentity.role.base.RP.getNodes(RP.java:509)
    3) detailStr = "<Detail><Msg>Detail Message</Msg></Detail>";
    Element detailE = document.createElement("Detail");
    detailE.setTextContent( detailStr );
    grpE.appendChild( detailE );
    This way gives result like "<BeeSets><Group><Detail><Detail><Flash>On</Flash></Detail></Detail></Group><BeeSets>";
    The content is messed up.
    Could someone help me out at how to insert a Node properly into a DOM? Thank you very much.

    Said another way, importNode actually only makes and returns a copy of the node you gave it (it will be a deep copy only if you pased true as the second parameter), but where the new dom you called import on is owner.
    So what you need to do is more like this:
    Node tempNode = domYouAreAddingTheNodeTo.importNode(node2copy,true); //true if you want a deep copy
    domYouAreAddingTheNodeTo.appendNode(tempNode);You can also traverse to any point in the DOM and insert the node there with the same method, but you always have to import first so that the DOM has a copy of the node that it owns.

  • Quick question regarding best practice and dedicating NIC's for traffic seperation.

    Hi all,
    I have a quick question regarding best practice and dedicating NIC's for traffic seperation for FT, NFS, ISCSI, VM traffic etc.  I get that its best practice to try and separate traffic where you can and especially for things like FT however I just wondered if there was a preferred method to achieving this.  What I mean is ...
    -     Is it OK to have everything on one switch but set each respective portgroup to having a primary and failover NIC i.e FT, ISCSI and all the others failover (this would sort of give you a backup in situations where you have limited physical NICs.
    -    Or should I always aim to separate things entirely with their own respective NICs and their own respective switches?
    During the VCAP exam for example (not knowing in advance how many physical NIC's will be available to me) how would I know which stuff I should segregate on its own separate switch?  Is there some sort of ranking order of priority /importance?  FT for example I would rather not stick on its own dedicated switch if I could only afford to give it a single NICs since this to me seems like a failover risk.

    I know the answer to this probably depends on however many physical NICs you have at your disposal however I wondered if there are any golden 100% rules for example FT must absolutely be on its own switch with its own NICs even at the expence of reduced resiliency should the absolute worst happen?  Obviously I know its also best practice to seperate NICs by vender and hosts by chassis and switch etc 

  • Question regarding the "mcxquery" and "dscl -mcxread" commands:

    Question regarding the mcxquery and dscl -mcxread commands:
    Does anyone know why the mcxquery and the dscl . -mcxread commands don't show any info about MCX managed login items & printers? The System Profiler's "Managed Client" section does. Id like to see info regarding managed printers and managed login items using the mcx tools. I have Mac users running 10.5.2 with both login items and printers that are pushed out to them via MCX. The System Profiler app shows all of their policies, but the dscl . -mcxread and mcxquery tools dont. Why not?
    -D
    Message was edited by: Daniel Stranathan
    null

    How do you "call procedures/functions" without sql code? You need at least the call statement like
    {call myProc(?,?,?)}that you wrap into a CallableStatement.
    Other than that: when you switch off autocommit, you need to call commit/rollback at the end. Usually, if you don't commit/rollback a non-autocommitted connection, the transaction get's committed/rollbacked when you close the connection - that depends on the JDBC driver. But it's never a good idea to ommit the commit/rollback calls on a non-autocommit connection. Usually you enclose your code in a try/catch block like this:
    con.setAutocommit(false);
    try {
       con.commit();
    } catch (Exception e) {
       con.rollback();
    } finally {
        con.setAutocommit(true); //or:
        con.close();
    }

  • Few questions regarding Oracle Scorecard and strategy management.

    Hi,
    I have following questions regarding Oracle Scorecard and strategy management:
    1. What are the ways in which i can show status of a KPI, like we have colors and symbols, what are others?
    2. can we keep log of KPIs, store them, keep report of feedback/action taken on that?
    3. Does Scorecard and strategy management have ability to retain history on feedback and log of
    entries i.e. date/time, user name?
    4. Does Scorecard and strategy management have ability to use common mathematical formulas e.g. median, average, percentiles. Describe.?
    Thanks in advance for your help.

    bump.

  • Details regarding DTP's and how to create them

    Hello
    can anyone help me
    please give me details regarding DTP's and how to create them
    Thanks
    lalit

    hi,
    http://help.sap.com/saphelp_nw2004s/helpdata/en/42/f98e07cc483255e10000000a1553f7/content.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/a4/1be541f321c717e10000000a155106/frameset.htm
    hope it helps

  • I got a question regarding running iOs and Windows using virtual software.

    Greetings!
    I got a question regarding running iOs and Windows using virtual software. I recently bought a monitor so I can display Windows on it and run both OS at the same time.Now,I'm using BootCamp. I downloaded VirtualBox for "tranferring" Windows on it. Since I'm a new iOs user , what do I need to do in order to make work?
    Do I need to un-install Windows from BootCamp,install VirtualBox and then install them again?
    Any information would be appreciate it!

    That should work to use OS X, you can run MS Windows using Virtual Box and use a seperate display for the Virtual Box window. That way you can run OS X and MS Windows simultaneously. However remember Virtual Box is freeware and not a commercial application like Parallels or VMWare Fusion and may not have the features of a commercial application. Support for Windows run in any virtualization application (Virtual Box, Parallels or Fusion) is not generally done on this forum as they are not OS X related. To get help on those apps you usually will need to go to their forums.
    Remember IOS will not run on either OS X or MS Windows, it only works on IOS devices.
    Good luck with your installation.

  • MOVED: question regarding CPU temps and latest bios (1.8)

    This topic has been moved to AMD64 nVidia Based board.
    question regarding CPU temps and latest bios (1.8)

    I'd believe the first bios's temps more than the second...  
    However what temps are given when using speed fan and/or everest? (in windows)

  • Question about DOM XML

    Hi Experts
    Do you Know how can I write I DOM XML
    the header of file I Mean
    <?xml version="1.0" encoding="iso-8859-8"?>
    Regards
    Yossi

    hi,
    say u have xml with following structure
    <xml>
    <Age>xyz</Age>
    </xml>
    to append age node, parse the xml string or file and try the following code
    HERE DOM is used
    Document xmlDoc = wdThis.ParseFile(xmlString);
    Node root=xmlDoc.getDocumentElement();
    Node AgeNode = xmlDoc.createElement("Age");
    Node AgeTextNode = xmlDoc.createTextNode("25");
    AgeNode.appendChild(AgeTextNode);
    root.appendChild(AgeNode);
    following code to parse the xml string
    public org.w3c.dom.Document mParseFile( java.lang.String XmlString )
    //@@begin mParseFile()
    //pearse the xml string passed
    IWDMessageManager mesg = wdComponentAPI.getMessageManager();
    String l_method = "mParseFile";
    //parsing xml string to xml document
    ByteArrayInputStream l_xmlDataInputStream = new ByteArrayInputStream(p_XmlString.getBytes());
    Document l_doc = null;
    InputSource in = new InputSource((InputStream) l_xmlDataInputStream );
    DocumentBuilderFactory l_dbf = DocumentBuilderFactory.newInstance();
    l_dbf.setValidating(true);
    l_dbf.setNamespaceAware(true);
    DocumentBuilder l_db;
    try {
    l_db = l_dbf.newDocumentBuilder();
    l_doc = l_db.parse(in);
    catch (ParserConfigurationException e) {
    } catch (SAXException e) {
    } catch (IOException e) {
    //returns xml document
    return l_doc;

  • Questions regarding xft fonts, and awesome wm

    Hi, I just tried ArchLinux yesterday and loving it!
    I use JWM, but am very interested in dwm/awesome wm. I do have some questions:
    1. On a thread in the forum, it is mentioned that dwm has no Xft support. How useful exactly is Xft? Would it impact on design work involving GIMP/Inkscape/Scribus?
    2. Does awesome have Xft support?
    3. I installed awesome, but I have no idea on what keys to use. The shortcuts are different from dwm. I tried to look for quick tutorial just to get the basics (dwm has one on their website), but seems like all documentation I found have none of that section and go straight to configuration.
    Do I actually have to configure the wm before I can use it at a very basic level?
    4. I would like to do some more comparison between wms, trying to find a good balance for me in regards of lightness and functions I need. However, I have no idea on what to use to keep track of cpu/memory usage for all the wms. What's a good way to do this?
    Thank you in advance.

    Welcome to Arch!
    1. The lack of xft support in dwm mostly just means that you won't get anti-aliased fonts in the status bar. Individual applications will still have the same font support they had before you used dwm.
    2. Awesome uses pango for font rendering, which is even better than xft.
    3. Look at the man page for default key bindings. It's more or less usable out of the box, but you will definitely want to customize it somehow.
    4. A good system monitor is htop. Install it from the repos and run it from a terminal.
    Last edited by fflarex (2009-02-23 18:44:45)

  • Questions regarding *dump_dest parameters and fast_recovery_area

    Hello,
    I just installed a fresh new 11.2.0.2 Database on Solaris 10.
    Everything straightforward on the parameter side!!! I tried custom install as well as general purpose template. When installing with DBCA, I set every parameters around DB Name in lowercase name.
    With this, questions are popping in my mind regarding some parameters after installation.
    First, %dump_dest parameters contains in path, two times the db name (ocpdb in my case):
    background_dump_dest       /u01/app/oracle/diag/rdbms/ocpdb/ocpdb/trace
    user_dump_dest                 /u01/app/oracle/diag/rdbms/ocpdb/ocpdb/trace
    core_dump_dest                 /u01/app/oracle/diag/rdbms/ocpdb/ocpdb/cdumpIs it normal to have ..../rdbms/dbname/dbname/..... as path, with dbname/dbname ??? Why?
    Second, the question regarding the directory structure under fast_recovery_area (new term for flash_recovery_area). The directory structure:
    oracle@enalab13:/u01/app/oracle/fast_recovery_area$ ls -l
    total 2
    drwxr-x--- 2 oracle oinstall 512 2010-10-28 19:53 ocpdb
    drwxr----- 5 oracle oinstall 512 2010-10-29 07:44 OCPDB
    oracle@enalab13:/u01/app/oracle/fast_recovery_area$ ls -l ocpdb
    total 9528
    -rw-r----- 1 oracle oinstall 9748480 2010-10-31 21:09 control02.ctl
    oracle@enalab13:/u01/app/oracle/fast_recovery_area$ ls -l OCPDB/
    total 3
    drwxr----- 5 oracle oinstall 512 2010-10-31 03:48 archivelog
    drwxr----- 3 oracle oinstall 512 2010-10-29 07:44 autobackup
    drwxr----- 3 oracle oinstall 512 2010-10-29 07:43 backupsetWhy am I having a subdir with dbname in uppercase AND in lowercase? Should I specify dbname in uppercase at db creation to have all files under the same directory, or in lowercase? Or, is it normal?
    I want to know how to do it well before reinstalling a fresh database.
    Thanks
    Bruno
    Edited by: blavoie on Oct 31, 2010 6:18 PM
    Edited by: blavoie on Oct 31, 2010 6:20 PM

    Hi,
    I just reinstalled all from scratch, everything in lowercase as well in environment variables and dbname in dbca:
    oracle@enalab13:~$ echo $ORACLE_SID
    ocpdbFast recovery area directories, dates prove that it's my fresh install:
    oracle@enalab13:/u01/app/oracle$ ll fast_recovery_area/
    total 2
    drwxr-x--- 2 oracle oinstall 512 2010-11-02 11:06 ocpdb
    drwxr-x--- 4 oracle oinstall 512 2010-11-02 11:24 OCPDB
    oracle@enalab13:/u01/app/oracle$ ll -R fast_recovery_area/
    fast_recovery_area/:
    total 2
    drwxr-x--- 2 oracle oinstall 512 2010-11-02 11:06 ocpdb
    drwxr-x--- 4 oracle oinstall 512 2010-11-02 11:24 OCPDB
    fast_recovery_area/ocpdb:
    total 9528
    -rw-r----- 1 oracle oinstall 9748480 2010-11-02 11:34 control02.ctl
    fast_recovery_area/OCPDB:
    total 2
    drwxr-x--- 3 oracle oinstall 512 2010-11-02 11:24 archivelog
    drwxr-x--- 2 oracle oinstall 512 2010-11-02 11:06 onlinelog
    fast_recovery_area/OCPDB/archivelog:
    total 1
    drwxr-x--- 2 oracle oinstall 512 2010-11-02 11:24 2010_11_02
    fast_recovery_area/OCPDB/archivelog/2010_11_02:
    total 47032
    -rw-r----- 1 oracle oinstall 48123392 2010-11-02 11:24 o1_mf_1_5_6f0c9pnh_.arc
    fast_recovery_area/OCPDB/onlinelog:
    total 0Some interresting output asked earlier in post:
    SQL> archive log list
    Database log mode              Archive Mode
    Automatic archival             Enabled
    Archive destination            USE_DB_RECOVERY_FILE_DEST
    Oldest online log sequence     4
    Next log sequence to archive   6
    Current log sequence           6
    SQL> show parameter recovery
    NAME                                 TYPE        VALUE
    db_recovery_file_dest                string      /u01/app/oracle/fast_recovery_area
    db_recovery_file_dest_size           big integer 4032M
    recovery_parallelism                 integer     0
    SQL> show parameter control_files
    NAME                                 TYPE        VALUE
    control_files                        string      /u01/app/oracle/oradata/ocpdb/control01.ctl,
                                                         /u01/app/oracle/fast_recovery_area/ocpdb/control02.ctl
    SQL> show parameter instance_name
    NAME                                 TYPE        VALUE
    instance_name                        string      ocpdb
    SQL> show parameter db_name
    NAME                                 TYPE        VALUE
    db_name                              string      ocpdb
    SQL> show parameter log_archive_dest_1
    NAME                                 TYPE        VALUE
    log_archive_dest_1                   string
    log_archive_dest_10                  string
    log_archive_dest_11                  string
    log_archive_dest_12                  string
    log_archive_dest_13                  string
    log_archive_dest_14                  string
    log_archive_dest_15                  string
    log_archive_dest_16                  string
    log_archive_dest_17                  string
    log_archive_dest_18                  string
    log_archive_dest_19                  string
    SQL> show parameter %dump_dest 
    NAME                                 TYPE        VALUE
    background_dump_dest                 string      /u01/app/oracle/diag/rdbms/ocpdb/ocpdb/trace
    core_dump_dest                       string      /u01/app/oracle/diag/rdbms/ocpdb/ocpdb/cdump
    user_dump_dest                       string      /u01/app/oracle/diag/rdbms/ocpdb/ocpdb/traceI think, next time, I'll install everything regarding oracle SID in upper case...
    Maybe it's details that I don't need to care about... I seems that something is happening bad with the management of fast_recovery_area...
    Thanks
    Bruno

  • Question regarding XI/PI and Idoc processing.

    Hi,
    I'm learning XI/PI and I have a question regarding Idoc processing in PI.
    We need to configure communication between our BW system and our PI system using Idocs.
    The Idocs are sent from BW to our PI systems and are then sent back to the BW system, there are no third system involved. The idocs are only between PI and BW.
    Our BW system is already connected with many other R3 systems by using WE20 / WE21 and RFC's and everything works perfectly.
    While I configure this communication between BW and PI it seems that PI is passing the Idoc to the Idoc adapter, converts it to xml and tries to find a receiver for the particular Idoc. I see the error "NO_RECEIVER_CASE_ASYNC" in SXMB_MONI.
    Is this a normal behaviour in PI ? Why is PI thinking that the Idoc needs to be sent to another system when it is infact for itself ??
    Thanks and regards
    Remi

    Hi
    for error "NO_RECEIVER_CASE_ASYNC" in SXMB_MONI.
    This problem may occur due to one of following reasons, so check
    1 service is active in message? transaction SICF and activate service sap/xi/engine (right click, activate)
    2 Is the port 8001 defined in the services on the smicm under services?
    3 Check the roles assign PIDIRUSER
    http://help.sap.com/saphelp_nw04/helpdata/en/56/361041ebf0f06fe10000000a1550b0/content.htm
    role: SAP_XI_ID_SERV_USER attached to it
    Also Check Whether PIDIRUSER has following role
    SAP_SLD_CONFIGURATOR
    SAP_XI_RWB_SERV_USER
    SAP_XI_RWB_SERV_USER_MAIN
    Regards
    Abhishek

  • A few questions regarding SAP EWM and WM

    Hello,
    I have a few general questions regarding the differences between EWM and WM:
    1) What are the benefits of EWM-MFS compared to WM + TRM (especially in terms of SPS)?
    2) The Quality Inspection Engine (QIE) can also be used by SAP WM, right?
    3) There is RFID-support in EWM, so EWM is able to communicate directly with SAP Auto-ID, right?
         But I have heard that SAP PI is necessary in some cases, when and why?
    4) Is there something new in EWM regarding goods receipt processing?
        I have read that the splitting of inbound delivery items is possible in EWM in case of missing inbound delivery items. Is this really  a new feature?
    5) EWM can easily be connected to SAP BW for reporting purposes, what about WM?
    6) What about scalability if the warehouse grows?
    7) Is there any information about the costs of using EWM compared to WM and vice versa?
    I appreciate any kind of help.
    Thank you.
    Dennis

    Hi,
    1. What does SAP offer as a product for dWM? Is it a u201Cspecialu201D installation of the SAP framework dedicated to WM or is it a standard ECC box where only the WM module is used?
    There are two version of DWM. One is Decentralized WM as a part of ECC and another one is EWM as a part of SCM. Both are decentralized.
    2. My understanding is that the interfaces between ERP and dWM can support some non-real time operations (like when the main ERP system is down, the dWM can still perform some operations). Considering that the transactional interfaces are based on BAPIs, how does SAP achieve this interfacing in non-real time environments? I am thinking you can complete the different processing unless both systems are up
    When it comes to interfaces, DWM needs Deliveries from ERP. That's it, WM can function from there independent of ERP system. But, WM defenitely needs to communicate back PGI and PGR and other posting changes . So, in case ERP is down, even though PGI / PGR is done at WM end, they may not be communicated back to ERP. But WM generates PGI/PGR IDOCs which can always be reprocessed at WM end to resend them to ERP so that Inventory levels are accurate.
    Hope that helps
    Thanks
    Vinod.

  • How create Nested Child Nodes in XML Forms

    Hello All:
                        I am very new to XML Forms/KM. I am trying to figure out a way to create Nested Child Nodes schema in XML Forms. Is there a way we can do it?
    Thanks and Regards,
    Vasu.

    Document document;
    NodeList[] dataNodeList=new NodeList[2];
    NodeList nodeList=document.getElementsByTagName("MyData");
    for(int i=0; i<nodeList.getLength(); i++)
    dataNodeList=nodeList.getChildNodes();

Maybe you are looking for

  • Multiple Discovery Systems on the same network

    Is anybody successfully running more than one DS on the same network? We have edited the hostname of the DS but their still seems to be a conflict between the two servers and the SID names cannot be the same as well.

  • Container....What is wrong with this code

              I add 2 buttons and two labels in           an applet.Every thing works fine           but when i add a Container to this           applet i get error during Run time           what might be the problem will any           one help me public

  • Mandatory Fields of an Infotype

    Hi all, I am trying to retrieve the mandatory fields for specific infotypes.Can anyone suggest a code for this??? Just Analyze this scenario.... When we hire one employee using PA40,some screens of various infotypes will be active which contains some

  • How to refer global simple types in another schema?

    Hello All, Any help would be greatly appreciated. My problem is , I have a global.xsd schema which declare simple types such as <xsd:simpleType name="DecimalMin1Max14Places2Type"> <xsd:restriction base="xsd:decimal"> <xsd:totalDigits value="14"/> <xs

  • Upgrade Homehub3 to 4?

    Hi all, BT have offered me a free (except for postage) HH4 to replace my present HH3. I have ADSL giving about 2.4 Mb speed only, as am in a rural location (3.5 Kilometres of overhead wire). The line is a direct exchange line so BT Infinity is not po