Load object from xml

Imagine if you can that I have a XmlLoader class for each object that can be loaded from xml.
Before I had the xmlLoader code inside the objects but it's better to separate loading from actual object...
these xmlLoaders needs to be able to set all vars for those objects. How would be the best way to do that?
Atm I have made all vars with a package scope. but this really opens the object open to all other objects in that package...
I don't know any other options. so how do you keep your vars safe, but still be able to load them from whatever source(xml, txt)...?

Apache Digester is good for this sort of thing. It uses setter methods to populate your objects. You could also just use XML Serialization and deserialization. Or, you could go for something like JAXB or XMLBeans, whereby you actually will have classes generated for you from XML Schemas, and instances of those classes can marshall and unmarshall themselves quite easily

Similar Messages

  • Net.sf.jasperreports.engine.JRException: Error loading object from file : C

    I started using JasperReports for my web application report generation. I'm using JSPs for web development.
    I created a .jrxml file using iReport and used the following code to generate the report.
    try {
              JasperDesign jasperDesign = JRXmlLoader.load("C:\\tomcat\\webapps\\web\\JSP\\reports\\samples\\pmm-final.jrxml");
              JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
    // Second, create a map of parameters to pass to the report.
              Map parameters = new HashMap();
              parameters.put("Title", "JasperReport");
    // Third, get a database connection
              Connection conn = null;
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              conn=DriverManager.getConnection("jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=C:/tomcat/webapps/db1/db1.mdb");
    // Fourth, create JasperPrint using fillReport() method
              JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,
                                  parameters, conn);
    // You can use JasperPrint to create PDF
              //JasperExportManager.exportReportToPdfFile(jasperPrint, "C:\\tomcat\\webapps\\web\\JSP\\reports\\TestReport.pdf");
              JasperExportManager.exportReportToHtmlFile(jasperPrint, "C:\\tomcat\\webapps\\web\\JSP\\reports\\TestPMM.html");
              JRXlsExporter exporter = new JRXlsExporter();
              exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
              exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, "C:\\tomcat\\webapps\\web\\JSP\\reports\\TestPMM.xls");
              exporter.exportReport();
    // Or to view report in the JasperViewer
              //JasperViewer.viewReport(jasperPrint);
    } catch (JRException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
    } catch (SQLException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
    The above pmm-final.jrxml uses a subreport 'top.jasper'. Error being thrown while loading top.jasper file. Error is as follows.
    java.io.InvalidClassException: net.sf.jasperreports.engine.base.JRBaseReport; lo
    cal class incompatible: stream classdesc serialVersionUID = 604, local class ser
    ialVersionUID = 606
    at java.io.ObjectStreamClass.initNonProxy(Unknown Source)
    at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
    at java.io.ObjectInputStream.readClassDesc(Unknown Source)
    at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
    at java.io.ObjectInputStream.readClassDesc(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:86
    at net.sf.jasperreports.engine.util.JRLoader.loadObjectFromLocation(JRLo
    ader.java:236)
    at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluate(JRFillSubre
    port.java:295)
    at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:
    340)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillPageBand(JRVert
    icalFiller.java:1224)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillPageHeader(JRVe
    rticalFiller.java:353)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRV
    erticalFiller.java:205)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVertic
    alFiller.java:119)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:
    613)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:
    483)
    at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:77
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillMa
    nager.java:248)
    at org.apache.jsp.JSP.UserGuide_jsp._jspService(org.apache.jsp.JSP.UserG
    uide_jsp:74)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
    .java:325)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:2
    95)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
    alve.java:214)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
    alve.java:178)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
    ava:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
    ava:105)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
    ve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
    a:148)
    at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:306)
    at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:385)
    at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:745)
    at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.ja
    va:675)
    at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:868)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
    ool.java:684)
    at java.lang.Thread.run(Unknown Source)
    NESTED BY :
    java.io.InvalidClassException: net.sf.jasperreports.engine.base.JRBaseReport; lo
    cal class incompatible: stream classdesc serialVersionUID = 604, local class ser
    ialVersionUID = 606
    at java.io.ObjectStreamClass.initNonProxy(Unknown Source)
    at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
    at java.io.ObjectInputStream.readClassDesc(Unknown Source)
    at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
    at java.io.ObjectInputStream.readClassDesc(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:86
    at net.sf.jasperreports.engine.util.JRLoader.loadObjectFromLocation(JRLo
    ader.java:236)
    at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluate(JRFillSubre
    port.java:295)
    at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:
    340)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillPageBand(JRVert
    icalFiller.java:1224)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillPageHeader(JRVe
    rticalFiller.java:353)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRV
    erticalFiller.java:205)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVertic
    alFiller.java:119)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:
    613)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:
    483)
    at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:77
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillMa
    nager.java:248)
    at org.apache.jsp.JSP.UserGuide_jsp._jspService(org.apache.jsp.JSP.UserG
    uide_jsp:74)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
    .java:325)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:2
    95)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
    alve.java:214)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
    alve.java:178)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
    ava:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
    ava:105)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
    ve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
    a:148)
    at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:306)
    at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:385)
    at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:745)
    at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.ja
    va:675)
    at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:868)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
    ool.java:684)
    at java.lang.Thread.run(Unknown Source)
    NESTED BY :
    net.sf.jasperreports.engine.JRException: Error loading object from file : C:\tom
    cat\webapps\web\JSP\reports\samples\top.jasper
    at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:90
    at net.sf.jasperreports.engine.util.JRLoader.loadObjectFromLocation(JRLo
    ader.java:236)
    at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluate(JRFillSubre
    port.java:295)
    at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:
    340)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillPageBand(JRVert
    icalFiller.java:1224)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillPageHeader(JRVe
    rticalFiller.java:353)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRV
    erticalFiller.java:205)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVertic
    alFiller.java:119)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:
    613)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:
    483)
    at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:77
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillMa
    nager.java:248)
    at org.apache.jsp.JSP.UserGuide_jsp._jspService(org.apache.jsp.JSP.UserG
    uide_jsp:74)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
    .java:325)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:2
    95)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
    alve.java:214)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
    alve.java:178)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
    ava:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
    ava:105)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
    ve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
    a:148)
    at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:306)
    at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:385)
    at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:745)
    at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.ja
    va:675)
    at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:868)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
    ool.java:684)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.InvalidClassException: net.sf.jasperreports.engine.base.JRBas
    eReport; local class incompatible: stream classdesc serialVersionUID = 604, loca
    l class serialVersionUID = 606
    at java.io.ObjectStreamClass.initNonProxy(Unknown Source)
    at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
    at java.io.ObjectInputStream.readClassDesc(Unknown Source)
    at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
    at java.io.ObjectInputStream.readClassDesc(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:86
    ... 33 more
    Anyone pls help. It's bit urgent. Thanks.

    I was using iReport v0.5.0 and it uses jasperreports-0.6.7.jar (v0.6.7) of
    JasperReports. I compiled and i deployed my application in BEA weblogic server. I got the error listed below. Only after i saw your
    response explaining that iReport was the issue, i checked the iReport lib directory and found this version of jasperreport jar.
    iReport creates a java source file which is used to a jasper file.
    iReport will link in the v0.6.7 version of jasperReports. When you
    deploy your web application it will recognize this version through the compiled jasper file and give you the InvalidClassException, even
    though you only have one jasperReport jar deployed with your war file.
    The way i fixed this problem was to create my web application with the
    jasperreport jar comes with iReport.
    Thanks for mentioning iReport.
    Christopher
    Error:
    Caused by: java.io.InvalidClassException: net.sf.jasperreports.engine.base.JRBas
    eReport; local class incompatible: stream classdesc serialVersionUID = 607, local class serialVersionUID = 10002
    at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:463)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1521)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1521)
    ...

  • Dynamically create Value Objects from XML file

    Hi
    I want to create a value object from Xml file dynamically,like in the xml file i have the name of the variable and the datatype of the variable.is it possible do that,if so how.

    Read about apache's Digester tool. This is part of the Jakartha project. This tool helps in creating java objects from the XML files. I am not sure, if that is what u r looking for.

  • Load data from XML files into BI

    Hi All,
    Can any one guide me through the steps which involve in loading data from XML files into BI?
    Thanks
    Santosh

    Hi James,
    I have followed upto step No: 12 .
    Please could you let me know how to link the XML file on my local drive to BI,
    I am not able to find figure out where to specify the path of the XML file to be loaded into BI.
    Thanks In Advance
    Regards,
    San
    1. Create a Infosource(ZIS), with transfer structure in accordance with the structure in the XML file. (You can open the XML file with MS Excel.This way you can get to know the structure).
    2. Activate the transfer rules.
    3. After activation ;from the Menu Bar , Select Extras>Create BW Datasource with SOAP connection.
    4.Now Activate the Infosurce again, this creates an XML based Datasource(6AXXX...)
    5.These steps would create two sub nodes under the Infosource(ZIS).
    6.Select Myself system and create a data package and execute it run in Init mode(without Data Transfer).
    7. This would create an entry in RSA7(BW delta Queue)
    8. Again create another Delta Infopackage under it, and run it. Now the Datasource(6AXXXXXX..) would turn green in RSA7.
    9.In Function builder(SE37) select your FM( do a search ,F4, on the datasource 6AXXX....) .
    10.Inside this RFC based FM , from the Menu Bar select Utilities>more Utilities>Create Web services>From Function module.
    11.A wizard will guide you through the next steps .
    12.once this is done a Web serrvice would be enabled in WSADMIN. Select your FM and execute it.
    13.From here you can upload the data from XML file into BW delta queue.
    Edited by: Santosh on Nov 30, 2008 2:22 PM

  • Flash does not load information from xml on DMM system

    I have flash file load information from xml file. flash file and xml file i push on IIS server. In presentation i add URL of flash file but flash file not show information.
    I try run URL direct from DMP is ok.
    Flash file write for Flash litte 3.1 and use action script 2.0. DMS system test with DMM version is 5.3 and DMP 4310G.
    Please point where the error and the notes on  flash file use with DMM for my programmer.
    Thanks!

    Hi guy's
    I think I maybe faced with a similar issue.
    I've been working on a flash build that pulls in xml feeds. Everything I have works great so far but I've only been able to test as standalone(Desktop) and in the browser.
    When I tested standalone(Desktop) I did get the flash security popup but once I granted access it worked fine.
    I've never used DMP 4310 before. At this point in time I dont have access to it either. All I know is that my swf will be put on it.
    Can anyone tell me how the DMP 4310 will handle the flash security popup?

  • Load class from XML (Dynamic Dispatch)

    I'm continuing my voyage into the realms of LVOOP.....
    I have encountered a new problem which I am sure there's a solution to.....
    I have a certain hierarchy and I want to implement a single save and load routine for all objects int he hierarchy (located int he parent class of course).
    Using the "flatten to XML" I'm able to create some nice XML files with all parent and sibling information saved (as long as the values are non-default of course).
    Where I am running into problems is the loading of the data within this XML file.  I want to be able to take an object and basically re-initialise it to the values within the file.  All fine and good I thought, but it doesn't work.
    The problem is that when using the VI with Dynamic dispatch inputs, the output of the "Unflatten from XML" is giving me a conflict with the Dynamic dispatch output saying the obejct types do not  necessarily match.  Is it not possible to match the object type on the input and output of the "Unflatten from XML" primitive?
    If I try removing the "Dynamic Dispatch" input to a static input, then it only loads the data for the parent class regardless of the actual input class.
    Am I doing something silly here or is there no other way to properly load a sibling class from a file using only a method residing within the parent class?  I was hoping I could have a single "Save-Restore" function residing within my parent class to make life easier for me.
    Shane.
    Message Edited by Intaris on 06-17-2009 05:24 AM
    Say hello to my little friend.
    RFC 2323 FHE-Compliant

    Hi Tst,
    Problem is that in order for the cast to yield any useful results, I have to make the inputs and outputs non-Dynamic which results in ONLY the data for the parent class being loaded.
    If the inputs and outputs are Dynamic, then a cast will not solve the problem (It could be a grandchild class being cast as a child, thus breaking the dynamic dispatch tables).
    The only solution I see is for the "UnFlatten from XML" to RETAIN the true object type.
    Either that or use my beautiful solution 
    Shane.
    Ps I just did a bit of a test of the race condition probabilities.  I ran 100000 tests (100k) with a program stressing both cores AND ram of my machine in parallel and all 100k of 100k iterations worked out OK.  I suppose that lets me think I should be in the range of at least 99.99%....... 
    Say hello to my little friend.
    RFC 2323 FHE-Compliant

  • Load data from xml file in oracle data base

    Hi all,
    I'd like to know if is posible to load data from a file xml into a table of oracle data base through SQL*LOADER, loaded only in a normal column no with type XMLType , for example
    I have a xml file
    <person name="kate" surname="fari" city="new york" >
    <son name="faus" age="18"/>
    <son name="doly" age="10"/>
    </person>
    and I load in table :
    table :person
    column
    name surname city
    kate fari new york
    table : son
    name age
    doly 10
    faus 18
    thank you for your return !!!!!!!!!
    Ninova
    Edited by: user10474037 on 30 mai 2011 08:47
    Edited by: user10474037 on 30 mai 2011 08:48
    Edited by: user10474037 on 30 mai 2011 08:48
    Edited by: user10474037 on 30 mai 2011 08:49
    Edited by: user10474037 on 30 mai 2011 08:50

    Hi
    This May be found at
    SQL Loader to upload XML file

  • Loading data from XML hosted on a site accepted by Apple?

    I'm about to start working on an App that holds the template and code to build the stuff. It gets its level design, variables and other things from an XML hosted on a website/server. The app will also load pictures from the website/server to be displayed in the app. So, what people download is the "shell". Would Apple allow this app into the app store? Considering I've read how they don't allow external code to be loaded into the app, or is this only limited to code inside external swfs?

    I did search before I posted and read only the threads that seemed to cover what I wanted to know. As replies here are rare I decided to read ALL threads I got from my search and actually found one with the answer, sort of, as he doesn't say if he loads variables, which to me is like code , but I hope Apple will be ok with my app loading external stuff through an external xml aswell, like they were for this guy:
    http://forums.adobe.com/message/3868894#3868894
    * I'm loading xml-data and pictures (like icons for other apps) from an external server into the app, to promote our other apps. Works like a charm and apple had no problem with this.

  • Loading settings from xml and applying

    Hi,
    I've got an xml where im writing certain settings of a application. This is what the xml looks like;
    <?xml version="1.0" encoding="UTF-8" ?>
    - <PTMViewProfile>
    - <viewProfile>
      <testSequences />
      <projectName tag="default" />
    - <tsFrames>
      <tsFrame tag="bvcbvc" maximised="true" />
      <tsFrame tag="bvbv" maximised="true" />
      </tsFrames><projectName tag="default" /> - This is the project name
    - <tsFrames> - These are the JInternalFrames (Instance of tsFrames) for that specific project.
    <tsFrame tag="bvcbvc" maximised="true" />
    <tsFrame tag="bvbv" maximised="true" />
    </tsFrames>
    The project is stored in a directory containing all the tsFrames.
    From the xml i have the code to read and write. But, i want to apply those settings so that when the application is reopened it looks at the xml and opens project and the tsFrames by looking at the xml.
    Can someone please help me with wrting a method that applies those settings and loads the application.

    Hi,
    Thanks for replying!
    I am new to java and i have created the read and write method by using examples from existing code.
    what i want to do is store the elements its reading into an array so that i can use it in another method to do things with it.
    The code below is reading element from xml
    List frame = XMLManager.getListOfNamedChildren(tsFrames, xmlFrameTag);
                   Iterator iterator = frame.iterator();
                   while (iterator.hasNext()) {
                        Element tsFrameElement = (Element) iterator.next();
                        String tag = XMLManager.getAttributeValue(tsFrameElement, "tag");
                        String maximised = XMLManager.getAttributeValue(tsFrameElement, "maximised");
                        storeTsFrame.add(new TSFrameSettings(tag, maximised));I want to use a for each loop to read each line in the xmlFrametag by replacing the while
    can someone help me with this please!

  • Error when loading data from xml file

    Hi,
    I'm trying to load data into a table from XML file using ApEx DATA UNLOAD/LOAD interfaces .
    ApEx version is 3.0.1 .
    I'm getting this error:
    ORA-31011: XML parsing failed ORA-19202: Error occurred in XML processing LPX-00222: error received from SAX callback function
    How to find cause of the error ?
    Janus

    Tkank you for the simple but good advice :)
    unfortunately even google didn't find many answers :
    LPX-00222 + APEX ... NOTHING
    LPX-00222 + ORA- ... 2 pages of something like
    "Examine the additional error messages and take corrective action"

  • Store and load objects to XML files using DOM

    Hello everybody,
    a quick question for all of you.
    I'm designing a desktop application which requires a lot of custom objects to be stored into XML files and later reloaded from them. I'm planning to use DOM, creating an interface like this:
    public interface StorableAsDom
    // Create an object from a DOM tree
    static Object createFromDom(org.w3c.dom.Node root) throws InvalidDomException;
    // Get the DOM tree for an object
    org.w3c.dom.DocumentFragment getDomTree(org.w3c.dom.Document doc) throws DOMException;
    Then, every class which needs to be saved should implement the above interface. This way everything works fine.
    My question is: do you know any available java package which already provides similar functionalities?
    I'd like not to reinvent the wheel if I can; time is always a critical factor.
    Thanks in advance to all of you.
    Cheers
    marcocaco

    Hi,
    When I need object -xml binding, I usually have two methods -
    one for reading & one for writing (the "VOs" below stands for "Value Objects" [getters/setters & empty constructor only]):
    READ: loadXML (= XML2VOs)
    1.XML2DOM - this method can be generic
    2.DOM2VOs - populate your VOs from the DOM just obtained in 1.
    WRITE: saveXML (=VOs2XML)
    1.VOs2DOM - create a new DOM document from your VOs' fields.
    2.DOM2XML - this method can be generic
    It would be nice (but dificult & not very elegant) to make DOM2VOs & VOs2DOM generic. If such methods will be written, they should be combined with the XML2DOM & DOM2XML (resp.) & then you would have two generic methods XML2VOs & VOs2XML... (Alternativelly, you can get Sun's JAXB package which does object-xml binding but this is not part of the JDK 5)
    If what I have outlined above sounds like what you want to do, let me know if you want more details (eg. how the DOM2VOs would be implemented etc)...

  • Loading URL from XML?

    I have a movie clip in rectangle shape and need add link to that from XML.
    How can I do that?
    this my code
    AS Code:var xmlLoader:URLLoader = new URLLoader();
    xmlLoader.load(new URLRequest("linkNewD2.xml"));
    xmlLoader.addEventListener(Event.COMPLETE, displayHTML);
    function displayHTML(e:Event):void {
                    var xmlData:XML = new XML(e.target.data);
                    var tURL:String = xmlData.Header1.option;
                    targetURL(tURL);
    function targetURL(event:String):void
    var valURL:String = event;
    myMc1.addEventListener(MouseEvent.CLICK, gotoHome);
    function gotoHome(evt:MouseEvent):void
                    var myURL:URLRequest = new URLRequest(URL(valURL));
                    navigateToURL(myURL);
    XML Code:
    <data>
    <Header1>
    <option> http://www.google.com </option>
    </Header1>
    </data>
    Please help me!
    Thanks,
    jafy

    First, never use nested functions - they bring in a lot of troubles.
    Try this code (there are better ways but just to follow your initial approach). This code assumes that myMC1 is MovieClip:
    var xmlLoader:URLLoader = new URLLoader();
    // listeners should be added BEFORE load() is called
    xmlLoader.addEventListener(Event.COMPLETE, displayHTML);
    xmlLoader.load(new URLRequest("linkNewD2.xml"));
    function displayHTML(e:Event):void {
         var xmlData:XML = new XML(e.target.data);
         targetURL(xmlData.Header1.option);
    function targetURL(url:String):void
         myMc1.url = url;
         myMc1.addEventListener(MouseEvent.CLICK, gotoHome);
    function gotoHome(e:MouseEvent):void
         navigateToURL(new URLRequest(MovieClip(e.currentTarget).url));

  • Problem in load data from XML in Flex 4

    Hi Everyone,
    I tried all the possible ways which ever i know to load the data from XML to Flash Builder (Flex 4). Actually i want to load the data from XML to Datagrid. The project is executed without any error and warnings but the data is not loaded into datagrid. i will paste the coding below if anyone know the solution please let me know. Waiting for reply.
    <?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" creationComplete="userRequest.send(); ">
    <fx:Declarations>
         <s:HTTPService id="userRequest" url="xdata.xml" useProxy="false" resultFormat="e4x" />
    </fx:Declarations>
    <mx:DataGrid id="dgUserRequest" x="20" y="160" dataProvider="{userRequest.lastResult.user}" >
         <mx:columns>
              <mx:DataGridColumn headerText="User ID" dataField="id"/>
              <mx:DataGridColumn headerText="User Name" dataField="name"/>
         </mx:columns>
    </mx:DataGrid> 
    </s:Application>

    It is better to add result handler to the HttpService and debug to see the actual structure of the xml.

  • Load table from xml

    Hi all
    Please see attach that I send ,, this is vi that write and read from xml file ,, my problem is when I press on load ??
    If you can see that I saved a table data  , I want if I press on load bottom  all the data loaded on the screen  in table shape as table control
    Who can I do that
    Note : press on set limit to save into xml file
    Thanks
    Attachments:
    loadTable.vi ‏28 KB

    Hi elyan
    As i can see you still have problems with xml files
    The for loop is not neened. Just delete it.
    At write buid an array, so at read you can select 1st element.
    At Unflatten from xml, wire a 2D array at "type" input.
    You  must have a look at basic Labview tutorials...

  • Load variables from XML into Flash

    I was wondering how to load variables from an XML document to
    a Flash file? I am familiar with the code to do it for a text file,
    but was wondering how to do it for XML.
    Many thanks in advance!
    JJ

    Thanks for the recommendation on the site. What I am trying
    to do is load varaibles from an XML file into text boxes in my
    flash movie.
    Here is my loading:
    var my_xml = new XML();
    my_xml.ignoreWhite = true;
    my_xml.onLoad = function(success){
    if (success) {
    gotoAndStop("slide01");
    my_xml.load("narration.xml");
    this is what I have on my frame with the text boxes (the text
    boxes are also have the variable name in the variable area)
    var narration = my_xml.picture01;
    var my_title = my_xml.my_title;
    var my_date = my_xml.my_date;
    should I do my_date.text = my_xml.my_date; instead?
    my xml doc looks like this
    <?xml version="1.0" encoding="iso-8859-1"?>
    <picture01>This is the text for picture
    01</picture01>
    <picture02>This is the text for picture
    02</picture02>
    <my_title>Las Vegas</my_title>
    <my_date>October</my_date>
    Any help on this would be GREATLY appreciated!
    Text
    my_date.text = my_xml.my_date;

Maybe you are looking for

  • Internet Connection Speed SLOW!

    My Set-up... 2012 MacPro 3.33 GHz 6-Core Intel Xeon running Mavericks 10.9.5 Airport Extreme Base Station -  Card Type: AirPort Extreme  (0x14E4, 0x8E) - Supported PHY Modes: 802.11 a/b/g/n - Firmware Version: Broadcom BCM43xx 1.0 (5.106.98.100.22) M

  • Using ichat av from work and home (different locations

    Hi, I have a .mac account and have two different locations. How can I use ichat av at the same time to talk to home from the office or vice versa? Any help/suggestions would be appreciated. Thanks

  • Set values in matrix

    hi , i created matrix in screen painter. it includes 3 columns unit of measurement, length, width. i want to set values to length and width manually. when the form is loaded the length and width should appear in matrix Regards, Puneeth

  • Boolean counting?

    Good morning, I'm a novice to Labview so take it easy on me. What I'm trying to do is: Run a while loop after 1 true, 1 false and 1 true boolean. I'm trying to start a measurement when a digital input off a TTL goes high the second time, so I can get

  • Data Functions

    Hello all, Last three days i am trying to get the data functions uses with scenario in query designer. but i didnt get that,can anyone help me especially