Copy an xml node

<TestCase>
<AuthorizePaymentRq>
<amount>3.1415926535897932384626433832795</amount>
<method>Debit</method>
<parameters>
<PaymentParameter>
<Name>String</Name>
<Value>String</Value>
</PaymentParameter>
</parameters>
</AuthorizePaymentRq>
<LOB>PL</LOB>
<ReferenceNumber>234234553</ReferenceNumber>
<Applicantid>886</Applicantid>
</TestCase>
this is my xml file. i need to parse it and i used dom do it.
i need to copy a node of this xml and put it in to string.
for example my target will be like this
String p= "<AuthorizePaymentRq>
<amount>3.1415926535897932384626433832795</amount><method>Debit</method><parameters> <PaymentParameter><Name>String</Name> <Value>String</Value> </PaymentParameter></parameters>
</AuthorizePaymentRq>".
please give me a quick reply ASAP please..

i am posting this question again for help.
my request to a service will go like this
String response = proxy.doAuthorizePayment(lob,RefNumber,appid,XMLInput as a string);
XMLInput should be a string in xml format which i have to copy from the xml that i gave. please solve this..
NodeList LOB = doc.getElementsByTagName("LOB");
          NodeList ReferenceNumber = doc.getElementsByTagName("ReferenceNumber");
          NodeList Applicantid = doc.getElementsByTagName("Applicantid");
          Node node;
               node = LOB.item(0);
               String lob=node.getChildNodes().item(0).getNodeValue();
     System.out.println(lob+"LOB");
     node=ReferenceNumber.item(0);
          String RefNumber=node.getChildNodes().item(0).getNodeValue();
          System.out.println(RefNumber+"RefNumbe Here");
          node=Applicantid.item(0);
          String appid=node.getChildNodes().item(0).getNodeValue();
                         System.out.println(appid+"Applicantid Here");

Similar Messages

  • Using XSLT to extract value of a XML node with namespace

    I have a XML source code here.
    <?xml version="1.0" encoding="utf-8" ?>
    <rss version="2.0" xmlns:job="http://www.pageuppeople.com">
      <channel>
        <title>SMH Jobs</title>
        <link>internalrecruitment.smhgroup.com.au/jobsrss.ashx?stp=di</link>
        <description>A listing of jobs available here</description>
        <item>
          <title>eCommerce Optimisation Advisor</title>
          <description>A new and exciting opportunity exists for an experienced eCommerce Advisor to join</description>
          <job:location PUReferenceID="3711">Sydney - Inner Suburbs & CBD</job:location>
        </item>
      </channel>
    </rss>
    I want to use XSLT to extract value of a XML node with namespace <job:location>, and the returned value should be string 'Sydney - Inner Suburbs & CBD'. I tried a few XSL code below, but failed with error or nothing was returned.
    <xsl:value-of select="job:location" disable-output-escaping="yes"/>
    <xsl:value-of select="job/location" disable-output-escaping="yes"/>
    <xsl:value-of select="job\location" disable-output-escaping="yes"/>
    <xsl:value-of select="location" disable-output-escaping="yes"/>
    This might be an easy question for you, but I would appreciate if anyone can help.

    Hi Suncorp IT Learner,
    We need to tell the XSLT that some elements are in another namespace. Copy the xmls declarations for the prefixes you need to use. Then use the xsl format as:
    <xsl: value-of select=”job:location/@PUReferenceID”/>
    In following issue, Chriztian has a good explanation:
    http://our.umbraco.org/forum/developers/xslt/33353-XSLT-reading-XML-attribute-value
    Thanks,
    Qiao Wei
    TechNet Community Support

  • Xml in JTree: how to not collpase JTree node, when renaming XML Node.

    Hi.
    I'm writing some kind of XML editor. I want to view my XML document in JTree and make user able to edit contents of XML. I made my own TreeModel for JTree, which straight accesses XML DOM, produced by Xerces. Using DOM Events, I made good-looking JTree updates without collapsing JTree on inserting or removing XML nodes.
    But there is a problem. I need to produce to user some method of renaming nodes. As I know, there is no way to rename node in w3c DOM. So I create new one with new name and copy all children and attributes to it. But in this way I got a new object of XML Node instead of renamed one. And I need to initiate rebuilding (treeStructureChanged event) of JTree structure. Renamed node collapses. If I use treeNodesChanged event (no rebuilding, just changes string view of JTree node), then when I try to operate with renamed node again, exception will be throwed.
    Is there some way to rename nodes in my program without collpasing JTree?
    I'am new to Java. Maybe there is a method in Xerces DOM implementation to rename nodes without recreating?
    Thanks in advance.

    I assume that "rename" means to change the element name? Anyway your question seems to be "When I add a node to a JTree, how do I make sure it is expanded?" This is completely concerned with Swing, so it might have been better to post it in the Swing forum, but if it were me I would do this:
    1. Copy the XML document into a JTree.
    2. Allow the user to edit the document. Don't attempt to keep an XML document or DOM synchronized with the contents of the JTree.
    3. On request of the user, copy the JTree back to a new XML document.
    This way you can "rename" things to the user's heart's content without having the problem you described.

  • Add attribute to a XML node at a specific position

    I have this XML :
    var myNode:XML = <node attribute="123"/>
    I know how to add an attribute to the node :
    myNode.@otherAttribute = "abc";
    But this adds the attribute to the end. What if I want to add it as the first attribute ? I would like to have :
    <node otherAttribute="abc" attribute="123"/>
    I know it is possible to add a child node to a specific position with insertChildAfter() or insertChildBefore() but I don't know if it's possible for an attribute.

    there's no native method for this, maybe you should create some functions for this. just like
    private function setAttribute(node:XML, name:String, value:String, index:int = -1):void
        var attrs:XMLList = node.attributes().copy(),
            l:int = attrs.length();
        if(index == -1 || index > l - 1)
            node.@[name] = value;
        else
            delete node.@*;
            var idx:int = 0;
            for (var i:int = 0; i < l + 1; i++)
                if(i == index)
                    node.@[name] = value;
                else
                    var attr:XML = attrs[idx];
                    node.@[attr.name()] = attr.toString();
                    idx++;
    and use it like this:
    setAttribute(myNode, "otherAttribute", "abc", 0);

  • Asign paragraph styles to xml nodes

    Hello all,
    I try to asign paragraph styles to xml nodes. I tried to autoasign the styles to tags and also to assign the styles directly to the xml tags with aid:pstyle. None of it with success. I think that this happens because there is a paragraph formating missing in my xml. I tried to change this with <aid:br/> but also no success.
    This is how my xsl looks like:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
      <xsl:output method = "xml" version="1.0" encoding="UTF-8" indent="yes"/>
      <xsl:strip-space elements="*"/>
      <xsl:template match="ooo_sheet">
        <Root>
          <xsl:for-each select="ooo_row">
              <Artikel>
              <xsl:copy-of select="Artikelnummer"/>
                  <Bild>
                        <xsl:attribute name="href">
                      <xsl:text>file:///</xsl:text>
                      <xsl:value-of select="Bildpfad"/>
                        </xsl:attribute>
                  </Bild>
                  <Text xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/" xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/">
                        <EK aid5:pstyle="EK"><xsl:value-of select="EK"/><aid:br/></EK>
                    <Details aid5:pstyle="Details"><xsl:value-of select="Details"/><aid:br/></Details>
                    <Abmessungen aid5:pstyle="Abmessungen"><xsl:value-of select="Abmessungen"/><aid:br/></Abmessungen>
                    <Artikelnummer aid5:pstyle="Artikelnummer"><xsl:value-of select="Artikelnummer"/><aid:br/></Artikelnummer>
                  </Text>
              </Artikel>
          </xsl:for-each>
        </Root>
      </xsl:template>
    </xsl:stylesheet>
    I want to achieve that I can pull the the following tag from the structure view in Indesign to a textframe and the text gets the different formating.
    <Text xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/" xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/">
                        <EK aid5:pstyle="EK"><xsl:value-of select="EK"/><aid:br/></EK>
                    <Details aid5:pstyle="Details"><xsl:value-of select="Details"/><aid:br/></Details>
                    <Abmessungen aid5:pstyle="Abmessungen"><xsl:value-of select="Abmessungen"/><aid:br/></Abmessungen>
                    <Artikelnummer aid5:pstyle="Artikelnummer"><xsl:value-of select="Artikelnummer"/><aid:br/></Artikelnummer>
    </Text>
    Could anyone point me to the right direction? Any help is very welcome. Thank you for your help.

    Sorry, my last example was the xsl instead of the xml. Here is the xml I got. I want to pull the Root/Artikel/Text Tag to a frame and all Child tags within should be formated with the corresponding pstyles.
    But it looks like as if Indesign just does not tranform the aid5 style upon xml/xlst import. The <aid:br> tags you see are just a try of myself to get the tags within the Text tag separated as paragraph.
    But Indesign just interprets them as normal tags and also shows them in the structure pane.
    Thank you very much for your help. I also tried to format the text with the paragraph styles by hand and export the whole thing as xml from Indesign. But Indesign just the xml the same way I imported it. The same happens when I manually create a xml structure in Indesign, assign the styles to the text within the frame. Indesign just exports the raw xml structure. But no style declarations. So I can't see how to format the tags the right way.
    This is how my xml looks like when I import it with the upper xsl.
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <Root>
        <Artikel>
            <Artikelnummer>C12-34567</Artikelnummer>
            <Bild href="file:///Users/Diamondgroup/Desktop/KatalogBeispiel/cmyk/C12-34567.PSD"></Bild>
            <Text xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/" xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/">
                <EK aid5:pstyle="EK">1234,-<aid:br></aid:br></EK>
                <Details aid5:pstyle="Details">AAA AAA AAA AAA<aid:br></aid:br></Details>
                <Abmessungen aid5:pstyle="Abmessungen"><aid:br></aid:br></Abmessungen>
                <Artikelnummer aid5:pstyle="Artikelnummer">C12-34567<aid:br></aid:br></Artikelnummer>
            </Text>
        </Artikel>
        <Artikel>
            <Artikelnummer>C23-45678</Artikelnummer>
            <Bild href="file:///Users/Diamondgroup/Desktop/KatalogBeispiel/cmyk/C23-45678.PSD"></Bild>
            <Text xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/" xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/">
                <EK aid5:pstyle="EK">2345,-<aid:br></aid:br></EK>
                <Details aid5:pstyle="Details">BBB BBB BBB BBB<aid:br></aid:br></Details>
                <Abmessungen aid5:pstyle="Abmessungen"><aid:br></aid:br></Abmessungen>
                <Artikelnummer aid5:pstyle="Artikelnummer">C23-45678<aid:br></aid:br></Artikelnummer>
            </Text>
         </Artikel>
    </Root>
    All the xsl: transformations work but the aid: and aid5: transformations just show in the xml as they where in the xsl.

  • Copy Signed XML without altering it

    Hi everyone,
    I have a windows 2003 svr with JRE 1.6.0_18, and xmlsec v1.2.97 jar imported.
    I'm building a new module of an existing application, which creates xml for invoices, signs them, and sends them to another company. This signed XMLs are stored on the filesystem.
    I need to copy one of such xml files, lets call it A.xml (with valid signature, I checked using DOM's security validation tools) into another xml, lets say B.xml, without altering the contents of A.xml ( therefore voiding the signature ).
    Then I have to sign B.xml
    I have tried the following so far:
    1. using Filereader to copy byte by byte to B.xml.
    2. using inputstreamreaders (with apropriate encoding parameter) and copy line by line.
    3. using DOM to add new node, and Transformer API to generate B.xml (proper enconding parameters are being set)
    when I run a signature validation on B.xml, the signature has become invalid.
    One intresting thing though, is that if I use method 1 to copy A.xml to another xml having only A's tree, this new XML has a valid signature.
    Has anyone gone through something similar?
    I'm I missing something?
    or is it that whenever I insert an XML into another, it's signature will become void?
    Thank you in advance for your help and time!
    Regards,
    Reynod

    Well, #1 should work. Although I didn't understand what you said about "A's tree". Either you copy the file byte for byte (in which case you don't break the signature) or you produce something different (in which case you break the signature).
    Anything which changes the contents of the XML should generate a document whose signature is invalid. That's the main point of signing a document.

  • How to binding incoming xml node list to the tree control as dataProvider

    Recently, I faced into one issue: I want to binding incoming xml node (it's not avaliable at start) list to the tree control as a dataProvider.
    Since the incoming xml node list is not avaliable at beginning but I needs to bind it to the tree, so I create one virtual one in the xml, and prepare to remove it before the tree is shown. (ready for the actual node adding). But It did not work.
    Please see the presudo-code here:
    1.  Model layer(CsModel.as)
    public class CsModel
            [Bindable]
            public var treeXML:XML=<nodes><car label="virtualOne" id="1">
                                   </car></nodes>;
            (Here, I want to build binding relationship on the <car/> node,
             one 'virtual/stub' node is set here with lable="virtualOne".
             But this node will be deleted after IdTree
             control is created completely.)      
            [Bindable]
            public var treeData:XMLList =new XMLListCollection(treeXML.car);
    2. view layer(treePage.mxml)
            private var _model:CsModel = new CsModel();
            private function addNode():void
                    var newNode:XML=<car/>;
                    newNode.@label="newOne";
                    newNode.@id=1;
                    _model.treeXML.appendChild(newNode);
                             private function cleanData():void
                                     delete _model.treeXML.car;
            <mx:VBox height="100%" width="100%">
            <mx:Button label="AddNode" click="addNode()" />
            <mx:Tree id="IdTree"  labelField="@label"
              creationComplete="cleanData()"
              dataProvider="{_model}"/>
        </mx:VBox>
    3. Top view layer (App.Mxml)
    <mx:application>
        <treePage />
    </mx:application>
    For method: cleanData(),It's expected that when the treePage is shown, we first delete the virutalOne to provide one 'clear' tree since we don't want show virtualOne to the user. The virutalOne node just for building the relationship between treeData and treeXML at beginning. But the side effect of this method, I found, is that the relationship between treeXML and treeData was cut off. And this leads to that when I added new node (by click the 'addNode' button) to the xmlXML, the xmlData was not affected at all !
    So Is there any other way to solve this issue or bind the incoming xml node list to the xmlListCollection which will be used as Tree control's dataProvider ?

    If u want to display the name : value then u can do like this
    <xsl:eval>this.selectSingleNode("name").nodeName</xsl:eval> : <xsl:value-of select="name" />

  • Error copying application.xml icons: .../bin-release/assets/icons' does not exist

    Hi,
    Whenever I try to export the release build I get error from COmpiler during the process that "Error copying application.xml icons: Resource '/Project_Name/bin-release/assets/icons' does not exist."  I have specified 4 icons in the -app.xml file of sizes 16,32,48,128 which exist in the path specified and files are not corrupt. I have checked and unchecked the compiler directive "Copy non-embedded resources in the Output file" but that has not helped too.
    Can somebody please advise what do I do in this situation?
    We are using
    FB4 with Flex Hero(4.5) SDK and java heap space specified in .ini files is 1224m
    This is somewhat urgent guys...
    Thanks
    Shubhra

    Frank,
    Thank you for your answer. I had not checked (will do so tonight).
    I had considered it adequate to wipe out the entire system directory (thereby wiping out the integrated weblogic server), but perhaps it was not adequate? I did not specify that this is on the integrated server, but that is the case....
    Stuart

  • SQL Server Agent Failed to decrypt protected XML node

    I'm getting the below error when trying to run sql server agent to run an SSIS package. I've updated folder security to allow sql server agent access, but cannot get the package to execute within SQL Management Studio. The package runs find in SSIS. 
    11.0.2100.60 for 64-bit  Copyright (C) Microsoft Corporation. All rights reserved.    Started:  12:12:00 PM  Error: 2014-11-30 12:12:02.65     Code: 0xC0016016     Source: LoadStgProspects      Description:
    Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that
    the correct key is available.  End Error  Error: 2014-11-30 12:12:03.88     Code: 0xC0016016     Source: LoadStgProspects      Description: Failed to decrypt protected XML node "DTS:Password" with error
    0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that the correct key is available.  End Error  Error: 2014-11-30
    12:12:04.74     Code: 0xC0209303     Source: LoadStgProspects Connection manager "Excel Connection Manager"     Description: The requested OLE DB provider Microsoft.Jet.OLEDB.4.0 is not registered. If the 64-bit driver
    is not installed<c/> run the package in 32-bit mode. Error code: 0x00000000.  An OLE DB record is available.  Source: "Microsoft OLE DB Service Components"  Hresult: 0x80040154  Description: "Class not registered".
     End Error  Error: 2014-11-30 12:12:04.74     Code: 0xC020801C     Source: Load prospect files Prospect xls [231]     Description: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.  The AcquireConnection
    method call to the connection manager "Excel Connection Manager" failed with error code 0xC0209303.  There may be error messages posted before this with more information on why the AcquireConnection method call failed.  End Error  Error:
    2014-11-30 12:12:04.74     Code: 0xC0047017     Source: Load prospect files SSIS.Pipeline     Description: Prospect xls failed validation and returned error code 0xC020801C.  End Error  Error: 2014-11-30 12:12:04.74
        Code: 0xC004700C     Source: Load prospect files SSIS.Pipeline     Description: One or more component failed validation.  End Error  Error: 2014-11-30 12:12:04.74     Code: 0xC0024107     Source:
    Load prospect files      Description: There were errors during task validation.  End Error  Error: 2014-11-30 12:12:04.74     Code: 0xC00220DE     Source: LoadStgProspects      Description: Error
    0xC0012050 while loading package file "C:\Users\Jim\Documents\Visual Studio 2010\Projects\SSISTraining\SSISTraining\LoadStgProspects.dtsx". Package failed validation from the ExecutePackage task. The package cannot run.  .  End Error  DTExec:
    The package execution returned DTSER_FAILURE (1).  Started:  12:12:00 PM  Finished: 12:12:04 PM  Elapsed:  4.337 seconds.  The package execution failed.  The step failed.,00:00:04,0,0,,,,0

    Hi selfdestruct80,
    According to your description, you created SSIS package and it works fine. But you got the error message when the SSIS package was called from a SQL Server Agent job.
    According to my knowledge, the package may not run in the following scenarios:
    The current user cannot decrypt secrets from the package.
    A SQL Server connection that uses integrated security fails because the current user does not have the required permissions.
    File access fails because the current user does not have the required permissions to write to the file share that the connection manager accesses.
    A registry-based SSIS package configuration uses the HKEY_CURRENT_USER registry keys. The HKEY_CURRENT_USER registry keys are user-specific.
    A task or a connection manager requires that the current user account has correct permissions.
    According to the error message, the SSIS Package ProtectionLevel property to EncryptSensitiveWithPassword as ArthurZ mentioned. To solve the problem, you need to go to Command Line tab, manually specify the paassword in SQL Agent Job with the command like below:
    /FILE "\"C:\Users\xxxx\Documents\SQL Server Management Studio\SSIS\Package.dtsx\"" /DECRYPT somepassword /CHECKPOINTING OFF /REPORTING E
    If you have any more questions, please feel free to ask.
    Thanks,
    Wendy Fu
    Wendy Fu
    TechNet Community Support

  • Convertion of String to XML node using Xquery transformation in OSB

    How to convert string to XML node elementusing a built in function using Xquery transformation in OSB?

    check this out - http://www.javamonamour.org/2011/06/fn-beainlinedxml.html
    if in SOA (BPEL & Mediator) you can use oraext:parseXML.
    you should thoroughly analyse where to implement your requirement as some good practices advise to implement more complex logic in SOA and leave OSB to only connect to the services' endpoints.
    Hope this helps,
    A.

  • Getting Error 'Root XML Node nqw not found in island!'

    I have upgraded my setup from OBIEE 11.1.1.5.0 to 11.1.1.5.1 and then uploaded a catalog created in older version, 11g itself.
    I'm able to run the dashboards and see all reports. They run absolutely fine, show all correct data.
    However if I try to edit report or try to open them in Answers module .... from anywhere (Catalog Link/ Edit option below reports in Dashboard) it gives me this error.
    " Root XML Node nqw not found in island! "
    It's strange. I tried following:
    1. doing a Upgrade of catalog by setting up parameter in instanceconfig.xml file
    <Catalog>
    <UpgradeAndExit>true</UpgradeAndExit>
    </Catalog>
    and then reverting back to false.
    2. Also tried the GUID upgarde by setting parameters in instanceconfig.xml file and NQSConfig.ini file
    none helped.
    Any help?

    Hi Naresh,
    I hope you have resolved the issue by this time.
    In my case, it was related to an invalid filter on the report.
    I have removed the filter by updating the report .xml file from Catalog Manager.
    Hope this helps other with similar issue.
    Thanks,
    Ravi

  • How to create xml nodes based on a value

    Dear friends,
    I've a question about graphical mapping in SAP PI...
    How can I create XML nodes on the target side based on a value in a XML field on the source side.
    For example:
    This XML field on the source:
    <NO_OF_LINES>4</NO_OF_LINES>
    Must result on 4 Lines on the Target:
    <LINE></LINES>
    <LINE></LINES>
    <LINE></LINES>
    <LINE></LINES>
    So it's actually the opposite of the Count function...
    I appreciate your help,
    Thank you in Advance,
    Kind regards,
    John

    Hi ,
    Try this
    NO_OF_LINES---> count---> UDF---> LINE
    example :
    UDF Code :
    for (int i=0;i<var1[0];i++)
    result.addValue("");

  • How to set the value in the xml node.

    Hi
    I am having the application PDF which can be submitted by user using the button. while submitting 
    i am using below code to set the value in the xml node.
       xfa.data.assignnode("employee.id","123",0):
    So its generating the xml like below.
    <employee>.
    <id>123</id>.
    </name>
    </employee>
    Now i need to generate the xml like  below.
    <employee id= "123" >
      </Name>
    </employee>
    So how to set/create the id node like above?
    Advance Thanks.
    Regards,
    Dhiyane

    Hi Dhiyane,
    You will have to set the contains property if the id node to "metaData", that is;
    xfa.data.assignNode("employee.id","123",0);
    xfa.data.employee.id.contains = "metaData";
    Very clumsy if you have a number of them, in which case you might want to look at using E4X.
    Good luck
    Bruce

  • Map several records to different elements in the same xml node

    Hi,
    I am trying to map data from relational tables to elements as per my xml schema. One of my tables has several records that I need to map to different elements in the same xml node.
    For example:
    Customer_Id | Param_Id |Param_Name
    212 | 1 |State
    212 | 2 |Country
    212 | 3 |ZipCode
    I can not change the structure of this existing table and need to work with it.
    How do I map the different params for a specific customer to my Customer node in the schema?
    One option is to join on the parameters table several times, but there ought to be a better way!
    PLEASE HELP!!!
    Thanks,

    First I question the design that contains/allows 600 attributes on an element. They sound like they really should be elements in the XML.
    Regardless, the following (NOT TESTED) should work for you (assuming you want to write one SQL with 600 columns)
    CREATE OR REPLACE VIEW APPLICATION_XML
    OF XMLTYPE
    Element "LOAN_APPLICATION"
    with object ID
    substr(extractValue(object_value,'/LOAN_APPLICATION/APPLICATION_DATA/@CallID'),1,5)
    AS
    WITH parm_tb AS
    SELECT MAX(DECODE(prv_valu, 1, prv_value)) BusinessType,
           MAX(DECODE(param_id, 2, prv_value)) Product,
           MAX(DECODE(param_id, 3, prv_value)) SomethingElse
      FROM parameter_details
    WHERE prv_pmh_header_id = 1
    SELECT xmlElement
       ("APPLICATION_DATA",
         xmlAttributes
          p.prv_detail_id as "CallID",
          p.PRV_PRM_PARAM_ID as "RandomID",
          p.prv_value as AppInitDate
         xmlElement
         ("PRODUCER_DATA",
           xmlAttributes
            parm_tb.BusinessType as "BusinessType" ,
            parm_tb.Product as "Product"
      FROM parameters_table p
    WHERE p.PRV_PMH_HEADER_ID = 1

  • How to get Total Number of XML Nodes?

    Hello All,
    I have a Flash program I'm doing in Actionscript 3, using CS6.
    I'm using the XMLSocket Class to read-in XML Data. I will write some sample XML Data that is being sent to the Flash
    program below...
    I know with this line here (below) I can access the 4th "element or node" of that XML Data.
         Accessing XML Nodes/Elements:
    // *I created an XML Variable called xml, and "e.data" contains ALL the XML Data
    var xml:XML = XML(e.data);
    // Accessing the 4th element of the data:
    xml.MESSAGE[3].@VAR;          --->     "loggedOutUsers"
    xml.MESSAGE[3].@TEXT;         --->     "15"
         SAMPLE XML DATA:
         <FRAME>
    0               <MESSAGE VAR="screen2Display" TEXT="FRAME_1"/>
    1               <MESSAGE VAR="numUsers" TEXT="27"/>
    2               <MESSAGE VAR="loggedInUsers" TEXT="12"/>
    3               <MESSAGE VAR="loggedOutUsers" TEXT="15"/>
    4               <MESSAGE VAR="admins" TEXT="2"/>
         </FRAME>
    I'm new to Flash and Actionscript but I'm very familiar with other languages and how arrays work and such, and I know for
    example, in a Shell Script to get the total number of elements in an array called "myArray" I would write something like
    this --> ${#myArray[@]}. And since processing the XML Data looks an awful lot like an array I figured there was maybe
    some way of accessing the total number of "elements/nodes" in the XML Data...?
    Any thoughts would be much appreciated!
    Thanks in Advance,
    Matt

    Hey vamsibatu, thanks again for the quick reply!
    Ohhh, ok I gotcha. That makes more sense.
    So I just tried this loop below and I guess I could use this and just keep assigning an int variable to the output so
    when it finishes I will be left with a variable containing the total number of elements:
    for (var x:int in xml.MESSAGE)
         trace("x == " + x);
    *Which OUTPUTS the Following:
    x == 0
    x == 1
    x == 2
    x == 3
    x == 4
    So I guess I could do something like this and when the loop completes I will be left with the total number of elements/nodes...
    var myTotal:int;
    for (var x:int in xml.MESSAGE)
        myTotal = x;
    // add '1' to myTotal since the XML Data is zero-based:
    myTotal += 1;
    trace("myTotal == " + myTotal);
    *Which Prints:
    "myTotal == 5"
    Thanks again for you suggestions, much appreciated!
    I think that should be good enough for what I needed. Thanks...
    Thanks Again,
    Matt

Maybe you are looking for