The analysis via an XML file

Hello

I work with an XML file that is generated through the API of Google Books.  I'll apologize in advance if I don't get quite accurate XML terminology - it's my first foray into some of the tags XML see  I'm reading a XML file in and attempt to send data:

"< cfhttp url = 'http://www.google.com/books/feeds/volumes?q=john+grisham+the+firm & min-viewability biased =" method = "GET" > "

< CFSET xmlfile = xmlparse (cfhttp.filecontent) >


< cfset xmlsize = arraylen (xmlfile.feed.entry) >


< cfloop from = "1" = "" #xmlsize # "index ="a">"

< b > title: #xmlfile.feed.entry [a].title.xmlText # < /b > < br >
< b > Format: #xmlfile.feed.entry [a].format.xmlText # < /b > < br >
< b > author: #xmlfile.feed.entry [a].creator.xmlText # < /b > < br >
< b > identifier1: #xmlfile.feed.entry [a].identifier.xmlText # < /b > < br >
< b > identifier2: #xmlfile.feed.entry [a] .identify [2] .xmlText # < /b > < br >

< / cfoutput >
< / cfloop >

It works pretty well.  Here's the problem: there is often a third identifier field (xmlfile.feed.entry [a] .identify [3] .xmlText)- but not always.

I'm testing the existence of this field before you post.  I tried the following:

< CFIF isdefined("xmlfile.feed.entry[a].identifier[3].xmlText") >
is defined

< CFELSE >

is not defined
< / cfif >

Gives the typical error:

Parameter 1 of function IsDefined, which is now xmlfile.feed.entry [a] .identify [3] .xmlText, must be a valid variable name syntactically.

I would use structkeyExists, but I can't understand how the third node (?) using the reference code:

< cfif structKeyExists(xmlfile.feed.entry[a],"identifier") > only works for xmlfile.feed.entry [a] .identify [1] .xmlText

< cfif structKeyExists(xmlfile.feed.entry[a],"identifier[3]") > is not valid.

So with strucktkeyexists, I can not understand how to properly reference the name of the variable...

Any help?  Or the best ideas to verify the existence of this variable?

The node you are looking at is an array, so:

you need to do. At the present time, you test for the attribute 'xmltext' rather than to check its node parent exists.

HTH.

Tags: ColdFusion

Similar Questions

  • Get the table to an XML file with several bays

    Hello

    So I was faced with this program I have for the past few months but I'm almost there. I have a program that creates several berries and place one after the other in an xml file, and each table has its unique name. Now, I would create a VI that takes this XML file and when the user enters the name of the table specific they are seeking it goes into the xml file concludes the table in its entirety under this name and displays in an indicator of output to be read on the VI. A sample of my xml file and the VI that creates this xml file is attached.

    Thank you

    dlovell

    Something like this should work for you.

  • With the help of several xml files to complete the 1 form.

    Hi all

    Thank you for reading this.

    My scenario is that I have a form which is the inspection report for a product.

    Once the technician has completed its inspection they fill out the form and send it (which saves the form as xml data in a specific folder on our network.

    Now 1 customer may have up to 10 items to be inspected on a single order. What I have to do is to create a customer report showing them the necessary work on their items.

    Basically, I need to be able to import up to 10 xml files of inspection report in 1 report form.

    I was looking for this with the authorities, but I'm wrong.

    I can get 1 data file imported by using xfa.host.importdata("filename")

    but this method seems to reset the form after the first call to the second instance of the form in the form of report receives all the data. (if this makes no sense at all)

    How can I configure my report form so I can fill different instances of the subform from different xml files?

    that is my xml files names are formatted with call number and line number, e.g. 42E11134 - 5.xml would call no. 42E11134 line 5.

    the folder on the network would have to be 42E11134-10 42E11134-1 (not superior because we cap the maximum points on the same order)

    I need to figurentsur instance subform 1, 42E11134-5 42E11134-1 data displayed on the subform instance 5 etc etc and also recognition of the number of necessary instances (but this could be selected by the user).

    If the authorities do not work I am happy to have 10 separate subforms with different names, but must exist within a single form.

    You can only import a single XML file. You have an xml file that has multiple instances of data, but it must be a single xml file.

    So you should find a way to combine all these into a single xml files then do the import.

    Paul

  • Need help with the help of an xml file for changes in the system profile

    I'm looking to accelerate the deployment of new rack-mounted servers by updating their server through xml import profile information and I'm stuck.

    I am able to successfully export the profile as an XML to NFS.

    I'm not having luck changing data to import.

    My first attempt great base is simply by changing the name of drac.

    Here are the contents of the xml file that I am trying to import:

    ");" >
    laboratories-001-dev-a01 - dc1.example .net
    The job fails.

    Any ideas on what I am doing wrong?

    Hi Martin,

    I found my problem.

    In the GUI, you can enter a COMPLETE domain like something.example.com name in DNS Rac name field.

    Who will fail via importing a racadm as apparently a. is not allowed during the updating of the attribute "NIC.1 #DNSRacName".

    Is this a bug of the DRAC?

  • The oldest FCP7 project XML file import problem

    We have an older documentary project which was originally first editing in Final Cut 7, and strive to put first. I exported successfully the whole project from FCP to a XML file (latest version - 5 I think) when you import the XML file, I get the following message: "this project contained a sequence that could not be opened. No preview of the sequence is preset file or codec might be associated with this type of sequence. "Even though we had very many sequences and tons of clips, anything at all in there. Any ideas what could happen?

    I was able to solve the problem in first just update to the latest version via Adobe Cloud.

  • Approach to analyze the large number of XML files in the relational table.

    We are studying the possibility of XML DB to treat a large number of files from same day.
    The goal is to parse the XML file and store it in several relational tables. Once in the relational table don't care us about the XML file.
    The file cannot be stored on the file server and must be stored in a table before analysing because of security concerns. A third-party system will send the file and it will store in the XML database.
    The file size can be between 1 MB to 50MB and high performance is very that much is expected of other wise men, that the solution will be discarded.
    Although we have no of XSD, the XML file is well structured. We are 11g Release 2.

    Based on the reading, that's what my approach.
    1. CREATE THE DONNEES_XML TABLE
    (xml_col XMLTYPE)
    XMLTYPE xml_col STORE AS BINARY XML NAVIGATION;

    2. third will store the data in the donnees_xml table.
    3. create XMLINDEX on the unique XML element
    4 create XMLTYPE views
    CREATE OR REPLACE FORCE VIEW (V_XML_DATA)
    SType,
    Mtype,
    MNAME,
    ROT
    )
    AS
    SELECT x."Stype"
    x."Mtype."
    x."Mname"
    x."ROT".
    OF data_table t,.
    XMLTABLE)
    ' / SectionMain'
    PASSAGE t.data
    COLUMNS Stype VARCHAR2 (30) PATH "Stype"
    Mtype VARCHAR2 (3) path "Mtype."
    MNAME VARCHAR2 (30) PATH "MNAME"
    ROT VARCHAR2 (30) PATH "OID") x;

    5. loading mass analysis of data in the staging table based on the column in the index.

    Please comment on the process that precedes any suggestions that can improve the performance.

    Thank you
    AnuragT

    PASSAGE t.xml_col<--WHAT will="" passing="" here="" since="" no="">

    If you are using an XMLType Table, instead of an XMLType column reference, you are referring to the contents of XMLType while using the NICKNAME "OBJECT_VALUE" column

    If--> t.object_value

  • How to make src of the image of the place holder something xml file

    Hello
    im doing xslt on xml file and I want to store the path to the image on an element of the xml file and display the image on the page how?
    I can write about the CBC textbox like any expression xml xml string how?

    > im doing xslt on xml file and I want to keep the image on an element path
    > XML file and display the image on the page how?
    > can I write on the CBC textbox like any expression xml xml string how?

    I'm a little confused, but if you transform XML via XSLT, then
    You must create the link of the image via the XSLT file:

    Assuming that you store in an XML file name of the image node
    "imageFileName":

    -Darrel

  • The analysis of an XML string

    Hi, I wonder if it is possible to skip creating a physics .xml file and parse the XML message I receive directly?

    normally, it takes

    builder.parse(fileConn.openInputStream());
    

    but it is not possible to open an InputStream on a string...

    ByteArrayInputStream built from String.getBytes () [or whatever we call.]

    It implements something like the idea of stringstream c ++.

  • iOS: problem with loading the content of an xml file placed on a server

    So, I have an app that loads a few small things (pictures and text) of a xml/php file on the server. Everything works fine on both android and in the flash debugger, but when I install the ipa file on my iPhone my IOErrorEvent displays an error message. When the xml file and example photos come with the app (they are not on the server, but in the ipa file) everything works perfectly. There is something about iOS that prevents me to load all the data from the server, it seems. There must be a way around it.

    I would be grateful for advice.

    Kind regards

    Array must be table.

  • How to store data instead of memoryengine to the database when using XML file

    Hi Experts,


    I doubt that in XML for transferring data from the database.
    Transfer of data from XML to the database tables will be store in memory for xml files, my goal is instead stored in the memory table engine
    is it possible to store the data in the database itself...
    I guess that when the size of the data increases say for example given huge amount, store as much data is the big issue here on the right, so to avoid this, is it possible to store
    These data directly in the database level.

    Please understand my requirement, either I have the explanation regarding my requirement and please help me how to do this job...


    THX,
    Sara.

    Remove the dp_doc = option Y of your url. It removes the schema whenever a new connection is created.
    If you don't want to truncate the tables, I think you should also add the option dp_tbl = N.

    Kind regards
    JeromeFr

  • Help (recovery of the image of an xml file name, then appear inside the movieclip

    Hello guys, I just want to ask sometihng about the display of the image inside the movieclip by pulling on the image name in the xml file.

    It comes to my xml file.

    <? PHP

    Header ("Content-type: text/xml");

    $host = "localhost";

    $user = 'root ';

    $pass = "";

    $database = "test";

    $gelo = "image1.jpg";

    / * xml output * /.

    $xml_output = ' <? XML version=\"1.0\? > ';

    $xml_output. = "< GALLERY > ';

    $xml_output. = '< IMAGE > '. $gelo. "< / IMAGE >";

    $xml_output. = "< / GALLERY > ';

    echo $xml_output;

    ? >

    This is the code inside my actionscript

    stage.scaleMode = StageScaleMode.NO_SCALE;

    var loader: URLLoader = new URLLoader();

    loader.dataFormat = URLLoaderDataFormat.TEXT

    loader.addEventListener (Event.COMPLETE, loadCompleteHandler);

    loader.load (new URLRequest ("http://localhost/loadimagefromxmlAS3/data.php"));

    function loadCompleteHandler(event:Event):void {}

    var xml = new XML (event.target.data);

    txt.text = xml.toXMLString ();

    trace (xml. IMAGE [0]);

    var list: XMLList = xml.data.title

    var loader: Loader = new Loader()

    This ["holder_mc" + 0]. AddChild (Loader)

    Loader.Load (new URLRequest (list [0]. IMAGE))

    }

    When I run it in flash, I got the error


    Image1.jpg

    TypeError: Error #1010: a term is undefined and has no properties.

    at xml_fla::MainTimeline/loadCompleteHandler()

    at flash.events::EventDispatcher/dispatchEventFunction()

    at flash.events::EventDispatcher/dispatchEvent()

    at flash.net::URLLoader/onComplete()

    I hope you will consider my ignorance since im a beginner with actionscript. Thank you

    (1) you should have "Permit debugging" enabled in the settings of publication so you could tell exactly the line of witch will not

    (2) this line makes no sense for me: var list: XMLList = xml.data.title

    Change it to var list: XMLList = xml. IMAGE;

    (3) loader.load (new URLRequest (list [0] m:System.NET.SocketAddress.ToString (()));

    (4) also this line is suspicious: this ["holder_mc" + 0] .addChild (loader)

    Why not just say: holder_mc0.addChild (loader)?

  • How to make a backup in the Flash iphone ios xml file?

    Hi, I'm looking for a way to pause for an ipad app, when you press the home button. If you exit the application, you can return
    the place that you were in.

    Is there a toggle in flash CS5.5 who does that? If not, is there an AS3 code that I can put in my first image?

    I saw the code below on a post recently, if I think I he would insert near the bottom of the XML file. But every time I have to change this option and

    re-publish the FLA, it comes up with errors.

    I would like to a setback of this code below - instead of out, take a break. and also need to know exactly where to put it?

    "When a user switches away an AIR application it penetrates in the back and stops." If you want that your application for leave completely rather than take a break, set the YES UIApplicationExitsOnSuspend property'

    < key > UIApplicationExitsOnSuspend < / key >

    < string > No. < / string >

    Anyone who has a simple solution for this? Thank you!

    It is not dependent on air wedged in your system, it is simply based on package manager you use. If you use a CS5.5 trial download, then the second line of the xml app descriptor should read as follows:

    http://ns.Adobe.com/air/application/2.6">

    That would show that it is AIR 2.6.
  • How to get the number of a xml file in flash?

    Hello

    It comes to my XML file

    <? XML version = "1.0"? >

    < ArrayHolder >

    < level1 > '1', '1', '1' < / level1 >

    < level2 > 2,2,1,2,2 < / level2 >

    < level3 > 1,3,3,3,1 < / level3 >

    < / ArrayHolder >

    I want to store level1 not in 'levelArray '.

    Thank you

    JaxNa

    you always have a quote but once it is fixed, divide each value of the node on the commas and then loop in the table pouring each element to a number.

  • The analysis of a script file name

    Hello

    I am now taking the name of image file and analyzed so that I only get the number of poses to the left. For example: the name of the file is Jones12345_002.jpg. I want only the file name 002 part. I have watched the addfilename scripts but have not found anything that will separate the name.

    I tried this code, but it seems to ignore the analysis code, I added:

    startup code

    This script is a variant of the script addTimeStamp.js, which is installed with PH7

    If (documents.length > 0)
    {
    var originalRulerUnits = preferences.rulerUnits;
    preferences.rulerUnits = Units.PIXELS;

    Try
    {
    var docRef = activeDocument;

    Now create a layer of text on the front
    var myLayerRef = docRef.artLayers.add ();
    myLayerRef.kind = LayerKind.TEXT;
    myLayerRef.name = "Filename";

    var myTextRef = myLayerRef.textItem;

    Strip extension
    var fileNameNoExtension = docRef.name;
    fileNameNoExtension = fileNameNoExtension.split (".");
    If (fileNameNoExtension.length > 1) {}
    -fileNameNoExtension.length;
    }
    fileNameNoExtension = fileNameNoExtension.join(".");

    myTextRef.contents = fileNameNoExtension;

    test cut filename to last 3 characters

    sFileName var = "";
    yStr = myTextRef.contents;
    function getFname (yStr) {}

    for (= yStr.length - 1; nloop nloop > 1; nloop-) {}
    If (yStr.charAt (nloop) == '_') {}
    sFileName = yStr.substring (nloop + 1, yStr.length);
    break;
    }
    }
    return sFileName;

    }
    myTextRef.contents = sFileName;

    finish cutting filename to last 3 characters


    Set the text to be in the Middle
    myTextRef.position = new Array (docRef.width / 2, docRef.height / 2);
    myTextRef.size = 20;
    }
    catch (e)
    {
    An error has occurred. Restore units of the rule, and then spread the error return
    to the user
    preferences.rulerUnits = originalRulerUnits;
    throw e;
    }

    Everything went well. Restore units of the rule
    preferences.rulerUnits = originalRulerUnits;
    }
    on the other
    {
    Alert ("you must have a document open to add the file name! ');
    }

    end of the code

    Thanks for any help

    Here's your code with the change...

    if ( documents.length > 0 )
    {
    var originalRulerUnits = preferences.rulerUnits;
    preferences.rulerUnits = Units.PIXELS;
    try
    {
      var docRef = activeDocument;
      // Now create a text layer at the front
      var myLayerRef = docRef.artLayers.add();
      myLayerRef.kind = LayerKind.TEXT;
      myLayerRef.name = "Filename";
    
      var myTextRef = myLayerRef.textItem;
    
      // strip the extension off
    var Name =  decodeURI(docRef.name).replace(/\.[^\.]+$/, '');
    var fileNameNoExtension = Name.match(/\d+$/).toString();
    myTextRef.contents = fileNameNoExtension;
      // off set the text to be in the middle
      myTextRef.position = new Array( docRef.width / 2, docRef.height / 2 );
      myTextRef.size = 20;
    }
    catch( e )
    {
      // An error occurred. Restore ruler units, then propagate the error back
      // to the user
      preferences.rulerUnits = originalRulerUnits;
      throw e;
    }
    // Everything went Ok. Restore ruler units
    preferences.rulerUnits = originalRulerUnits;
    }
    else
    {
    alert( "You must have a document open to add the filename!" );
    }
    
    //end code
    
  • Export the ArrayCollection collection in XML file

    Hi all

    Is it possible to export a Flex ArrayCollection collection to an XML file.

    My collection of table is displayed in a datagrid as follows

    < mx:DataGrid = "360" x y = "120" width = "448" height = "200" dataProvider = "{questionsArr}" >
    < mx:columns >
    < mx:DataGridColumn headerText = "Issue" dataField = "issue" / >
    < mx:DataGridColumn headerText = dataField "Start" = "start" width = "40" textAlign = "center" / >
    < mx:DataGridColumn headerText = "Stop" dataField = "stop" width = "40" textAlign = "center" / >
    < / mx:columns >
    < / mx:DataGrid >

    And I want to output the XML to look like this

    < cue >
    "< question section =" "start =" "stop =" "/ >
    "< question section =" "start =" "stop =" "/ >
    "< question section =" "start =" "stop =" "/ >
    < / cue >

    Is this possible?  I mean all the data is ready, he just needs to be saved. .

    Hi djh88ukwb,

    Try something as shown below in the link by performing a loop through the arraycollection collection and forming the knots... the way you need...

    http://nsdevaraj.WordPress.com/2008/08/20/ArrayCollection-XML/

    Thank you

    Jean Claude Chari

Maybe you are looking for