XML has children [whether or not he has]

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 ("he has children");

} else {}

trace ("there no");

}

But even she print 'there children' for foggy and Sunny who don't have no children

I really want to make a comparison as

Roshi has children

Eric has children

Andy's not children etc.

Each loop works well, but I just need to make the comparison

Please guide

Thanks in advance

This should help hopefully:

//use a wrapper tag to provide access to the top leve person tag

var xml:XML =
          
          
           
             
            
            
             
            
             
             
          
     
      ;

//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]())
     }
}

Tags: Adobe Animate

Similar Questions

  • How the transmitter unit will indicate whether or not it has finished sending a message for TCP/IP other network protocols?

    How the transmitter unit will indicate whether or not it has finished sending a message for TCP/IP other network protocols?

    Hello

    I suggest you post your query in the TechNet Forums for assistance.

    http://social.technet.Microsoft.com/forums/en-us/w7itpronetworking/threads

    It will be useful.

  • How to check whether or not the value is already in the collection

    Hello

    I'm in the analysis of a donkey of xml file assigning values to the collection.
    For each new record, that I am available for capture of xml, I need to check if this value already exists in the collection or not, and then only I must add this value to the collection.
    How we do that. I am not able to check whether or not it is already present in the collection. Help, please.

    Here is my code


    TYPE tab_A_type_rec IS RECORD)
    Name Varchar2 (50);
    );

    TYPE tab_A_type IS TABLE OF THE tab_A_type_rec;

    pkv_A_tab tab_A_type: = tab_A_type ();


    l_nl: = dbms_xslprocessor.selectnodes (dbms_xmldom.makeNode (l_doc), ' / / List "");
    for cur_rec in 0... dbms_xmldom.GetLength (l_nl)-1 LOOP
    l_n: = dbms_xmldom.item (l_nl, cur_rec);

    pkv_A_tab.extend; -----
    pkv_A_tab (pkv_A_tab. (Last). Name: = dbms_xslprocessor.valueOf (l_n,'Name / text () '); -I have to do these two steps only after checking whther that value is already present in the collection pkv_A_tab or not... What will be the stated case.

    end loop;


    Thank you
    Pramod

    Peter Gjelstrup wrote:

    Then in the final use TOGETHER to eliminate duplicates.

    The only problem - cannot use SET operator nested table records ;) or even on a table nested objects, unless the object type has map/delivery orders. Now if in real life, record type has only one attribute - NAME OP can just create type of TABLE OF VARCHAR2 (50). Then:

    SQL> declare
      2      type tab_A_type is table of varchar2(50);
      3      pkv_A_tab tab_A_type := tab_A_type('A','B','C','A','B','C','D');
      4  begin
      5  if 'B' member of pkv_A_tab
      6    then
      7      dbms_output.put_line('Found B.');
      8  end if;
      9  pkv_A_tab := set(pkv_A_tab);
     10  dbms_output.put_line('List of distinct elements:');
     11  for i in 1..pkv_A_tab.count loop
     12    dbms_output.put_line(pkv_A_tab(i));
     13  end loop;
     14  end;
     15  /
    Found B.
    List of distinct elements:
    A
    B
    C
    D
    
    PL/SQL procedure successfully completed.
    
    SQL>   
    

    SY.

  • Question on the issue of whether or not a site is secure

    HI -.

    I had a question about whether or not a site is secure.

    With Internet Explorer it will say https:// and there will also be a closed padlock.

    With Firefox, it says https://, but I do not see a padlock anywhere.

    I just wanted to be sure that it always passes through a secure site, even without the padlock.

    Is there anything else I should check or I'm OK as long as there is the letter ' after 'http '? -even if there is no padlock?

    Thank you
    Randy

    Padlock

    Therefore, the lock is more part of Firefox; It has been removed from Firefox 4. The padlock shows that there is a secure connection, but does not provide any additional information. You could make a typographical error, and have always been connected to a secure connection. The lock was replaced in Firefox 3 with the Site identity button. Familiarize yourself with the Site identity button at the left end of the address bar:

    You can install this module if you want:

    http:// and https://

    The Protocol (http://) was removed from the URL in the location bar for http:// only pages in Firefox 7 and newer versions. Secure pages will always show the https:// Protocol. This can be confusing for some users. There is also a bug known, where if you copy the URL after selection of the awesome bar dropdown (but before loading the page) it does not include the http:// part.

    Users can revert to the old behavior (showing http://) by setting browser.urlbar.trimURLs to false in about: config

    1. type of topic: config in the URL/address bar and press the Enter key
    2. If you see a cautionary, accept it (promise to be careful)
    3. Search = browser.urlbar.trimURLs
    4. Double-click the pref in the lower panel of toggle it on 'false' OR , do a right-click on the pref in the lower panel, then choose "Toggle" switch it on "false."
    5. close the topic: config tab

    If this answer solved your problem, please click 'Solved It' next to this response when connected to the forum.

    Not related to your question, but...

    You may need to update some plug-ins. Check your plug-ins and update if necessary:

  • IPad disabled with thousands of pictures of children that are not backed up with iTunes or icloud. Recommendations for the recovery of photos please?

    IPad disabled with thousands of pictures of children that are not backed up with iTunes or icloud. Recommendations for the recovery of photos please?

    Sorry, but if your device is disabled and you have no backup, then you won't be able to save the data on the device:

    https://support.Apple.com/en-us/HT204306

    You should back up your device regularly to iCloud or import your photos to an application on your computer. Otherwise, you will be risking losing those photos. If your device has been lost, stolen, or crushed by your car, you'd be in the same situation. Really sorry for your photos.

    Good luck

    GB

  • How to get the connection to the back icon in my taskbar. It allows to be there and I could quickly see whether or not I was connected.

    It allows to be there and I could quickly see whether or not I was connected. I use vista.

    Hello

    do you mean the network notification icon?

    If Yes, read this:

    There are different ways to fix it

    read all the information on the link below

    Try Method 1 or 3

    Method 1. :

    1. right click on the taskbar and click Properties.

    2 tab Area of Notification .

    3 check the (on) or disable (off) the options you want or do not want to display on the Taskbar Notification area

    Method of reading 3 etc. in the link below

    How to enable or disable the Notification area system icons in Vista

    http://www.Vistax64.com/tutorials/106787-notification-area-system-icons.html

  • If I have Windows Embedded POSReady 2009 license can I install Windows Embedded POSReady 7 on my device? Whether or not I need a license document saying that.

    If I have Windows Embedded POSReady 2009 license can I install Windows Embedded POSReady 7 on my device? Whether or not I need a license document saying that.

    You should ask on the forum dedicated Windows Embedded:

    TechNet - Windows Embedded - Microsoft forums

  • check whether or not a concurrent request is complete the backend

    Hi all
    I want to check whether or not the competing applications is complete the backend using the API. I discovered that FND_CONCURRENT.wait_for_request can be used, but inside this procedure they use dbms_lock.sleep command to delay treatment. I used the same dbms_lock.sleep in my code, but does not correct results.
    Please you siggest me on solutions workaround that needs to be done to get the exact time of the concurrent request will have to fill.


    Thank you and best regards,
    Mahesh

    Hello

    You can get the same information in table FND_CONCURRENT_REQUESTS (API of FND_CONCURRENT of the readings of the same table).

    If you want to continue to use an API, see if you can use FND_CONCURRENT. GET_REQUEST_STATUS (Please check if it is a public API).

    Kind regards
    Hussein

  • ORA-31011: analysis XML has not, someone can like me wats wrong in this code

    Hi all

    I am trying to parse an XML document, for which I wrote a code on the XML parsing.

    I'm moving to an XML document, which will be in a format, I can't change that.

    Now, I have to get values to individual items such as FROM_USERID and TO_USERID, and MESSAGE.

    Here is the code

    create or replace procedure myparsing is
    new_msg_str varchar2 (4000);
    XMLType new_msg_xml;
    v_from_user varchar2 (8);
    v_to_user varchar2 (8);
    v_msg_tmp varchar2 (4000);
    v_msg varchar2 (4000);
    payloadxml varchar2 (2000);
    Chat.objmessage_typ MyMsg;
    n number;

    getvalueat function)
    NodeList dbms_xmlDom.DOMNodeList, xPath varchar2)
    VARCHAR2 is back
    Start
    Return to dbms_xslprocessor.valueOf (dbms_xmldom.item(nodelist,2),
    XPath);
    end getvalueat;

    analysis of procedure (xmlpayload varchar2) is
    doc dbms_xmlDom.DOMDocument.
    parser dbms_xmlparser. Analyzer;
    nodeList dbms_xmlDom.DOMNodelist;
    Testdoc varchar2 (2000);
    Start
    Parser: = dbms_xmlparser.newParser;
    dbms_xmlparser.parseBuffer (parser, xmlPayload);
    doc: = dbms_xmlparser.getDocument (parser);
    dbms_xmlparser.freeParser (parser);
    nodeList: = dbms_xslprocessor.selectNodes)
    dbms_xmlDom.makeNode (doc),'/ CAT. OBJMESSAGE_TYP');
    MyMsg: = objmessage_typ (null, null, null);
    MyMsg.from_userid: = getValueAt (nodeList, 'FROM_USERID');
    MyMsg.to_userid: = getValueAt (nodeList, 'TO_USERID');
    MyMsg.message: = getValueAt (nodeList, 'MESSAGE');
    end analysis;

    Start
    payloadXml: = ' <? XML version = "1.0"? >

    < CAT > OBJMESSAGE_TYP > < FROM_USERID > abcdabcd < / FROM_USERID >

    me < TO_USERID > < / TO_USERID > < MESSAGE > HI this IS SOME

    MESSAGE < / MESSAGE > < / CAT. OBJMESSAGE_TYP > ';
    Parse (payloadXml);
    v_from_user: = mymsg.from_userid;
    v_to_user: = mymsg.to_userid;
    v_msg: = mymsg.message;
    MyMsg: = objmessage_typ (null, null, null);
    v_from_user: = ";
    v_to_user: = ";
    v_msg: = ";
    end;


    I get the error message

    SQL > start
    2 myparsing();
    3 end;
    4.
    Start
    *
    ERROR on line 1:
    ORA-31011: XML parsing failed
    ORA-19202: an error has occurred in the processing of XML
    LPX-00231: invalid character 46 ('.) ') in a name a Nmtoken
    Error on line 4
    ORA-06512: at "XDB". DBMS_XMLPARSER', line 156
    ORA-06512: at "CAT. MYPARSING', line 27
    ORA-06512: at "CAT. MYPARSING', line 43
    ORA-06512: at line 2


    Can someone like me whats wrong in this code and the things I need to do

    TIA...

    It is not valid XML.

    See [spec | http://www.w3.org/TR/xml/#sec-starttags]

    Disallowed initial characters for Names include digits, diacritics, the full stop and the hyphen
    
  • Application Deployment - pkgdbcache.xml has wrong info

    I have a large application with 12 brothers and sisters.  The alx file named .cod combined single file.

    But after that the /index charger running the pkgdbcache.xml file also bears the names wrong!

    Modules: MobilePharmacy.cod, MobilePharmacy - 1.cod... MobilePharmacy - 12.cod.

    When I look in pkgdbcache.xml - the main file is named: MobilePharmacy - 1.cod, then there brothers and sisters named

    MobilePharmacy-1 - 1.cod, etc. MobilePharmacy-1 - 2.cod.

    BES version: 4.1.7.17

    Combined COD (those with the brothers and sisters contained) files are good.

    Development tools will create COD files for both the deployment of the BES (with contained siblings and an ALX) and a web site (with the brothers and sisters extracted and a JAD). The tools are * not * create an ALX that refers to brother COD files.

    If you have only one version of an application with brother COD files I would recommend going back to the developers and asking the right pair.

    With the BlackBerry Java plug-in for Eclipse, the version of the software of BES/Office of enforcement will be placed in the 'Standard' directory in the directory \deliverables of the application.

    See you soon,.

  • XML: Apending children

    Let's say that the following XML:
    < list >
    < item > < / item >
    < item > < / item >
    < / list >

    Now in ActionScript, if I have to loop through all the children and you are trying to add text nodes in each node as for

    (pseudocode)

    children = xml.children ();
    for (i = 0; i < children.length (); ++ I)
    {
    children .appendChild ("test" + i);
    }

    What is happening here is the two nodes updated twice. It seems that the XML code adds the child to all nodes of the same name. So now my XML looks like this:

    < list >
    < element > test1 test2 < / item >
    < element > test1 test2 < / item >
    < / list >

    What I want to do is the following:
    < list >
    Test1 < item > < / item >
    Test2 < item > < / item >
    < / list >


    Is this possible or is the XML in ActionScript borked?

    Hmm, I see now that rather than managing multiple xml nodes, flex prefer to group similar nodes in a single table. I'm not particularly fond of that it goes against how to work with XML in other languages and platforms, but I can live with that for now.

    As a solution, I'm deleting duplicate nodes and instead adding children to the same kids over and over again. If the result is as follows:



    Item1
    Item2
    Item3
    ...

    In the action script, I have to do the following to access these text nodes:

    list.item.getChildren () [index];

    I guess that's not bad. He worked my way, the only difference would have been:

    List.Item [index]

    So, there is a further step involved. Maybe, I'll just write a wrapper which will do that for me.

    If anyone wants to share their comments on this, please do. Meanwhile I'll label has responded to this topic.

  • Just crossdomain.XML doesn't work do not

    Hello

    I have move my request to my Local computer problems to a development/TEST server for testing. My application uses c# Web Services to access data and a Flex front-end.

    Here is the error I get (only on the development/TEST server):

    An error occurred communicating with the server.
    Error message: HTTP request error
    Faul Code is: Server.Error.Request
    Lack of detail is: error: [IOErrorEvent type = "ioError" bubbles = false cancelable = false eventPhase = 2 text = "Error #2032: stream error."] "URL: http://DOMAIN/APPLICATION/WebService.asmx" URL: WebService.asmx

    Exactly the same configuration works on my local machine. I have a crossdomain.xml in place file that looks like this:

    <? XML version = "1.0"? >
    <! DOCTYPE cross-domain-policy (View Source for full doctype...) >
    -cross-domain-policy >
    < site permitted-cross-domain-policies of control = 'all' / >
    < allow-access-from domain = "' * ' course ="fase"/ >"
    "< allow-http-request-headers-from domain =" "*" headers = "*" course = "fase" / >
    < / cross-domain-policy >

    However, I don't think the crossdomain is actually necessary, because there is demand on the same domain and directory as the webServices. But, I added one anyway, because every google search seems to say that the HTTP request error: Server.Error.Request is a problem of crossdomain.xml.

    Little, I thought it might be a permission error. However, I have the web page, run as an 'application' and user account for the application has permissions to the root directory and all it's children files/directories (so he can read the crossdomain.xml) and also the identity of the application has access to run all selects them.

    Unfortunately I am running this on IIS6 on the machine of dev/TEST and IIS7 on my local machine. So I can't set up the failed request tracking to see if I can find the problem there.

    Does anyone have any help that they can share? I spent the full day try everything I can think of to make it work with no will.

    Any help would be greatly appreciated!

    Thank you!!
    -Mike

    It turns out that the problem was that the Application Pool identity did not have access to the SQL DB do CRUD. I guess you should never be too sure of things. -= o /

  • XML with a member does not properly in the data model

    I use XmlDataAccess class to load an XML list in GroupDataModel. Everything works fine if the XML file has more than one Member, however, it does not load if the list contains a single member. I use the following code to get the XML content:

    QVariant list = xda.load(home.absoluteFilePath("MembersList.xml"),"/members/member");
    

    I need to know if the list has only one or 2 + members, so I can direct the data model to load with the appropriate settings. Can I know the number of members in the list?

    This problem is closely related to this question, where a solution QML is given.

    Hi Mitch99,

    Please see this forum post for a workaround for this problem. I tested it and confirm that it works as with QML.

  • DB - 12 c link XML Developer's Guide does not

    If I go to the tab Documentation XMLDB: XMLDB Oracle Documentation links

    Then click on: "The XML DB Developer's Guide" under the first section "Oracle Database Release 1 (12.1) 12 c", which links to: http://www.oracle.com/pls/db121/to_toc?pathname=appdev.121/e17603/toc.htm cela... results in a 404 error page not found. I believe that the correct link is: https://docs.oracle.com/database/121/ADXDB/toc.htm

    See you soon,.

    Post edited by: trent none 12 c links work actually, except for the link to the Documentation for database complete

    This problem has been fixed. All links on this page to the Documentation of Oracle XML DB for "Oracle Database Release 1 (12.1) 12 c" work now (or did when I've just tested).

  • UPS delivery mistake – [10001] XML document in the is not well formed

    Hello

    When choosing from the inverter to the delivery option, this error below the checkbox "address is residential.

    [10001] XML document is not well-formed


    If anyone has encountered this before?  I have an access key and credentials entries MyUPS correctly in the CMS.

    Thanks for any input.

    Jeff

    Thanks for the comments.  I'll submit a ticket in British Colombia.

Maybe you are looking for

  • Satellite Pro S200 - how to disable the volume button digital on the screen

    Hello I have a Satellite Pro S200, I'm unhappy with my digital volume.Dial whenever I work the volume control.Is there a way to disable this annoying feature? was soon simon

  • Libretto U100 will be sold in Scandinavia at all?

    I find this very interesting book and definetely would buy one if it's available here. (or anywhere with key scandic brands).

  • Using multiple computers on the network

    I received the J6480 for Christmas and that you install wireless to my desktop computer... everything seems to work great so far.  Should what steps I follow in order to use the J6480 with my 2 laptops?  The office is Vista, the two XP laptops. I'm n

  • Bluetooth on g6 2252sa

    How can I access the bluetooth on my pavilion g6 2252sa function. I would use bluetooth external speakers. Currently using the windows 8.1 operating system.

  • Share my photos from a user to another account.

    I need to help, sharing photos and files. I just created my own user account on our computer and all the photos that I downloaded are in our main user account and I want to transfer them to my user account. I tried to share, but it did not work. Coul