Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3276226
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:14:02+00:00 2026-05-17T19:14:02+00:00

We have an requirement in our project to browse & upload an XML file

  • 0

We have an requirement in our project to browse & upload an XML file and show it on the datagrid, edit the grid and then save the contents to the database. I’m able to see examples that take a XML from a specific folder and show on the datagrid, but not able to see any examples that browse for a XML and then upload it. It would be great if someone can point me to the examples or some sample code. Our XML looks like:

<VisitImportList>
    <Visit>
        <AuditDetails>
            <UpdateUser>ADMIN</UpdateUser>
            <UpdateTimestamp>2010-10-22T16:25:26.593Z</UpdateTimestamp>
        </AuditDetails>
        <VisitId>3</VisitId>
        <MeasurementCollectionId>4</MeasurementCollectionId>
        <WeightConfirmationCode>5</WeightConfirmationCode>
        <PrefilledIndicator>true</PrefilledIndicator>
        <VisitDate>2010-10-22T16:25:26.593Z</VisitDate>     
    </Visit>
    <Visit>
        <AuditDetails>
            <UpdateUser>ADMIN</UpdateUser>
            <UpdateTimestamp>2010-10-22T16:25:26.593Z</UpdateTimestamp>
        </AuditDetails>
        <VisitId>3</VisitId>
        <MeasurementCollectionId>3</MeasurementCollectionId>
        <BloodPressureConfirmationCode>4</BloodPressureConfirmationCode>
        <PrefilledIndicator>true</PrefilledIndicator>
        <VisitInvalidCode>1</VisitInvalidCode>
        <VisitInvalidReasonText>No Dates</VisitInvalidReasonText>
    </Visit>
</VisitImportList>

Ok I have been able to show the data on the grid using FileReference for upload and XML/XMLListCollection. Now the issue is when I try to save to the database. I did not want to create a new thread, so I have added my question to here:

private function saveVisit(event:MouseEvent): void
            {
var decoder:SimpleXMLDecoder = new SimpleXMLDecoder();
                var data:Object = decoder.decodeXML(xmlDoc);

                var array:Array = ArrayUtil.toArray(data.VisitImportList.Visit);
                tempCollection = new ArrayCollection(array);

Now I have the data in my arraycollection (tempCollection). But it holds generic objects and I need to convert them to Visit Object. So I want to loop through the ArrayCollection, convert the object in to specific custom Visit Objects and then add them to another Collection (I’m sure this is not the right way to do, but I’m not able to come up with an alternate):

     for (var i:int = 0; i < tempCollection.length; ++i) 
                        {               
                            model.visit = new Visit();  
                            model.visit = Visit(tempCollection.getItemAt(i, 0)); // This line gives the error Type Coercion failed: cannot convert Object@1d4e4719 to com.model.Visit.
                            model.visit = tempCollection.getItemAt(i) as Visit; // This line always has Visit as null eventhough the tempCollection has 2 objects

model.pvList.visits.addItemAt(Visit, i);
}

So can someone help on how to loop through the ArraCollection and convert the AS Object to custom Visit object and then add to another ArrayCollection OR an easier way to do this

Thanks

Harish

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T19:14:03+00:00Added an answer on May 17, 2026 at 7:14 pm

    If you are working with AIR application, you can easily access resources in your computer using File and FileStream objects in Flex.

    http://livedocs.adobe.com/flex/3/html/help.html?content=Filesystem_16.html

    Get the XML object and then convert it to XMLListCollection from its item command i.e.

    var xmlProvider:XMLListCollection = new XMLListCollection(xml.Visit);
    

    Set this provider to your data grid and write script to upload and save this data the way you want.

    But instead if you are writing web application. You can’t access resources that are not in your flex temp files path on your client. Or you have to give flex access to the folder/file on client machine using “Global Security Settings“. In this case same AIR api should work.

    However, if you don’t want that either then obviously you have to upload the file on server, read that object using HTTPService back at the client, create XMLListCollection object and load the data in DataGrid. This would help

    1. Upload File
    2. HTTP Service + DataGrid Sample for XML file on server
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a requirement to allow users to browse directories on our file server,
In our project we have requirement that, after receiving sms message from third party
In our project we have a requirement that when a set of records are
We have the following requirement in our project. On click of a link, A
We have a requirement on our project for custom fields. We have some standard
We have a requirement to control access to our SaaS based web application based
We have trouble implementing a nice session mechanism in JSP. One of our requirement
Requirements: On a web page in our web application, we have a requirement to
We have a business requirement that some users be automatically logged out of our
Requirement is this ... We have our 3 web-applications deployed in RHEL-5 server, we

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.