Which is the best way to parse nested XML

Hello, I am just getting back into using ColdFusion and I am
working on a project that needs to parse some XML.
The XML is generated by a third party document.
I figured out how to grab individual values and such, but I'm
not sure what is the best way to grab a value in relation to where
it is in the XML.
Following is a rather simplified example of the XML
I need to grab the value of 'Rich Text' in relation to the
'ID name' value.
<project>
<CT text>
<Group>
<id name = text1>
<Rich Text>some sample text</Rich
Text>
</id>
</Group>
</CT Text>
<CT text>
<Group>
<Group>
<id name = text1>
<Rich Text>some sample text</Rich
Text>
</id>
</Group>
</Group>
</CT Text>
<CT text>
<id name = text2>
<Rich Text>some more sample text</Rich
Text>
</id>
</CT Text>
</project>
Once parsed, the info I need to output on the page would look
like
text 1
some sample text
text 2
some more sample text
The part that makes this difficult for me is that there may
be 0 'Group' values or there might be a number of them. As such, I
can't just grab the value by listing the tree out, since it changes
depending on the document (there are thousands of these documents
that I need to parse).
From what I have seen in some XML examples, there are a
number of ways to go about doing this, but before I put a lot of
time into any of them, I was wondering what the 'best' way to do
this is.
XSLT? XMLSearch? Structures? Some combination of those or
other functions?
P.S. what little I know of using ColdFusion with XML all
comes from the doc written by Nate Weiss.
I was a bit let down that after spending well over $1,000 for
ColdFusion, Adobe left out the only two books that were worth
printing (the CFML reference guide and the Advanced book). It
wouldn't have bothered me as much if there was something on the
product page listing the manuals that said 'we only actually give
you 2 of the ones listed'.
Best regards
Kevin R.

Hello,
Could someone do me a huge favor and provide some sample code
that would parse/output the above xml so that the output would look
something like the following. . .
text 1 = some sample text
text 2 = some more sample text
The problem I am having is displaying the xmltext for the
RICH TEXT element in relation to the ID element.
The code below will return the value of the RICHTEXT
(incorrectly named in the original XML examples) easily enough, but
I need to have it show which text number it is.
Best regards,
Kevin R.

Similar Messages

  • What's the best way to parse a BSTR in TestStand?

    I receive a BSTR from an OLE interface; what is the best way to parse this into something understandable? Has anyone written a routing for this?

    Hi,
    If you are using a OLE interface I think you will be using the Active X Automation adaptor.
    TestStand Active X Automation Adaptor automatically converts BSTR when it store the data in a TestStand variable.
    Then you should be able to use the regular string functions which are available in TestStand to parse the strings.
    Please let me know if you have any more questions.
    Regards
    Anand Jain

  • Which is the Best way to upload BP for 3+ million records??

    Hello Gurus,
                       we have 3+million records of data to be uploaded in to CRM coming from Informatica. which is the best way to upload the data in to CRM, which takes less time consumption and easy. Please help me.
    Thanks,
    Naresh.

    do with bapi BAPI_BUPA_FS_CREATE_FROM_DATA2

  • Which is the best way for posting a large number of records?

    I have around 12000 register to commit to dababase.
    Which is the best way for doing it?
    What depends on ?
    Nowadays I can't commit such a large number of register..The dabatase seems hanged!!!
    Thanks in advance

    Xavi wrote:
    Nowadays I can't commit such a large number of registerIt should be possible to insert tens of thousands of rows in a few seconds using an insert statement even with a complex query such as the all_objects view, and commit at the end.
    SQL> create table t as select * from all_objects where 0 = 1;
    Table created.
    Elapsed: 00:00:00.03
    SQL> insert into t select * from all_objects;
    32151 rows created.
    Elapsed: 00:00:09.01
    SQL> commit;
    Commit complete.
    Elapsed: 00:00:00.00
    I meant RECORDS instead of REGISTERS.Maybe that is where you are going wrong, records are for putting on turntables.

  • Which is the best way of deploying JSP (mod_ose or OSE) ?

    I need to deploy some jsps that are using servlet api 2.2 and i would like to know which is the best way of deploying these jsps?
    Thanks
    RJC

    Speaking of JServ Vs OSE, I have some related questions on it. I would appreciate if someone can answer:
    1.For a stateful servlet (assuming that we are using Oracle JVM), Will it not call the init() method of the servlet each time for a client (because each client will have his own Oracle JVM)? If so, isn't that expensive because it needs to initialize the servlet again?
    Again, for the same servlet, Will it not have a servlet context for each and every client? Isn't that expensive? ( A servlet context by definition maintains state information for all instances of a web application within any single JVM)
    2. If we have an application that has some portion of it which is stateless and some portion of it which is stateful, how do we make a choice JDK JVM vs Oracle JVM?
    Can we (for the same application) use both the JDK JVM as well as Oracle JVM? If so, how does the JDK JVM talk with Oracle JVM?
    3. Since Oracle JVM is useful for stateful applications only, does it mean that we cannot use it for Stateless session beans? (In an application we might have stateless session beans, stateful session beans as well as entity beans) Should we be using JDK JVM or Oracle JVM?
    4. For Servlets too, we might have stateless servlets and stateful servlets within the same application. If so, can we use JDK JVM for stateless servlets and Oracle JVM for stateful servlets? If so, how does the JDK JVM talk with Oracle JVM?

  • Which is the best way for a called function to identify caller class name.

    Which is the best way for a called function to identify the caller class name .
    1)Using sun.reflect.Reflection from called function
                    Class caller = Reflection.getCallerClass(2);
                    System.out.println("Caller Class Name ::"+caller.getName());2) Analyzing current threads stack trace from called function
                    StackTraceElement[] stElements=Thread.currentThread().getStackTrace();
                    System.out.println("Caller Class Name ::"+stElements[3].getClassName());Is there any alternate ways to achieve the same .Which is the best way ?
    Called function doesn’t have any arguments, I don’t want t pass any arguments from caller function to called function.
    Plz help.
    With kind regards
    Paul

    798185 wrote:
    Which is the best way for a called function to identify the caller class name .
    Is there any alternate ways to achieve the same.SecurityManager
        // 0 is the anonymous SecurityManager class
        // 1 is this class (also works in static context)
        // 2 is calling class
        static Class getClass(int i) {
            return new SecurityManager() {
                protected Class[] getClassContext() {
                    return super.getClassContext();
            }.getClassContext();

  • Filter or Restrict on? Which is the best way to put it?

    Hello Experts,
    If there is a Characteristic/Key figure on a report in BEx, and I right click on it and find another data element say, 0FISPER it I EDIT. On right click on 0FISPER I a variable.
    My question is this, do we way that the key figure is RESTRICTED ON 0FISPER
    or, key figure is FILTERED by 0FISPER
    When do we use Filter or Restrict on? Which is the best way to put it? How best is it read, please include the variable in your discussion.
    I will appreciate this clarification.
    e.g. Company code EDIT shows Company codes ZPPTcomp: with nodes  8000, 9000
    Thanks.

    Hi Amanda,
    as per my understanding,
    you are checking the structure field, you have selected edit then you are viewing a key figure and 0fiscper restricted by varaible. am I right?
    if this is the case this is local selection and the key figure is restricted by fiscper variable means the restriction value user can enter in selection screen. if you select 0fiscper and select restrict there you can see single values, value range and you can also see varaible tab. by using varaible tab you can restrict to variable value.
    hope this gives you some understanding.
    Sathya

  • Which is the best way to create a connection object

    hi,
    Eventhough i am not new to java I just wanted to know that which is the best way for creating sql connection object.
    Is it using the DriverManager.getConnection(..,..,..) or using a datasource and getting the connection.
    Which is more efficient or Is there any other way to create sql connection which is even more better.
    thanks in advance.
    pradeepbhargav

    AFAIK all connections, DataSource ones included are created by calling the DriverManager. A DataSource is a factory for Connection objects (from JavaDocs)
    If you're talking about managing connections then it depends on the application. A DataSource is great for apps that can support many clients or are multi-threaded, but may require a JNDI implementation to get to it.
    If however you have an single threaded app that hits the database in a serial fashion, then DataSource is probably an overkill.
    Dave

  • I am currently running my mac booc pro with the osx 10.5.8 and i want to update it. Which is the best way?

    I am currently running my mac booc pro with the osx 10.5.8 and i want to update it. Which is the best way?

      Snow Leopard Purchase
    Computer Compatibility - Lion
    Mountain Lion/Mavericks
    Check that your computer is compatible with Mountain Lion/Mavericks.
    To check the model number hold down the option/alt key, go to the Apple menu and select System Information.
    MacBook Pro (Mid/Late 2007 or newer) model number 3,1 or higher
    Your Mac needs:
    OS X v10.6.8 or OS X Lion already installed
    2 GB or more of memory (More is better - 4 GB minimum seems to be the consensus)
    8 GB or more of available space

  • Which is the best way Applets or JSP

    Hi I am trying to develop a application to
    run on the internet .It involves few master detail table in each form and 10 Different functions.The forms needs to have LOVs and other validations.Which will be the best way to go.Total tables involved would be around
    40 and coulumns in these tables would be (15 - 40).
    Any suggestions
    jagan
    null

    I'll give you my input/opinion based on my own experience. Others may have additional considerations to add, or may want to disagree with some of my points:
    Benefits of JSPs:
    1. This is an evolving technology that a lot of people are now using. It is very powerful, and the performance is pretty good.
    2. It is much easier to deploy than an applet.
    3. It will continue to improve and be easier to work with, especially with our upcoming 3.2 release.
    4. Does not require a lot of Java experience.
    Drawbacks of JSPs:
    1. No GUI editor for laying out the user interface. You are using HTML code in a text editor, which is trickier to see how the UI will look as you go. Again, this will continue to improve over time, and our 3.2 release will make it a little easier to deal with the HTML and Java code.
    Benefits of Applets:
    1. There is a UI editor for designing the layout, but layout in Java can be tricky.
    Drawbacks of Applets:
    1. Deployment can be very error prone.
    2. Subject to security restrictions such as the database you connect to and the webserver the applet runs from must be on the same machine. You can work around this, but it complicates matters.
    3. Clients need to have the Java Plug-in installed with their browser.
    4. Performance is not great, especially for a lot of data going back and forth.
    5. Requires that the applet code is downloaded to the client, temporarily at least, at runtime. The more code you have in your applet, the longer it takes to download when the client invokes it.
    Bottom line is that Applets are fine for small tasks, and are preferable for 'intranet' use versus 'internet' use (outside).

  • Which is the best way to transfer the file through the LAN

    I need to transfer files of Size in MB from one PC to another. I have done it by File Copy function with the file path "\\Receiver\C:\File.txt". but it takes 1 Sec approximately for the 10KB of file size. I also need to monitor the file transfer progress. Please suggest the best way to transfer file faster.

    Thanks for the Valuable feedback.
    Actually the File format I  have to tranfer is *.vlf (these file are taken for printing)  which is of few MB of size  I didnt try to transfer this format file. For the testing purpose I have tried with text files.
    Please tell me how to address the destination path (administrative
    share of C$ ). I dont know about UNC path.
    In my Code:
    After transferring files to the destination path (path - which is always accessed by the Printer).  I have to  send command to the PLC that triggers the printer then printer take these files. After these cycle complete, I replace the files with the File Copy Function then again printer is triggered by the PLC - command.  If the PLC command sent after the file transfer sequence, the PLC will immediately triggers the printer to print the file. I have nearly 500ms of time to transfer two of these files.
    All i want to know is File Copy function completes its job after transfer or it just commands to do so. I should not give the command to plc while file tranfer in progress.
    Also please tell me is it possible to monitor the file being transfered ?
    Thanks & Regards
    Sridhar

  • Which is the best way for creating video placeholders in AE?

    I should create some video placeholder for AE animation, but I am not sure which is the best approach to do that.
    I found some tutorials on the web where is explained how to create basic placeholders in AE, but I want to do something better.
    Could I create some placeholder even in Photoshop? And after that to import this psd files into AE.
    I saw some intersting placeholders on Videohive but I don't know how to create something similar?
    Any help?
    Regards!

    Any layer may be replaced with new footage by simply selecting the layer you want to replace in the composition, then selecting the new footage in the project panel, then holding down the Alt/Option key and dragging the new footage to the composition.
    If you want to automate the process of replacing footage you'll have to use a script.
    If you want to use a project as a template then simply copy the template file in it's folder and paste it into a folder that contains the same structure as the template. IOW, the folders should look like this:
    Template Project
         >template.aep
         >Footage
    New project
         >copiedtemplate.aep
         >Footage
    Your footage has to have the same filename as the original template project.
    You can also save an AE project as a template (aet) project. That's what they are doing on siges like Video Hive. The template isn't easily overwritten so it maintains the work. Then you simply add your footage using the first technique that I talked about.

  • What is the best way to include an xml file in JSP?

    I have a jsp page that I need to include an xml file. The xml file
              uses an xsl to render the file. What is the best way to include the
              xml file and still maintain the structure of the style sheet?
              Thanks
              Jennifer
              

              The best way is using the tag lib. If you cannot, but you can use JAXP, you can
              try
              javax.xml.transform.Transformer.transform(Source xmlSource,
              Result outputTarget)
              throws TransformerException
              You construct the transformer with you xsl, use you xml file or DOM to form xmlSource,
              and use JSPWriter "out" to form outputTarget (StreamResult). But if your JSP page
              generates the xml itself, tag lib is the only way.
              [email protected] (Jennifer) wrote:
              >[email protected] (Jennifer) wrote in message news:<[email protected]>...
              >> I have a jsp page that I need to include an xml file. The xml file
              >> uses an xsl to render the file. What is the best way to include the
              >> xml file and still maintain the structure of the style sheet?
              >>
              >> Thanks
              >>
              >> Jennifer
              >
              >Or is there a way to parse the xml file with the jsp page to display
              >the information. I cannot use the Java Standard Tag Libraries as the
              >version of iplanet we are running does not support the JSTL
              >
              >Thanks
              >
              >Jennifer
              

  • What is the best way to sort an XML document in WLI 8.1?

    I have the schema for the XML and I want to sort the data. What is the best way to do this?

    I'm not sure if you want the result of the sorting to be a sorted XML document or a sorted object tree but anyway both XSLT and XQuery support sorting so you could use a Transformation control to execute an XQuery or XSLT transformation to sort the data. Another option (if you are not comfortable writing XQuery or XSLT) would be to use XmlBeans and programmatically sort the data. A word of warning though, these processes are quite memory intensive and if the XML document you are sorting is large (say over 10 MB) your server might run out of memory. In this case you might be better of just parsing the document with SAX and then sorting the result objects.

  • Which is the best way to edit this program and make it read 1 sample from each channel?

    The original program was made with Traditional NI-DAQ. I have edit it to DAQmx the best that i could. The program it's already applying the voltages that are generate in the code(Daqmx Write.vi). But i'm having problems with acquiring voltages it's giving me rare readings(Daqmx Read.vi)  i don't know if i have to make a (Daqmx Start Task.vi) for each channel in the program or if i can make it work with a single one. Notice i have not make many significant changes because this program is already running in another lab and they give to us the program so we didn't have so much problems but instead of getting the BNC-2090 they got the BNC-2090A that uses DAQmx instead of Traditional. So anyone can help?
    Solved!
    Go to Solution.
    Attachments:
    2 Lock-In, 2 V Amp, Vd Amp - 090702(MTP).vi ‏100 KB
    2 Lock-In, 2 V Amp, Vd Amp - 090702(MTP)new.vi ‏107 KB

    A BNC-2090 is just a connector block.  It has no effect on whether you need to use DAQmx or traditional DAQ.  That is determined by the DAQ card you are connecting the terminal block too.
    You might be referring to this document Differences Between the BNC-2090 and BNC-2090A Connector Blocks, but that is just saying to the change in the labels of the terminal block to accurately reflect the newer DAQ cards.
    What problems are you having with the new VI you just posted?  Are you getting an erro rmessage?  I don't know what "rare readings" mean.
    You really shoud look at some DAQmx examples in the example finder.  Some problems you are having is that your DAQ blocks are all sort of disconnected.  Generally, you should be connecting the purple wire from your create task function, throught the start, read or write, and on to the close task.  Many of your DAQ functions are just sitting out there on little islands right now.  You should also be connecting up your error wires.
    With DAQmx, you should be combining all of your analog channels in a single task.  It should look something like Dev0/AI0..AI7.  Then use an N channel 1 sample DAQmx read to get an array of the readings, which you can then use index array to break apart.
    Other things you should do is replace the stacked sequence structures with flat sequence structures.  Turn on AutoGrow for some of your structures such as the loops.  In the end, you might find you can eliminate some sequence structures.

Maybe you are looking for