Is this Node retrieval optimal

Hello all I have the following xml document
<?xml version="1.0" encoding="utf-8" ?>
<iptablesfile name="Untitled.xml">
<CHAIN name="ACCEPT">
<RULE>Lets</RULE>
<RULE>OK</RULE>
</CHAIN>
<CHAIN name="REJECT">
<RULE>Whatever</RULE>
<RULE>Day</RULE>
</CHAIN>
<CHAIN name="FORWARD">
<RULE>Light</RULE>
<RULE>Cancel</RULE>
</CHAIN>
</iptablesfile>
And the following code to get the values from this document
Element root = document.getDocumentElement();
root.normalize();
NodeList list = root.getElementsByTagName("CHAIN");
Node fileName = list.item(0).getParentNode();
System.out.println(((Element)fileName).getAttribute("name"));
for (int i = 0; i<list.getLength(); i++){
     Node n= list.item(i);
     if(n.getNodeType() == ELEMENT_TYPE){
          System.out.println(i+"-"+((Element)n).getAttribute("name"));
     NodeList ipRules = ((Element)n).getElementsByTagName("RULE");
     for (int x = 0; x< ipRules.getLength(); x++){
          Node w = ipRules.item(x);
          System.out.println((w.getChildNodes()).item(0).getNodeValue());
And the question is, how optimal is this, I feel this is very redudant code.
Thank you for any help,
Gyftus     

<?xml version="1.0" encoding="utf-8" ?>
<iptablesfile name="Untitled.xml">
<CHAIN name="ACCEPT">
<RULE>Lets</RULE>
<RULE>OK</RULE>
</CHAIN>
<CHAIN name="REJECT">
<RULE>Whatever</RULE>
<RULE>Day</RULE>
</CHAIN>
<CHAIN name="FORWARD">
<RULE>Light</RULE>
<RULE>Cancel</RULE>
</CHAIN>
</iptablesfile>
And the following code to get the values from this document
Element root = document.getDocumentElement();
root.normalize();
NodeList list = root.getElementsByTagName("CHAIN");
Node fileName = list.item(0).getParentNode();
System.out.println(((Element)fileName).getAttribute("name"));
for (int i = 0; i<list.getLength(); i++){
Node n= list.item(i);
if(n.getNodeType() == ELEMENT_TYPE){
System.out.println(i+"-"+((Element)n).getAttribute("name"));
NodeList ipRules = ((Element)n).getElementsByTagName("RULE");
for (int x = 0; x< ipRules.getLength(); x++){
Node w = ipRules.item(x);
System.out.println((w.getChildNodes()).item(0).getNodeValue());
}

Similar Messages

  • *The operation cannot be carried out with this node type*

    Hi Friends,
    My requirement is :
    PO in IS retail system--(IDOC ORDERS)--Sales Order processing-->Sales order in AFS system
    where AFS is apparel footwear solution used in retail industries.
    Now I have created PO in IS-retail system , and IDOC is successfully generated .
    After this I am checking this IDOC in AFS system thru  tcode BD87 for processing but getting error mesage in next screen when I am executing BD87 after putting the IDOC number.
    The operation cannot be carried out with this node type
    Message no. B1891
    Diagnosis
    Node types such as logical system, inbound and outbound IDocs or filter nodes are used only for the structure and for information. They cannot
    be used for processing and display functions.
    Any pointers .
    Regards
    Ashu

    a

  • Error 'this.node.parentNode is null or not an object' with search highlight in certain topics

    goto
    http://www.afas.nl/profithelp/2_8_2/SE/index.htm
    Click 'zoeken' (search)
    Be sure that 'Zoekresultaten markeren' (search highlight) is
    checked
    Type 'activa'
    Click the topic 'activa'
    An error is displayed in the bottom left corner:
    'this.node.parentNode is null or not an object'
    If search highlight is not used, the error is not displayed.
    Any ideas?

    I think I have it, but it's almost unbelieveable.
    In the activa topic, the word is highlighted up to a point.
    Coming to the next instance of activa, you have this code:
    <li class=p-BulletedList><p
    class=BulletedList><b><span style="font-weight:
    normal;">V:</b> v</span>aste activa waarop wordt
    afgeschreven (Dit is de standaard waarde) . . . </p>
    Note the superfluous <b> and </b> tags,
    especially with the <span> calling for normal font-weight.
    Suppose this is a valid string. Because the opening tags are
    <b><span . . .>,
    the closing sequence should be
    </span>...</b>
    I'm not sure exactly why the error does what it does.
    Perhaps this is a simple html error that happens to come in
    an awkward place, or
    Because the browser expects </span> first, it treats
    </b> as text, so the <b> never gets closed, which
    confuses the search highlight script.
    I've run into something like this before. Repeated
    application, changes and deletion of font attributes in
    approximately the same place sometimes results in confused tags.
    Similarly, when you apply a build tag to styled text, and perhaps
    change the font attribute, opening and closing tags get confused.
    It may depend on the precise locations where you started and ended
    your highlights during editing.
    You'd expect this to be a harmless html error, but in this
    case, it breaks the highlight code, I believe.
    You're in a better position to test this than I am, so I
    await your results.
    Harvey

  • Unable to save a recordset - Type Error this node has no properties

    I've hit a brick wall.
    I'm creating a recordset using a session variable as a parameter. It tests OK in
    DW CS4 but when I click <OK> it fails with an error message  "Type Error this node has no properties".
    Below is the recordset I'm trying to save
    Below is the error message I receive
    I had this problem previously and was referred to a thread regarding a corrupted cache file. So, I deleted the cache and it failed again. I tried deleting cache a second time just to be sure I did it right and it failed again with the same results. So then I tried deleting the configuration folder and it still fails the same way.
    Does anyone have any suggestions? I'm running DW CS4 on Win 7., the page is a php page and the db is MySQL.
    Thanks
    Tony

    I think I solved my own problem. Just in case anyone else has a similar problem here's what I did.
    I had created the php page by copying and renaming a similar page, I then removed the previous recordset and tried adding the new one, this was when it failed.
    I checked the Server Behaviors and found a behavior that my new page did not need, once that was deleted I was able to create the new recordset.

  • Http service unavailable on this node

    Hi All,
    Just a question for anyone who has seen this at all.
    (Might be staring me in the eyes!)
    I http to Fabric Interconnect (A) and java works fine. Type in the uname and password and log in to UCSM
    I http to FI(B) and java work also fine prompting me for a uname and password. Once done I get an error message saying
    "Http service unabailable on this node"
    So then I log into the cluster address, log in to UCSM and check out the admin settings for http. They are bot enabled.
    I then putty into each FI and do a status of http and https for both FI's. THey show as enabled.
    If http is enabled on both FI's why is it that I can log into UCSM on one and not the other?
    gd

    UCSM will only allow you to log into the Virtual IP when setup in a cluster configuraiton.  Though you can SSH to either FI directly, you should only ever access UCSM from the Cluster IP.
    Robert

  • Trying to Create Recordset - "TypeError: this.node has no properties"

    Hi,
    First the BACKSTORY:
    I created a database in myphpadmin and then created two tables within it.
    Back in Dreamweaver, I created a couple of recordsets and that worked fine. BUT - when I tested a form I had created, I got a message in the Firefox window saying that a particular column could not have a null result. (This particular data was in the form as a pull down menu. There was no way to leave the thing blank, so how could there have been a null result)?
    To correct this, I went back to myphpadmin and tinkered with the tables a bit by trying to imitate a database that seemed to work okay.
    MAIN QUESTION:
    Again I returned to Dreamweaver, where I deleted the original recordsets and tried to create them from scratch again. This time when I tried to close the recordset dialog box, I got this message: "TypeError: this.node has no properties."
    Does anyone know what this is about? (Any help on the first issue in the "BACKSTORY" would be much appreciated too).
    Thanks in advance,
    Dave

    I believe I answered my own question, though I'm not sure why it worked. If anyone has the same problem, maybe this will work for them too. I went into the server behaviors panel and deleted all the behaviors that seemed to be the result of my previous actions (which were all the behaviors there). This deleted code on the page as well. I hope this helps others.

  • OWA doesn't work on all servers! "Use the following link to open this mailbox with optimal performance:"

    Hi All,
    I am having a problem with OWA. I have 3  2007 exchange servers on 3 different sites on the same AD Forest. My emails work fine internally and externally with outlook. I have setup Outlook Anywhere on Server No1 with external email address:
    https://mail.company.com/owa
    Everybody can login fine.
    I have setup OWA on the other 2 servers with the same address, but when a user from that site tries to login gets the following message:
    "Use the following link to open this mailbox with optimal performance:"
    So the can't see their emails!
    Please help me out as I am trying to solve it for days now and I can't find out what is wrong! 
    Thank you All!
    Akitan

    Hi Akitan,
    From your description, CAS server 1 is exposed to the Internet. Other two non-Internet-facing Active Directory sites rely on the Internet-facing Client Access server 1 to proxy all pertinent requests from external clients. If I have misunderstood your concern,
    please let me know.
    In your case, I recommend you ensure that Integrated Windows authentication for OWA virtual directory is enabled.
    What's more, here is a helpful thread for your reference.
    CAS Proxy between sites of OWA /Exchange Virtual directory
    http://social.technet.microsoft.com/Forums/exchange/en-US/895a304f-8fb1-4909-8b48-480a7303afd4/cas-proxy-between-sites-of-owa-exchange-virtual-directory?forum=exchangesvrclientslegacy
    Besides, if your issue is urgent, you can connect Microsoft Support. For your convenience:
    https://support.microsoft.com/?ln=en-us&wa=wsignin1.0
    Anyway, if you still want to solve your issue on the forum, I will continue to help you.
    If you need further assistance, please feel free to let me know.
    Best regards,
    Amy
    Amy Wang
    TechNet Community Support

  • HIERARCHY_REQUEST_ERR: This node isn't allowed there.

    I have to obtain this hierarchical result
    <a>
    <b>
    <c>
    <b>
    <c>
    <b>
    <text>azerty</text>
    </b>
    </c>
    </b>
    </c>
    </b>
    </a>
    But, when i tried to append the tag "c" to "b", i have this exception : HIERARCHY_REQUEST_ERR: This node isn't allowed there.
    Some one know how to build a hierarchical structure?
    Please help

    Hello,
    Try to give some other name for node instead of repearting the same node name that may be the reason its not idetifying the node correctly.
    Thanx

  • EIONode.xnode the governing library for this node cannot be found

    I have a question concerning the LabView FPGA I/O-Node.
    I want to use an FPGA I/O-node to analyze data coming from an analog input. But everytime I try to insert the I/O-node into my vi, LabView tells me it cannot find the file "EIO_TerminalDirection.ctl", which seems to be needed by "EIONode.xnode", if i got it right.
    Some time ago, i could actually use this node without any problems. I'm not sure, but i think in the meantime i did a mass compile on the whole LabView directory, because LV kept asking me to do so (i had several other problems then, which disappeared after the mass compile)
    If you have any ideas, anything, please post, because i cannot find any hints anywhere and i do NOT want to install the whole environment again!

    Hello choluteca,
    wich LV version do you use? Did you try to repair the LV version? Open system control  under XP (Start/Programme/Systemsteuerung). Switch to entry software and move to National Instruments (repair). Please do this for lv, lv fpga and lv rio and try again the LV FPGA I/O node.
    Kind regards,
    Elmar

  • This accessory is optimized for iphone/no music while charging in car

    I have an iPhone 3GS when I charge in my car I get a message this accessory not optimized for IPhone.  What does this mean?  Secondly, while charging on this charger I get no sound when trying to listen to music. Thanks for your help in advance

    I would highly doubt that the battery pack and car charger would both be defective!
    I said no such thing!
    I said if you are using the same cable with both devices, it is probably the cable.
    I also said this can also mean your iPhone's dock connector port has some damage - likely due to mositure damage.

  • Partial document/node retrieval with DOM

    I have constructed a DOMDocument of an XML input:
    - <email>
    - <folder name="inbox" id="">
    - <message id="54321">
    <time_received>2003-07-16 09:30:05</time_received>
    <sender>John St.</sender>
    <to> "aaa"</to>
    <to>"bbb"</to>
    <importance>High</importance>
    <subject>My subject</subject>
    <body>THis is great</body>
    </message>
    - <message id="12345">
    <time_received>2003-07-16 09:30:10</time_received>
    <sender>Tim Rice</sender>
    <to>"ccc"</to>
    <to>"ddd"</to>
    <subject>My subject 2</subject>
    <body>THis is great 2</body>
    </message>
    </folder>
    </email>
    I created a getter method which retrieve value using the tag, like
    get("to") returns "aaa", and another get("to") returns "bbb"
    I use getElementByTagName(...) to do this, but the problem is that
    another get("to") will return "ccc". As you can see for the XML file, this
    is not good because the "ccc" is within next "message" tag.
    I want to provide another method to let the user select within which "message"
    the getter method is functional.
    I seemed to me that I have to create some "partial" doc pointing to the sub-nodes.
    but I don't know how to do it, anyone has some idea about this?
    besides, XPath seems can deal with it , but I am not allow to use it...
    Thanks in advance!

    I'm not sure I follow, but I would consider creating your own objects that represent messages, and iterate through your xml/dom with xpath to build your objects. then get rid of the dom document and work with your collection of "message" objects. I just use DOM as as part of an adapter to convert xml data into the applications object model - abstract out the xml/dom dependencies from your app logic.

  • Tree node retrieving data for the 1st node only for 3 data blocks ?!

    Hello alllll
    i have 3 DATA BLOCKS MAster-Detail-Detail ; GL_TYPES -< GL_ACCOUNTS -< GL_COMPANIES
    The Rel between 1 & 2 is
    GL_ACCOUNTS.TYPE_ID = GL_TYPES.TYPE_IDThe Rel between 2 & 3 is
    GL_COMPANIES.ACCOUNT_ID = GL_ACCOUNTS.ACCOUNT_IDi also have a Treewhich is retrieving data in the opposite data blocks the following code used in WHEN-TREE-NODE-SELECTED Trigger and it works fine but not for every node ;
    the node selected shows data for the first node only; Say Assets but if i selected any other node it doesn't return any data ?
    could any boady pls explain to me why is that happening ?
    The following code is:
    DECLARE
            htree ITEM;
            NODE_VALUE VARCHAR2(100);
    BEGIN
    IF :SYSTEM.TRIGGER_NODE_SELECTED = 'TRUE' THEN 
    -- Find the tree itself.
    htree := FIND_ITEM ('BL_TREE.IT_TREE');
      NODE_VALUE := FTREE.GET_TREE_NODE_PROPERTY( htree, :SYSTEM.TRIGGER_NODE ,  Ftree.NODE_VALUE );
      GO_BLOCK ('GL_ACCOUNTS');
       set_block_property('GL_ACCOUNTS', DEFAULT_WHERE, 'GL_ACCOUNTS.ACCOUNT_ID = '  ||
       ftree.get_tree_node_property('BL_TREE.IT_TREE', :SYSTEM.TRIGGER_NODE, FTREE.NODE_VALUE));
    EXECUTE_QUERY;
    END IF;
    END;
    Regards,
    Abdetu...

    Hello Ammad Ahmed
    Thanks really for reply ,i appreciate... :)
    Can you explain little more what is the meaning of this?a tree block on canvas beside 3 data blockS out of 2 tables as follows
    SQL> desc GL_ACCOUNTS
    Name                                      Null?    Type
    ACCOUNT_ID                                NOT NULL NUMBER(10)
    TYPE_ID                                   NOT NULL NUMBER(1)
    ACCOUNT_NAME                              NOT NULL VARCHAR2(100)
    IS_CLOSED                                 NOT NULL NUMBER(1)
    ACCOUNT_ID_PARENT                                  NUMBER(10)
    SQL> desc GL_COMPANY_COA
    Name                                      Null?    Type
    ACCOUNT_ID                                NOT NULL NUMBER(10)
    COMPANY_ID                                NOT NULL NUMBER(2)only table GL_ACCOUNTS has a self rel so on data blocks on forms i have out of these 2 tables 3 data blocks in the following order
    GL_ACCOUNTS_PARENT on GL_ACCOUNTS has a where clause on it's property;
    account_id in ( select distinct account_id_parent from gl_accounts ) on GL_ACCOUNTS_PARENT block i am displaying on 1 row:
    1. the account_id ,
    2. the account
    3. name and account_type_name in a LOV
    on the second block GL_ACCOUNTS depending on the GL_ACCOUNTS table also am displaying muti rows :
    1. the account_id ,
    2. the account
    and a relation on form
    GL_ACCOUNTS.TYPE_ID = GL_ACCOUNTS_PARENT.TYPE_ID AND
    GL_ACCOUNTS.ACCOUNT_ID_PARENT = GL_ACCOUNTS_PARENT.ACCOUNT_IDon the third block GL_COMPANY_COA depending on the table GL_COMPANY_COA
    am displaying the company_id & company_name in multi_rows
    GL_COMPANY_COA.ACCOUNT_ID = GL_ACCOUNTS.ACCOUNT_ID
    how the data will be looking in data blocksam using the following link -> Large trees - using partial tree population
    http://andreas.weiden.orcl.over-blog.de/article-29307730.html
    PROCEDURE PR_FILL_TREE IS
        CURSOR crTop IS
          SELECT ACCOUNT_ID VALUE,
                 ACCOUNT_NAME LABEL
            FROM GL_ACCOUNTS
           WHERE ACCOUNT_ID_PARENT IS NULL
           ORDER BY type_id, ACCOUNT_id;
        nd FTree.NODE;
      BEGIN
          Ftree.DELETE_TREE_NODE(itTree, FTree.ROOT_NODE);
          FOR rec IN crTop LOOP
              nd:=FK_ADD_NODE(Ftree.ROOT_NODE, rec.VALUE , rec.LABEL);
              PR_QUERY_DETAILS(nd, rec.VALUE);
          END LOOP;
      END;
      if any unclear... pls notify me...!
    Regards,
    Abdetu...

  • Hierachy parent node retrieval

    Hi,
    I wanted to get the parent node name for the given node. Suppose If I go to Hierarchy table of profit center and enter a node name, it will display the parent id. from there, I would like to get the parent id's node name. How is it possible? is there any function module which gives the parent node if we give the node name ? I have checked the below function modules but not got  the required output.
    RRH1_HIERARCHY_HELP_VALUES_GET
    RSNDI_SHIE_STRUCTURE_GET3
    Please let me know if you have any ideas on this.

    Hi,
    check the following link:
    http://help.sap.com/saphelp_nw04/helpdata/en/80/1a6729e07211d2acb80000e829fbfe/frameset.htm
    plus check the following threads, they explained good.
    Hierarchy Loading from R/3 to BW
    How to create a hierarchy datasource in R/3

  • Uncaught NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node. VM29 edge.5.0.0.min.js:56

    Hi,
    I've come across this error whenever I try to move around the layers on an edge project. As a result the edge animate .an file becomes corrupt and I cannot go back to the file.
    Some more notes:
    I created a new file in Edge Animate using the 2014 October update.
    I've removed any external scripts.
    I'm use web fonts.
    Please help

    Hi haddadme,
    Is it possible to share the project files with us? Would help to repro this issue on our side and trouble shoot.
    Regards
    Vinod Menon
    Edge Animate Team

  • This node already exists: /content/geometrixx/en

    Hi,
    While I try to login from the geometrix site login page,  Im getting the below exception.We have our own authentication handler and we tried to apply that to geometrixx site, and we restricted the /content/geometrixx/en ,so now all the pages under en will be restricted now.So, If I try to access /content/geometrixx/en.html , I will be redirected to login.html, so that I need to give my credentials there and login.We are using closed user group to implement the authhandler.But when I give the credentials it is giving the node already exixts exception. May I know what does "node already exists" mean.
    Thanks,
    Balaji

    First of all its 500 so plz check the error.log if you are getting any exception.
    Suggestion:
    Are you submitting the form using method "POST" to custom servlet? if yes, then when you submit then better try to submit form request using method "POST" to current page (POST selector) and then proceed from there else use "GET" to submit to custom servlet ("SlingAllMethodsServlet)"

Maybe you are looking for

  • Why i can't add a library with remote?

    Hi everybody, i recently try to add a library to the remote app on mi ipod and it get stuck in the final step. For add a the library i opened the remote app and selected "add a library", the code apeared in the screen and i serch the remote in itunes

  • Creating DMP template in Dreamweaver

    Hi, I'm trying to set up a template in Dreamweaver to play on several DMP's. All the elements work on playback apart from the video. The same video works when I run it via the digital media designer but I don't like using that. Can anyone help

  • Tabular Model Best Practice - use of views

    Hi, I've read in some sites that using views to get the model data is a best practice. Is this related to the fact tables only right? Friendly names can be configured in the model, so views can be used to restrict data volume but besides from that wh

  • T430 left palmrest clicking/snapping sound

    I just received a new T430 less than a week ago, and ever since I first handled it, the left palmrest has been making clicking/snapping sounds even under light pressure. This region of the palmrest appears to be above the SmartCard reader. Video of t

  • Tethered shooting with Aperture 3

    The Ap3 User Manual indicates that all cameras that have RAW support in 3.0.1 may be tethered for studio work (page 167). Having used Ap since the beginning, I was really hoping this to true. Not the case for me. The pop-up says "no camera detected",