XML and DataGrid

Hi,
I am working with the XML files and here is my question.
This is the portion of the XML file
you can acess my xml file at
http://pastebin.com/f66fd1ee3
My XML file keeps changing and the number of action_column
nodes may vary for each xml file.
I am trying to display the xml file in the grid using
http://pastebin.com/f2e57f382
public function LabelFunc(item:Object,
column:DataGridColumn): String
return
item.action_column.(@column_number==column.dataField).@column_value;
So is there a way to know how many action_column nodes are
there and based on that can I do the datagrid dynamically?

You can get a list of all attributes by calling attributes().
You can use that info the generate an array of
DataGridColumns

Similar Messages

  • Problems with XML and Datagrid!

    Hi!
    Trying to follow a similar idea to the app shown on the flex
    homepage - i have the following code:
    [code]
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    creationComplete="srv.send()">
    <mx:HTTPService id="srv"
    url="lab-cs3.cs.st-andrews.ac.uk/~aa322/mytube.xml"/>
    <mx:DataGrid
    dataProvider="{srv.lastResult.videos.video}"/>
    </mx:Application>
    [/code]
    However, when I run the application - it gives the following
    error:
    [RPC Fault faultString="Error #2148: SWF file
    file:///C:/Documents and Settings/Andy/My Documents/Flex Builder
    3/HelloWorld/bin-debug/HelloWorld.swf cannot access local resource
    lab-cs3.cs.st-andrews.ac.uk/~aa322/mytube.xml. Only
    local-with-filesystem and trusted local SWF files may access local
    resources." faultCode="InvokeFailed" faultDetail="null"]
    at mx.rpc::AbstractInvoker/
    http://www.adobe.com/2006/flex/mx/internal::invoke()[E:\dev\3.0.x\frameworks\projects\rpc\ src\mx\rpc\AbstractInvoker.as:263
    at mx.rpc.http.mxml::HTTPService/
    http://www.adobe.com/2006/flex/mx/internal::invoke()[E:\dev\3.0.x\frameworks\projects\rpc\ src\mx\rpc\http\mxml\HTTPService.as:234
    at
    mx.rpc.http::HTTPService/send()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\http\HTTP Service.as:758]
    at
    mx.rpc.http.mxml::HTTPService/send()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\http \mxml\HTTPService.as:217]
    at
    HelloWorld/___HelloWorld_Application1_creationComplete()[C:\Documents
    and Settings\Andy\My Documents\Flex Builder
    3\HelloWorld\src\HelloWorld.mxml:2]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at
    mx.core::UIComponent/dispatchEvent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\co re\UIComponent.as:9051]
    at mx.core::UIComponent/set
    initialized()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:1167]
    at
    mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\3.0.x\frameworks\projects\frame work\src\mx\managers\LayoutManager.as:698]
    at Function/
    http://adobe.com/AS3/2006/builtin::apply()
    at
    mx.core::UIComponent/callLaterDispatcher2()[E:\dev\3.0.x\frameworks\projects\framework\sr c\mx\core\UIComponent.as:8460]
    at
    mx.core::UIComponent/callLaterDispatcher()[E:\dev\3.0.x\frameworks\projects\framework\src \mx\core\UIComponent.as:8403]
    and fails to connect to the xml i think.
    Any ideas on what I am doing wrong?!
    Thanks
    Andy

    You need to specify the full URL. I would also suggest using
    a result handler to assign the xml to your DataGrid dataProvider.
    Below is a sample. I set the resultFormat to e4x, which is XML.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute" creationComplete="srv.send()">
    <mx:HTTPService id="srv"
    url="
    http://lab-cs3.cs.st-andrews.ac.uk/~aa322/mytube.xml"
    result="videoListLoaded(event)"
    resultFormat="e4x"/>
    <mx:Script>
    <![CDATA[
    import mx.rpc.events.ResultEvent;
    [Bindable] private var videoList:XML;
    private function videoListLoaded(evt:ResultEvent):void {
    videoList = evt.result as XML;
    ]]>
    </mx:Script>
    <mx:DataGrid x="10" y="10" id="videos_dg"
    dataProvider="{videoList.video}">
    <mx:columns>
    <mx:DataGridColumn width="200" headerText="label"
    dataField="label"/>
    <mx:DataGridColumn width="300" headerText="URL"
    dataField="url"/>
    <mx:DataGridColumn width="50" headerText="views"
    dataField="views"/>
    <mx:DataGridColumn width="150" headerText="Category"
    dataField="category"/>
    </mx:columns>
    </mx:DataGrid>
    </mx:Application>
    Vygo

  • Transforming xml and DataGrids

    Hello
    I am reading data from a large xml file. I read it in using
    HTTPService and the result type is "E4X". It contains information
    about items in a warehouse.
    like this
    <Inventory>
    <warehouse name="Texas">
    <chairs count="900"/>
    <tables count="40"/>
    <lamps count="200"/>
    </warehouse>
    <warehouse name="California">
    <chairs count="20"/>
    <tables count="200"/>
    <lamps count="1"/>
    </warehouse>
    </Inventory>
    So far I have been able to show a list of warehouses in a
    mx:List control and then when I select a warehouse (texas in this
    case) I would like to display the list of items and their counts in
    an mx:DataGrid control.
    I can see that I can use selectedItem of the mx:List to
    return the Node for the Texas warehouse like this
    <warehouse name="Texas">
    <chairs count="900"/>
    <tables count="40"/>
    <lamps count="200"/>
    </warehouse>
    But how can I get the data to display in a data grid
    ITEM COUNT
    chairs 900
    tables 40
    lamps 200
    Thanks
    Todd

    Not familiar with stxx, but it should allow you the use of the xsl:strip-space instruction or some equivalent, when the XSLT is applied to the XML for transformation...

  • Problem With XML and DataGrid)

    Hi,
    I do have a question how to get my XML data in the appropriate way into my DataGrid. I wrote a labelFunction to get the data into the grid but I still have the problem that the length of the DataGrid depends on the dataProvider and I can't find a way to specify that it should depend on a child object of the dataProvider.
    If you look at the structure of the XML file you can see that for every date a couple of hours exist (normally 24 ) and measurements coming in every hour. So, naturally I would like to show the measurements in connection to the hour. The column 'Date' and 'Time' will be merged anyway to something like '23/2:10-11'. So, if it is easier to combine these values first and create that way a unique date I would be also happy.
    However, the XML file and the Flex code you find at http://www2.dmu.dk/thob/Station_Nord/srcview/index.html and the Flex application you find at http://www2.dmu.dk/thob/Station_Nord/Station_Nord.html.
    Thanks for your help in advance,
    Thomas

    I don't want to analyze that example. Are you asking how to
    get an id or some other value when you select a row in a datagrid?
    When you select an item in any list-based control, the
    control's selectedItem properety contains a reference to the
    dataProvider item object for that selected item. You can access any
    property that is present in that object:
    var sId:String = myDataGrid.selectedItem.myIDProperty;
    If I have misunderstood, please restate your question.
    Tracy

  • XML and Air Issues

    Hi guys, first time poster so I apologize if this is a basic
    question! I am creating a Media cataloging application to run as a
    desktop application through Air, I initially built this as a Flex
    web app but have decided I want it as a standalone. Anyway my
    problem is this, in the web version I was using the following code:
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute" creationComplete="srv.send()"
    xmlns:ns1="com.dougmccune.containers.*"
    backgroundGradientAlphas="[1.0, 1.0]"
    backgroundGradientColors="[#FFFFFF, #2CE1AC]" width="1281">
    <mx:HTTPService id="srv" url="dvdLibrary.xml"/>
    <mx:DataGrid x="336" y="57"
    dataProvider="{srv.lastResult.dvdList.dvd}" id="dg" width="935"
    height="354">
    <mx:columns>
    <mx:DataGridColumn headerText="Title"
    dataField="title"/>
    <mx:DataGridColumn headerText="Studio"
    dataField="studio"/>
    <mx:DataGridColumn headerText="Released"
    dataField="releaseDate"/>
    <mx:DataGridColumn headerText="Runtime"
    dataField="runtime"/>
    <mx:DataGridColumn headerText="Colour"
    dataField="color"/>
    <mx:DataGridColumn headerText="Aspect Ratio"
    dataField="aspectRatio"/>
    </mx:columns>
    </mx:DataGrid>
    The above code uses the XML file to populate the dataGrid
    (which I am sure you know already! :) ), however when I port this
    to an Air app, it no longer works. I have tried changing the
    <mx:HTTPService> tag and attributes to the <mx:XML
    source="pathtoXML.xml" id="srv"/> and <mx:Model
    source="pathtoXML.xml" id="srv"/> but neither works.
    Can anyone shed any light? I also get and error saying
    something about creationComplete send() is not a function?
    Is there a very different way of achieving this in Air?
    Thanks in advance!

    Hi guys, first time poster so I apologize if this is a basic
    question! I am creating a Media cataloging application to run as a
    desktop application through Air, I initially built this as a Flex
    web app but have decided I want it as a standalone. Anyway my
    problem is this, in the web version I was using the following code:
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute" creationComplete="srv.send()"
    xmlns:ns1="com.dougmccune.containers.*"
    backgroundGradientAlphas="[1.0, 1.0]"
    backgroundGradientColors="[#FFFFFF, #2CE1AC]" width="1281">
    <mx:HTTPService id="srv" url="dvdLibrary.xml"/>
    <mx:DataGrid x="336" y="57"
    dataProvider="{srv.lastResult.dvdList.dvd}" id="dg" width="935"
    height="354">
    <mx:columns>
    <mx:DataGridColumn headerText="Title"
    dataField="title"/>
    <mx:DataGridColumn headerText="Studio"
    dataField="studio"/>
    <mx:DataGridColumn headerText="Released"
    dataField="releaseDate"/>
    <mx:DataGridColumn headerText="Runtime"
    dataField="runtime"/>
    <mx:DataGridColumn headerText="Colour"
    dataField="color"/>
    <mx:DataGridColumn headerText="Aspect Ratio"
    dataField="aspectRatio"/>
    </mx:columns>
    </mx:DataGrid>
    The above code uses the XML file to populate the dataGrid
    (which I am sure you know already! :) ), however when I port this
    to an Air app, it no longer works. I have tried changing the
    <mx:HTTPService> tag and attributes to the <mx:XML
    source="pathtoXML.xml" id="srv"/> and <mx:Model
    source="pathtoXML.xml" id="srv"/> but neither works.
    Can anyone shed any light? I also get and error saying
    something about creationComplete send() is not a function?
    Is there a very different way of achieving this in Air?
    Thanks in advance!

  • Display xml in Datagrid

    Hi All,
    After fiddling this for almost a week, I finally come in seek
    of assistance and advice. let me explain my requirement as clearly
    as I possibly can. before you even proceed further, please make
    sure you a aware of the following:
    importing xml into flash
    usnig the XPathApi
    using datasets and Datagrids
    Summary
    I have a complex XML file (refer link below) that is
    generated from a database. my client wants these generated data to
    be displayed in a presentable format so that any visitor using this
    application can instantly get the data by querying into the XML
    File.
    I tried doing this with XML and XSLT i was able to display
    the data in a presentable format. but I faced an issue. I was
    unable to place a form text field and a submit button, so that the
    user gets the freedom to filter the data that he needs.
    So I seeked some advice on this topic at US and I was
    suggested to use XPathApi, after reading the documentation and some
    fiddling, I found a way to extract the data that i was supposed to
    retrieve. but now I face a new problem. since the XML is a bit
    complicating (for me at least). I found difficulties in displaying
    the extracted data to the data grid.
    I have attached the flash source file (v8) and (some what
    similar) the XML files for your reference. would appreciate if
    someone could help me achieve the objective. if you think there is
    another alternative to XPathApi, I willing to try it out.
    Try-out
    Currently the retrieval of the data is working perfectly, for
    example you can perform a query to list all the books that were
    published by 'Wrox' by entering the query in the text field, you
    will see the results in the "Trace" window.
    Source
    TIA

    "lerogke" <[email protected]> wrote in
    message
    news:go8i77$8og$[email protected]..
    > Hi again,
    >
    > i could resolve something, using labelfunction like
    this:
    >
    > private function getValue(item:Object,
    column:DataGridColumn):String{
    > return item.params.param.@value;
    > }
    >
    > This functions gives me all the values of the params but
    consecutive
    > without
    > any space between them.
    >
    > How could i look around each param to put space or some
    text between them
    > to
    > display in Datagrid?
    for each (param in
    item.child('params').child('param').attribute('value)){
    //stuff

  • Without data in textfield and datagrid if i click add or delete button it should through msgbox

    hi friends ,,
                     i am new to flex i am doing a application in flex4,i need help from this, i have two text inputs and one datagrid, and one add button and delete button.
    my requirement is without data if i click add or delete it should through error box how to do that,
    In 3 condtition it should  thorugh error or msg box;
    conditions are,
                      1.both textinputs and datagrid----> click (add or delete)--->error or msg box
                       2.both textinputs dont have value and datagrid have values----> click (add or delete)--->error or msg box
                       3..both textinputs  have value and datagrid  dont have values----> click (add or delete)--->error or msg box
    any suggession or snippet code are welcome
    Thanks in advance,
    B.venkatesan.

    Hi,
    Please try following code:
    <?xml version="1.0" encoding="utf-8"?><s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="
    library://ns.adobe.com/flex/spark" xmlns:mx="
    library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
     <fx:Declarations>
     <!-- Place non-visual elements (e.g., services, value objects) here -->
     </fx:Declarations>
     <fx:Script>
    <![CDATA[
     import mx.collections.ArrayCollection; 
    import mx.controls.Alert; 
    public function check():void{ 
    if(input1.text=="" || input2.text=="" || Dg1.dataProvider==""){
    Alert.show(
    "Enter the text boxes and DataGrid.");}
    else{Alert.show(
    "Do not Enter the text boxes DataGrid."); 
    ]]>
    </fx:Script>
     <s:TextInput x="77" y="107" id="input1"/>
     <s:TextInput x="254" y="107" id="input2"/>
     <mx:DataGrid x="80" y="150" id="Dg1">
     <mx:ArrayCollection>
     </mx:ArrayCollection>
     </mx:DataGrid>
     <s:Button x="95" y="329" label="Add" click="check()" />
     <s:Button x="290" y="329" label="Delete" click="check()"/></s:Application>
    I am keeping Arraycollection empty for example.Please try when you provide data to Arraycollection.
    Thanks and Regards,
    Vibhuti Gosavi | [email protected] | www.infocepts.com

  • Multiple plugtmp-1 plugtmp-2 etc. in local\temp folder stay , crossdomain.xml and other files containing visited websitenames created while private browsing

    OS = Windows 7
    When I visit a site like youtube whith private browsing enabled and with the add-on named "shockwave flash" in firefox add-on list installed and activate the flashplayer by going to a video the following files are created in the folder C:\Users\MyUserName\AppData\Local\Temp\plugtmp-1
    plugin-crossdomain.xml
    plugin-strings-nl_NL-vflLqJ7vu.xlb
    The contents of plugin-crossdomain contain both the "youtube.com" adress as "s.ytimg.com" and is as follows:
    <?xml version="1.0"?>
    <!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
    -<cross-domain-policy> <allow-access-from domain="s.ytimg.com"/> <allow-access-from domain="*.youtube.com"/> </cross-domain-policy>
    The contents of the other file I will spare you cause I think those are less common when I visit other sites but I certainly don't trust the file. The crossdomain.xml I see when I visit most other flashpayer sites as well.
    I've also noticed multiple plugin-crossdomain-1.xml and onwards in numbers, I just clicked a youtube video to test, got 6 of them in my temp plus a file named "plugin-read2" (no more NL file cause I changed my country, don't know how youtube knows where I'm from, but that's another subject, don't like that either). I just noticed one with a different code:
    <?xml version="1.0"?>
    -<cross-domain-policy> <allow-access-from domain="*"/> </cross-domain-policy>
    So I guess this one comprimises my browsing history a bit less since it doesn't contain a webadress. If these files are even meant to be deposited in my local\temp folder. The bigger problem occurs when they stay there even after using private browsing, after clearing history, after clearing internet temporary files, cache, whatever you can think of. Which they do in my case, got more than 50 plugtmp-# folders in the previous mentioned local\temp folder containing all website names I visited in the last months. There are a variety of files in them, mostly ASP and XML, some just say file. I have yet to witness such a duplicate folder creation since I started checking my temp (perhaps when firefox crashes? I'd say I've had about 50 crashes in recent months).
    I started checking my temp because of the following Microsoft Security Essential warnings I received on 23-4-12:
    Exploit:Java/CVE-2010-0840.HE
    containerfile:C:\Users\Username\AppData\Local\Temp\jar_cache2196625541034777730.tmp
    file:C:\Users\Username\AppData\Local\Temp\jar_cache2196625541034777730.tmp->pong/reversi.class
    and...
    Exploit:Java/CVE-2008-5353.ZT
    containerfile:C:\Users\Noname\AppData\Local\Temp\jar_cache1028270176376464057.tmp
    file:C:\Users\Noname\AppData\Local\Temp\jar_cache1028270176376464057.tmp->Testability.class
    Microsoft Security Essentials informed me that these files were quarantained and deleted but when going to my temp file they were still there, I deleted them manually and began the great quest of finding out what the multiple gigabytes of other files and folders were doing in that temp folder and not being deleted with the usual clearing options within firefox (and IE).
    Note that I have set my adobe flasplayer settings to the most private intense I could think of while doing these tests (don't allow data storage for all websites, disable peer-to peer stuff, don't remember exactly anymore, etc.). I found it highly suspicious that i needed to change these settings online on an adobe website, is that correct? When right-clicking a video only limited privacy options are available which is why I tried the website thing.
    After the inital discovery of the java exploit (which was discovered by MSE shortly after I installed and started my first scan with Malwarebytes, which in turn made me suspicious whether I had even downloaded the right malwarebytes, but no indication in the filename if I google it). Malwarebytes found nothing, MSE found nothing after it said it removed the files, yet it didn't remove them, manually scanning these jar_cache files with both malwarevytes and MSE resulted in nothing. Just to be sure, I deleted them anyways like I said earlier. No new jar_cache files have been created, no exploits detected since then. CCleaner has cleaned most of my temp folder, I did the rest, am blocking all cookies (except for now shortly), noscript add-on has been running a while on my firefox (V 3.6.26) to block most javascripts except from sites like youtube. I've had almost the same problem using similar manual solutions a couple of months ago, and a couple of months before that (clearing all the multiple tmp folders, removing or renaming jar_cache manually, running various antmalware software, full scan not finding a thing afterwards, installing extra add-ons to increase my security, this time it's BetterPrivacy which I found through a mozilla firefox https connection, I hope, which showed me nicely how adobe flash was still storing LSO's even after setting all storage settings to 0 kb and such on the adobe website, enabling private browsing in firefox crushed those little trolls, but still plugtmp trolls are being created, help me crush them please, they confuse me when I'm looking for a real threat but I still want to use flash, IE doesn't need those folders and files, or does it store them somewhere else?).
    I'm sorry for the long story and many questions, hope it doesn't scare you away from helping me fight this. I suspect it's people wanting to belong to the hackergroup Anonymous who are doing this to my system and repeating their tricks (or the virus is still there, but I've done many antivirus scans with different programs so no need to suggest that option to me, they don't find it or I run into it after a while again, so far, have not seen jar_cache show up). Obviously, you may focus on the questions pertaining firefox and plugtmp folders, but if you can help me with any information regarding those exploits I would be extremely grateful, I've read alot but there isn't much specific information for checking where it comes from when all the anti-virus scanners don't detect anything anymore and don't block it incoming. I also have downloaded and installed process monitor but it crashes when I try to run it. The first time I tried to run it it lasted the longest, now it crashes after a few seconds, I just saw the number of events run up to almost a million and lots of cpu usage. When it crashed everything returned back to normal, or at least that's what I'm supposed to think I guess. I'll follow up on that one on their forum, but you can tell me if the program is ligit or not (it has a microsoft digital signature, or the name micosoft is used in that signature).

    update:
    I haven't upgraded my firefox yet because of a "TVU Web Player" plugin that isn't supported in the new firefox and I'm using it occasionally, couldn't find an upgrade for it. Most of my other plugins are upgraded in the green (according to mozilla websitechecker):
    Java(TM) Platform SE 6 U31 (green)
    Shockwave for Director (green - from Adobe I think)
    Shockwave Flash (green - why do I even need 2 of these adobe add-ons? can I remove one? I removed everything else i could find except the reader i think, I found AdobeARM and Adobe Acrobat several versions, very confusing with names constantly switching around)
    Java Deployment Toolkit 6.0.310.5 (green, grrr, again a second java, why do they do this stuff, to annoy people who are plagued with java and flash exploits? make it more complicating?)
    Adobe Acrobat (green, great, it's still there, well I guess this is the reader then)
    TVU Web Player for FireFox (grey - mentioned it already)
    Silverlight Plug-In (yellow - hardly use it, I think, unless it's automatic without my knowing, perhaps I watched one stream with it once, I'd like to remove it, but just in case I need it, don't remember why I didn't update, perhaps a conflict, perhaps because I don't use it, or it didn't report a threat like java and doesn't create unwantend and history compromising temp files)
    Google Update (grey - can I remove? what will i lose? don't remember installing it, and if I didn't, why didn't firefox block it?)
    Veetle TV Core (grey)
    Veetle TV Player (grey - using this for watching streams on veetle.com, probably needs the Core, deleted the broadcaster that was there earlier, never chose to install that, can't firefox regulate that when installing different components? or did i just miss that option and assumed I needed when I was installing veetle add-on?)
    Well, that's the list i get when checking on your site, when i use my own browseroptions to check add-ons I get a slightly different and longer list including a few I have already turned off (which also doesn't seem very secure to me, what's the point in using your site then for anything other than updates?), here are the differences in MY list:
    I can see 2 versions of Java(TM) Platform SE 6 U31, (thanks firefox for not being able to copy-paste this)
    one "Classic Java plug-in for Netscape and Mozilla"
    the other is "next generation plug-in for Mozilla browsers".
    I think I'll just turn off the Netscape and Mozilla one, don't trust it, why would I need 2? There I did it, no crashes, screw java :P
    There's also a Mozilla Default plugin listed there, why does firefox list it there without any further information whether I need it or not or whether it really originates from Mozilla firefox? It doesn't even show up when I use your website plugin checker, so is there no easy way by watching this list for me to determin I can skip worrying about it?
    There's also some old ones that I recently deactivated still listed like windows live photo gallery, never remember adding that one either or needing it for anything and as usual, right-clicking and "visit homepage" is greyed out, just as it is for the many java crap add-ons I encountered so far.
    Doing a quick check, the only homepage I can visit is the veetle one. The rest are greyed out. I also have several "Java Console" in my extentions tab, I deactivated all but the one with the highest number. Still no Java Console visible though, even after going to start/search "java", clicking java file and changing the settings there to "show" console instead of "hide" (can't remember exact details).
    There's some other extentions from noscript, TVU webplayer again, ADblock Plus and now also BetterPrivacy (sidenote, a default.LSO remains after cleanup correct? How do I know that one isn't doing anything nasty if it's code has been changed or is being changed? To prevent other LSO's I need to use both private browsing and change all kinds of restrictions online for adobe flashplayer, can anyone say absurd!!! if you think you're infected and want to improve your security? Sorry that rant was against Adobe, but it's really against Anonymous, no offense).

  • Parsing XML and Storing values in instance variable

    hi,
    i'm new to XML.
    here i'm trying to parse an XML and store their element data to the instance variable.
    in my main method i'm tried to print the instance variable. but it shows "" (ie it print nothing ).
    i know the reason, its becas of the the endElement() event generated and it invokes the characters() and assigns "" to the instance variable.
    my main perspective is to store the element data in instance variable.
    thanks in advance.
    praks
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import javax.xml.parsers.*;
    import org.xml.sax.*;
    import org.xml.sax.helpers.*;
    public class mysax extends DefaultHandler
         String ctelement;
         CharArrayWriter contents;
         String vname1,vrcbreg1,vaddress1,vcountry1,vtelephone1,vfax1;
         String vname,vrcbreg,vaddress,vcountry,vtelephone,vfax;
         public mysax()
              vname1 = null;
              vrcbreg1 = null;
              vaddress1 = null;
              vcountry1 = null;
              vtelephone1 = null;
              vfax1 = null;
              contents= new CharArrayWriter();
         public void doparse(String url) throws Exception
              SAXParserFactory spf = SAXParserFactory.newInstance();
    SAXParser sp = spf.newSAXParser();
    ParserAdapter pa = new ParserAdapter(sp.getParser());
    pa.setContentHandler(this);
    pa.parse(url);          
         public void startElement(String namespace,String localName,String qName,Attributes atts)
              ctelement = localName;     
         public void endElement(String uri,String localName,String qName) throws SAXException
         public void characters(char[] ch,int start, int length) throws SAXException
              try
                   if(ctelement.equals("name"))
                        vname = new String (ch,start,length);
                        System.out.println("The method "+vname1);
              }catch (Exception e)
                   System.out.println("The exception "+e);
         public static void main(String args[])
              try
              mysax ms = new mysax();
              ms.doparse(args[0]);
              System.out.println("the contents name "+ms.vname1);
              catch(Exception e)
                   System.out.println("this is exception at main" +e);
    my XML looks like
    <coyprofile_result>
    <company>     
    <name>abcTech</name>
    <rcbreg>123456789</rcbreg>
    <address>Singapore</address>
    <country>sg</country>
    <telephone>123456</telephone>
    <fax>123155</fax>
    </company>
    </coyprofile_result>

    I believe that the problem has to do with the value you assign to ctelement. You are assigning the value of localName to ctElement, however for the element: <name>...</name> the localname is empty string i.e. "", but qName equals "name". Because you are assigning empty string to ctElement, when you do the comparison in characters of ctElement to "name" it will always be false. So in startElement change it to ctElement = qName; Try it and see if it works. I have produced similar programs and it works for me.
    Hope this helps.

  • New to XML and Oracle

    Just trying to clarify some issues as I try and learn about XML, and specifically how it integrates into the DB.
    1 - Is there a way with Oracle tools for me to get an XSD of an existing 9i relational schema? We are not currently using the XML DB, but our middleware developers would like to have an up to date XSD to use for their internal mapping.
    2 - Is there any way that I can keep that XSD up-to-date automatically, so I get a new one whenever the schema gets updated?
    3 - If I wanted to investigate storing XML docs within the DB in native XML format, I need to have an XML DB, correct? Is this DB construct maintained seperatelly from my "normal" relational schema? or are they kept in sync by Oracle?
    I know these may all be real basic questions, but as I said, I'm new to XML and Oracle. I am reading as much as I can, but there are a lot of docs out there.
    Thanks,
    Mike

    Hi
    1. On my opinion such a tool doesn't exists. Some parts can be implemented elsewhere, but not as described by you... e.g. with XSU if you specify the parameter "withschema" the XSD of the executed statement is generated. Another example is to use DBMS_METADATA to dump the data dictionary in XML (but not XSD, of course you could write your own XSLT to do this transformation...).
    2. -
    3. If you use XSD-based tables the XSD and the relational model are stored separately in the data dictionary. Therefore if you change the XSD you have to drop/create the XSD-based table... no schema evolution yet.
    Chris

  • How to set buildID.xml and custom.properties in SDK

    Hello,
    I just completed a new build deployment of SAP ME5.2, because after I deployed the new version, I don't think I have set a
    correct version number.Can you someone give me a sample how to set the buildID.xml and custom.properties? I am a new on the SAP ME5.2
    The Base version is ME_Base_5.2.5.16.5_netweaver-71_Update.zip and
    MEClient_Base_5.2.5.16.5_netweaver-71_Update.zip. the HB customzation
    version is ME_xxxxxx_2.0.0.0.x_netweaver-71.
    Within the sap note 1484551, you mentioned we need change the
    SDKInstallDir/build/buildID.xml file, here is the context of the file:
    buildID.xml -
    <?xml version="1.0" encoding="UTF-8"?>
    <buildID xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <customer>XXXXXX</customer>
    <revision>1.0.0.0</revision>
    <build>1</build>
    </buildID>
    buildID.xml -
    1. how can we change the revision and build?
    There is another file BuildToolDir/build/script/custom.properties, here
    is the file context:
    custom.properties----
    This file contains build properties used to configure the build
    system.
    The name of the software vendor implementing the customizations.
    vendor.name=xxxxxxxxx
    Vendor build identifier. This value is used to uniquely identify
    customizations built by a particular vendor for a particular customer
    and base
    application version.
    This is also used in path locations and in naming certain build
    artifacts, like the custom EJB module and the utility classes archive.
    vendor.id=xxxxxxxxx
    The installation of the J2EE engine installed in the development
    environment.
    ex. C:/usr/sap/CE1\J00
    j2ee.instance.dir=J2EEInstanceDir
    The web context path used to access the main web application. This
    is used by the build to set the
    context-root value in application.xml after an update has been
    imported.
    web.context.path=
    The web context path used to access the production XML interface web
    application. This is used by the build to set the
    context-root value in application.xml after an update has been
    imported.
    xml.context.path=
    The web context path to access resources from the web extension
    application, like images and work instruction HTML files.
    web-ext.context.path=web-ext
    The target database vendor. Valid values are 'oracle' or 'sqlserver'.db.vendor=ORACLE
    The JDBC driver configured for the application server.
    db.drivername=VMJDBC
    JDBC connection propertes for the WIP (Work In Process) database.
    This is the primary application database.
    db.wip.driverclassname=
    db.wip.driver.url=
    db.wip.host=
    db.wip.port=
    db.wip.sid=
    db.wip.user=
    db.wip.password=
    JDBC connection propertes for the ODS (Open Data Store) database.
    This is the offline reporting and archiving database.
    db.ods.driverclassname=
    db.ods.driver.url=
    db.ods.host=
    db.ods.port=
    db.ods.sid=
    db.ods.user=
    db.ods.password=
    Flag indicating whether to add DPMO NC codes to NC idat files when a
    new update is imported. This value is initially
    set by the installer according the the user selection.
    dpmo.nc.codes=
    The default locale used by the production system. The default locale
    is the locale used to display locale
    specific text and messages when the requested locale is not
    available. This property does not need to
    be set if the default locale is english.
    default.locale=en
    Used when running the build from Eclipse to locate the java compiler
    used by the WebLogic EJB compiler.
    jdk.home=C:/Program Files/Java/jdk1.5.0_20
    Compiler debug mode. If set to 'true', debug symbols will be
    compiled into the byte code.
    compile.debug=true
    Keystore alias
    security.alias=xxxxx
    Keystore password
    security.storepass=ChangeIt
    Key password
    security.keypass=ChangeIt
    Keystore type (jks=default,jceks,pkcs12)
    security.storetype=jks
    Optional source control build identifier that is to be displayed with
    standard version information.
    scs.build.ID=
    Optional extended version information to be displayed with standard
    version information.
    ext.info=
    custom.properties----
    2. How can we change this here?
    Regards,
    Leon Lu
    Edited by: Leon Lu on Aug 4, 2011 11:14 AM
    Edited by: Leon Lu on Aug 4, 2011 11:21 AM

    Hi,
    I created one request with logo in the header an page in the footer etc. and called StyleSheet. After you can import this formats by each request.
    You can do this in compound layout.
    Regards,
    Stefan

  • How to extract data from xml and insert into Oracle table

    Hi,
    I have a large xml file. which will have hundreds of the following transaction tags having column names and there values.
    There is a table one of the schema with coulums "actualCostRate","billRate"....etc.
    I need to extract the values of these columns and insert into the table
    <Transaction actualCostRate="0" billRate="0" chargeable="1" clientID="NikuUK" chargeCode="LCOCD1" externalID="L-RESCODE_UK1-PROJ_UK_CNT_GBP-37289-8" importStatus="N" projectID="TESTPROJ" resourceID="admin" transactionDate="2002-02-12" transactionType="L" units="11" taskID="5017601" inputTypeCode="SALES" groupId="123" voucherNumber="ABCVDD" transactionClass="ABCD"/>
    <Transaction actualCostRate="0" billRate="0" chargeable="1" clientID="NikuEU" chargeCode="LCOCD1" externalID="L-RESCODE_US1-PROJ_EU_STD2-37291-4" importStatus="N" projectID="TESTPROJ" resourceID="admin" transactionDate="2002-02-04" transactionType="L" units="4" taskID="5017601" inputTypeCode="SALES" groupId="124" voucherNumber="EEE222" transactionClass="DEFG"/>

    Re: Insert from XML to relational table
    http://www.google.ae/search?hl=ar&q=extract+data+from+xml+and+insert+into+Oracle+table+&btnG=%D8%A8%D8%AD%D8%AB+Google&meta=

  • Override JNDI names in persistence.xml and @resource annotation

    I have a Java EE 7 application that I am developing for use with both GlassFish and WildFly, but I have discovered that both application servers use a slightly different format for specifying JNDI names.
    In GlassFish the persistence.xml file references the data source jdbc/myDataSouce, but in WildFly the data source needs to be java:/jdbc/myDataSource.The same is also true for classes that are annotated with @Resource. In GlassFish the annotation for a class using JavaMail would be @Resource(name = "mail/myMailSession"), but to deploy onto WildFly this would need to be @Resource(name = "java:mail/myMailSession").
    The only solution I've got at present is using Maven to create two different releases of the EAR file, with one EAR file containing a persistence.xml file with the data source jdbc/myDataSouce for use with GlassFish, and the second EAR file containing a persistence.xml file with the data source java:/jdbc/myDataSource for use with WildFly. Unfortunately, I haven't found a solution for the @Resource annotation.
    I've taken a look at the documentation for glassfish-application.xml and glassfish-ejb-jar.xml and have tried using resource-ref to override the JNDI names but the application fails to deploy due to an error in the name.
    My question is does GlassFish provide any capability to override the JNDI names specified in the persistence.xml file and classes with the @resource annotation?
    Many Thanks
    Paul

    Have you been able to solve this? I'm attempting to understand what Web Server 7 can do with regard to Java Persistence and what elements of it require Glassfish.
    I've also spent great amounts of time in WS6.1 trying to figure out why a JNDI resource couldn't be found. The rules of thumb I've learned are:
    - Try dropping the *'java:/comp/env/* prefix; just use jdbc/pact part
    - Make sure all referrences (in web.xml and sun-web.xml) are identical with regard to that name.
    I'm hoping you're not still dealing with this (it's been two months!) but if anybody else stumbles on this, maybe it'll help them.
    Dave

  • Stateless session Bean - xml and ejb-jar.xml file ???

    Dear Experts,
    Stateless-session bean
    For Creating an ear file
    we need ejb-jar.xml and weblogic-ejb-jar.xml files
    Is these files are already available
    or we have to type these files ??
    Advance Thanks
    Rengaraj.R

    My best advice: surrender to use an IDE.
    You wonder sometimes at how much productivity (read as 'time') could be wasted by doing something that could be done automatically. For a learning experience or a once only exercise is fine but as a routine thing, not worth it.
    Cheers

  • HT1660 When I install itunes, the xml and media folders are placed on desktop not in my music folder on Vista where I want them to be

    So I've installed and uninstalled itunes 3 times, using control panel to unintall everything, then ccleaner to make sure nothing is left over.  No ipod service and stuff left.
    Each time I install, the defult folder where the Media Folder, and album art folder plus all the xml and other files are put on my desk top. 
    Opening up Itunes, preferences, changed folder to user/music/itunes it doesn't work, keeps defaulting back to desktop.  Help please
    OS is Windows Vista

    Good to hear you got it fixed. A common reason for this issue is a problem with security permissions. This is another approach that may help in such cases.
    Repair Permissions
    Right-click on your main iTunes folder and click Properties,  then go to the Securitytab and click Advanced. Use the Change Permissions... button grant to your account (or the Users group) and SYSTEM full control of this folder, subfolders and files, then tick the option to Replace permissions entries... which will repair permissions throughout the library. When complete switch to the General tab, click in the Read-only check box to clear it, then click Apply.
    If you don't have the option to change the permissions then use the Owner tab and Edit... button to take ownership from an account with administrator privileges. Tick the option to Replace owner on subcontainers and objects.
    Repeat with the media folder if it isn't stored inside the main iTunes folder.
    tt2

Maybe you are looking for

  • Text field in material master

    Dear Expert How to take field name for Text in material master? Thanks for Advance

  • QS41 - Upload codes

    Hi,   We have a requirement to upload code groups and codes using QS41. We used the LSMW and uploaded the code groups , but when we tried writing a BDC for uploading codes of the codegroup the dialog tree structure that comes in the left hand frame o

  • [ASK] How to know the number of usage of each Atomic Service ??

    I correct my question: *How to know the number of usage of each Atomic Service by the Domain & Enterprise Services?* I want to see the number of usage of each atomic service(AS) by other services (DS & ES) ex: es_A  ----->  ds_B   (1x)    ----->    a

  • SVT Online Check in distributed model

    Hello,      I have to implement SVT online check in distributed environment. i.e. I have a seperate ERP system and a new EHS system. I am well aware of all configurations and BADI implementations for SVT online check. My question is how can I do this

  • ExecuteBatch commits even if autocommit is false ?

    Hello ! Is it true that executeBatch (e.g on PreparedStatement) commits the changes after running ? We tried using a temporary table with on "commit delete rows" and fill this table with executeBatch(). The following Statements seem to find this tabl