XML has Children [wether it has or not]

Hello Guys
<person name="Roshi">
          <children>
               <person name="Roomi">
                    <children>
                         <person name="Andy"/>
                         <person name="Johny"/>
                    </children>
               </person>
               <person name="Hazy"/>
               <person name="sunny"/>
          </children>
     </person>;
When i use following code
if(xml.child("children")){  
trace("it has children");
}else{
trace("it has not");
but even it print "it has children" for Hazy and Sunny who dont have children
I actually want to make a comparision like
Roshi has Children
Roomi Has children
Andy Has not Children etc
for each in loops works good, but i just need to make comparision
Please guide
Thanks in advance

This should help I hope:
//use a wrapper tag to provide access to the top leve person tag
var xml:XML =<wrapper>
          <person name="Roshi">
          <children>
           <person name="Roomi">
             <children>
            <person name="Andy"/>
            <person name="Johny"/>
             </children>
            </person>
             <person name="Hazy"/>
             <person name="sunny"/>
          </children>
     </person>
      </wrapper>;
//try not to use XMLLists as Boolean values, because they are not 'null' and therefore evaluate to true:
if (xml.children.person.(@name=="Roomi")) trace('found Roomi, Great! (or did I?)')
if (xml.children.person.(@name=="Room")) trace('found Room, Great! (or did I?)')
//oh I see, so the XMLList evaluated as a Boolean is wrong...I need to check its length!!!!
if (xml.children.person.(@name=="Roomi").length()) trace('found Roomi, Great! Now I\'m certain')
if (xml.children.person.(@name=="Room").length()) trace('found Room wasn\'t there because the XMLList length is zero, Great! this is correct!')
//now after I understand that, lets try the looping
//get a person list from anywhere in the xml
var myPeople:XMLList = xml..person;
for each(var individual:XML in myPeople){
     var theseChildren:XMLList=individual.children.person;
     var numChild:uint = theseChildren.length()
     trace(individual.@name+" has children ?:"+Boolean(numChild))
     if (numChild) {
          trace ('the '+((numChild>1)? 'children are ':'child is '));
          for each(var directChild:XML in theseChildren) trace([email protected]())

Similar Messages

  • XMLTABLE function not returning any values if xml has attribute "xmlns"

    Hi,
    XMLTABLE function not returning any values if xml has attribute "xmlns". Is there way to get the values if xml has attribute as "xmlns".
    create table xmltest (id number(2), xml xmltype);
    insert into xmltest values(1,
    '<?xml version="1.0"?>
    <emps>
    <emp empno="1" deptno="10" ename="John" salary="21000"/>
    <emp empno="2" deptno="10" ename="Jack" salary="310000"/>
    <emp empno="3" deptno="20" ename="Jill" salary="100001"/>
    </emps>');
    insert into xmltest values(2,
    '<?xml version="1.0"?>
    <emps xmlns="http://emp.com">
    <emp empno="1" deptno="10" ename="John" salary="21000"/>
    <emp empno="2" deptno="10" ename="Jack" salary="310000"/>
    <emp empno="3" deptno="20" ename="Jill" salary="100001"/>
    </emps>');
    commit;
    SELECT a.*
    FROM xmltest,
    XMLTABLE (
    'for $i in /emps/emp
    return $i'
    PASSING xml
    COLUMNS empno NUMBER (2) PATH '@empno',
    deptno NUMBER (3) PATH '@deptno',
    ename VARCHAR2 (10) PATH '@ename',
    salary NUMBER (10) PATH '@salary') a
    WHERE id = 1;
    The above query returning results but below query is not returning any results because of xmlns attribute.
    SELECT a.*
    FROM xmltest,
    XMLTABLE (
    'for $i in /emps/emp
    return $i'
    PASSING xml
    COLUMNS empno NUMBER (2) PATH '@empno',
    deptno NUMBER (3) PATH '@deptno',
    ename VARCHAR2 (10) PATH '@ename',
    salary NUMBER (10) PATH '@salary') a
    WHERE id = 1;
    how to get rid out of this problem.
    Thanks,
    -Mani

    Added below one in xmltable, its working now.
    XmlNamespaces(DEFAULT 'http://emp.com')

  • Jazn-data. xml has 3 errors on newly created portal app

    I just created a new portal app and my jazn-data.xml has 3 errors right off the bat.
    1. element attributes not expected
    2. element functions not expected
    3. Element system-policy not expected
    Why am I getting these errors.

    Are you sure? Cause somebody told me the same thing about my css files. But then somebody suggested I check the ADF Faces Extension and the errors went away and my skins were able to be applied.
    Also I created a user how the Portal Framework tutorial told me too and when I login as that user all the files I am bringing in from the content server won't display, all my panel links disappear and I get this error when I log in as content admin:
    oracle.webcenter.content.integration.RepositoryException: Sep 14, 2012 9:53:59 AM oracle.webcenter.content.integration.spi.ucm.UCMBridge getUCMAccessLevel
    SEVERE: Cannot get security info for node ID: /UCM/0
    Caused by: oracle.webcenter.content.integration.RepositoryException: oracle.stellent.ridc.protocol.ServiceException: Could not calculate the user's permissions. User 'contentadmin' cannot be retrieved.
    Edited by: beachw08 on Sep 14, 2012 6:54 AM
    Edited by: beachw08 on Sep 14, 2012 10:38 AM

  • When I try to import, I receive the following message: "An internal error has occurred: not enough memory".  I always download my photos onto an external hard drive.

    Yesterday,I downloaded an update for Lightroom 5.  Now when I try to import, I receive the following message: "An internal error has occurred: not enough memory".  The message comes up right after I click import, before I choose a file to upload.Here is the information I can think of that might be needed to answer this question:
    - I always download my photos onto an external hard drive.It is about 10 % full.
    - It says I have Lightroom 5.6  64 bit
    - I am working from a newer laptop (Windows).  The internal drive on the laptop has 289 gb and I am using 61 gb total memory.
    - I have edited 2794 photos in Lightroom and it is all in one catalog.
    - I did not have this problem until I made the update.  I did have my first "bug" earlier this week when one of my photos had a line show up through the middle of it when I exported it. I was able to export it a second time without the line.
    If there is more info. needed, let me know.  I do photography as a hobby and know enough about Lightroom to edit out blemishes and adjust color balance, but not too much more, so forgive my ignorance if this is an obvious fix.
    Sincerely,
    Adrianne

    Not Enough Memory typically refers to RAM.  How much RAM do you have on your 64-bit OS computer?  Do you have other programs running that may be using most of the memory?

  • Has anyone not working with .dv files had synchronization problems?

    Has anyone not working with .dv files had sound synchronization problems? I'm not exactly sure what the alternatives to DV are, but I think one of them is HD.
    The reason for asking this question is to help isolate the nature and cause of a very serious flaw in iMovie '11. In the original release of iMovie '11 (version 9.0) there was a small--but serious--synchronization problem. In the 9.01 there is a large synchronization problem. We know of one person who has not experienced the problem, and he is not working with DV files (media). So we want to find out if anyone who is using something other than .dv files is experiencing a lack of synchronization between sound and picture. Knowing the answer to this will help with figuring out where the cause lies. For the initial iMovie '11 release (9.0), you probably would not notice a problem unless you had very long event-clips, e.g., two hours long. Events get this long if you are transferring from analog 8 mm tapes. Even then, it would have to be in scenes in which the connection between event and sound is obvious, e.g., close ups of people talking. It isn't until the 9.01 release that most people would notice anything. All we need to do is establish one case of a synchronization problem in which the person is using something other than DV.
    Message was edited by: Paul Bullen

    Hopefully, the 9.0.2 release will make my question moot. Zyfert must have posted the announcement of the release just as I was formulating my question. Still, if you have information on the subject, it would be interesting to hear.

  • I have an Iphone 4 and the camera shutter wont open, I have tried most things and it has still not opened, it has not worked since I have got it. What should I do?

    I have an Iphone 4 and the camera shutter wont open, I have tried most things and it has still not opened, it has not worked since I have got it. What should I do?

    Here's basic troubleshooting for iOS:
    https://sites.google.com/site/appleclubfhs/support/advice-and-articles/troublesh ooting-ios
    (Note that my links to other pages may promote my organization, and this should not be taken as an endorsement by Apple)

  • TS1424 has anyone not been able to get the installer to properly load and get a message like: This installer is intended for 32 bit versions of windows. Please download and install 64 bit iTuines installer instead? and even if you uninstall and reinstall

    Has anyone not been able to get the iTunes installer to load properly and get a message like this: This iTunes installer is intended for 32 bit versions of windows. Please download and install 64 bit iTunes installer instead. I have tried repeatedly to get this to load, I have uninstalled iTunes completely and reinstalled and still get the same message. I have windows XP and a brand new ipod touch which I am trying to load.

    Yes, it's come up a number of times. If you look to the right under "more like this", you'll find threads that may offer useful suggestions.
    Regards.

  • T.code FBZG: editing of failed payment trans .. Client 400 has state not ..

    Hi All,
    launching t.code FBZG, and filling in, then, the company code,
    I choose the option "enter data and maintain copied data" and select the button "maintain data"
    SAP gives the the pop-up with the message:
    " Client 400 has status 'not modifiable "
    What could it depen on?
    Thanks a lot for Your advices.
    Gandalf

    Hello,
    You have two alternatives:
    1. Recommended
    Call up transaction SOBJ. Click the "Maintain" button
    Postion the cursor on the V_TINSO entry.
    Select the field "Current Settings" (V_OBJ_H-CURSETTINGS).
    Save the Entry.
    If the object category of the view in your system is "APPL" change it to "CUST", before you select the "Current Settings" flag.
    Please refer SAP Note No.387533.
    2. Not recommended.
    You can change the Client Role in Test System to "Production", it would then allow you to enter the data. Before that please consult your Basis Administrator.
    Hope this will help you.
    Regards,
    Ravi

  • The system/systems - SM7, has/have not been registered in SLM

    Hi,
    When I go tx DSWP--> Maintenance Optimizer, it shows the error "The system/systems - SM7, has/have not been registered in SLM"
    Then I click the help of the message and explain this:
    Diagnosis
    In order to download and deploy the support packages to the managed systems, these systems should be registered in SLM.
    Procedure
    1. Run transaction code /TMWFLOW/MOPZCFG;
    2. Start the Multiple Software Lifecycle Manager Configuration Assistant;
    3. Select an SLM or create a new SLM;
    4. Choose "SLM Configuration" and register these systems in the SLM.
    The problem is that tx /TMWFLOW/MOPZCFG does not exists!
    Any clue?

    Hi,
    Thank you it works!
    But now the thing is that I dont know how to configure the SLM.
    Do you have a guide or something like that?
    Regards

  • Client 000 has status not modifiable

    Dear all,
    after installing ABAP and JAVA stacks I can normally
    work in both system (NSP, J2E). I created a RFC function module via se37 to use it as a basis for a web service.
    But when I try to release my web service for SOAP runtime using TA WSCONFIG I always get an error message:  <b>Client 000 has status not modifiable</b>...
    Are there any restrictions or did I make a mistake?
    Thank you

    hi Harald,
    Did you make a client copy after your ABAP installation? SAP doesn't allow you to work on 000 client. so you need to make a copy of 000 (say 111 or any other number)and continue to install your JAVA Stack on this CLIENT. i guess you had put your JAVA stack on 000 itself. that's the problem.
    Just make a new client or "Client Copy". and Put a java stack on that client. Remove the old java stack. This should solve your problem.
    Regards
    Arun

  • Liar Firefox: I have download and install Acrobat Reader 11.0.0 few minutes ago and Firefox still telling lies that Acrobat has in not current version.

    Liar Firefox: I have download and install Acrobat Reader 11.0.0 few minutes ago and Firefox still telling lies that Acrobat has in not current version.

    Have you rendered both iOS 7 and iOS 8 (both of which will work on your iPhone 5) out of the question entirely without trying every possible configuration? The animations can be disabled entirely, if that's the problem. And if the whiter-brighter user interface is the problem, there's reverse-contrast modes that darken everything. You can expose accessibility controls to gain immediate access to these functions to toggle them on and off. I guess my point is you may have decided against upgrading the OS based on an early experience with iOS 7 when Apple has since made changes in later revisions to address some of the usability complaints.
    Now, Apple's instructions for downloading older versions of apps is to do so from the Purchased list, not from the app's product page.
    See here:
    Install the latest compatible version of an app on an earlier version of iOS or OS X - Apple Support
    Let us know how that works for you.

  • WRT160NL NAS error why has linksys not fixed it yet?

    Every once in a while, my linksys router keeps locking up on the "storage" page. It will do so until I disconnect my hd from the router, plug it into a computer, and delete the twonky information.  I'm waiting on the next firmware patch to come out as I've already talked to customer support. 
    Why has Linksys not fixed this yet and what are they waiting for? There's a ton of problems in the WRT160NL that need correction!

    What is the Model no of the HDD you are using.Check this link for the compatible HDD for WRT160NL....Try to hard-reset the router for 1 minute,power cycle the router and reconfigure it from the scratch.

  • Why has photostream not deleted my photos?

    Why has photostream not deleted my photos yet as it has been over 30 days since they were streamed?

    Try the iCloud forum

  • CLIENT 600 HAS STATUS NOT MODIFIABLE

    Hi SDN,
    I gotone problem related to SM30.While user trying to upload the table he will get the message like <b>CLIENT 600 HAS STATUS NOT MODIFIABLE</b>. Could you please provide me the solution and reason for this message? I will be very great ful and thank ful for the answers..
    Appreciation for the answers..
    Regards,
    Kumar

    Hi,
    This thread has answer to your question...check it out...
    How do SM30 Update when client is "not modifiable" ?
    assign points if helpful...

  • Tables can be maintained even though Client has status 'not modifiable" ?

    I am looking, list of tables which i can maintain directly even though "Client has status 'not modifiable'" status
    example : T000
    Rgds

    No ..No...Siddesh,
    You are understanding my requirement in reverse.
    We are now not in execution of giving the access.
    i regret, if i am failing to explain my requirement
    A Auditor wants
    a). He wanted to know the users having S_TABU_DIS auth object with 02 value and assigned authroization groups.
    b). He wanted list of tables including Z tables that can be maintained directly thru maintenance view
    Auditor will do some excerse Directly Maintained Tables (vs) Authroized users
    He will come back with a list of tables for which we have to give the logs.
    I tried my best to explain my requirement.
    To summarise  - I repeat  i am looking  "List of Tables that can be maintained directly - When Client has status 'not modifiable" ?
    Thanks in advance for your time for this query.
    Rgds

Maybe you are looking for

  • Have a MacBook Pro. the computer will not boot up, the screen has black and white stripes and multi color bands as well.

    Have a MacBookPro. The computer will not boot up. the screen has black and white bands with multi color bands as well.

  • Looking for some one who can help me in SUN IDM

    Hi Friends, I am looking for some one who can help me to learn sun IDM. Off couse I will pay for your time. I can be reached at [email protected] Please let me know if you have some time Thx

  • Component Interface problem

    Hi, I am creating a new component interface based on the component LANGUAGES_CMP using the application designer. It comes up with a red X on the PROPERTIES. On the bottom of the screen, it says "Found Error, please review Component Interface structur

  • Where can i get info abt deadlocks

    Hi , I want to get some info abt dead locks and when it happen.I have one scenario where 4-5 process writing to the same table at the same time.I want to find out how the process is gng to effect if i ncrease parallel processes. Thanks Anand

  • FM to create Qualification

    Hi I am trying to create qualification in Infotype 0024 for a person. I tried using FM <b>"HR_INFOTYPE_OPERATION"</b>. But saying complex error occured. is this the FM to create qualification or some other FM is there. please suggest. Also i cant see