Loading xml files on user's demand

6 views
Skip to first unread message

igiovani

unread,
Jun 28, 2009, 9:30:21 AM6/28/09
to BirdEye
Hi, everyone,

I made a control component. With this component the user can select an
xml file from his computer and the name of the file is displayed on
the control panel in a Text Input item of RaVis. The selection of the
file is done through the windows dialog box where the user can browse
his system and finally select the file he wants.

What I didn' manage to do is every time the user selects a new xml
file (local file) the visual graph to be recreated using this new xml
file. Not adding nodes and edges to an already compiled xml, but
loading a whole new xml file and creating a whole all new vgraph!

Can anyone give me some guidelines how to do it?

Thanks
Yiannis

RaVIS

unread,
Jun 29, 2009, 4:19:37 AM6/29/09
to BirdEye
Hi,

Follow the way XML Graph is loaded in exemples :

// Recreate a graph based on the new xml
var graph:Graph = new Graph("graph_id",false,xmldata);
// Set the new loaded graph data to the visual graph
vgraph.graph = graph;

You may have to reset/set a few variables relative to renderers/root/
layouter.

DjiAntika.

Ioannis Giovanakis

unread,
Jul 5, 2009, 3:27:23 PM7/5/09
to flexviz...@googlegroups.com

Thanks, DjiAntika,

You 've been very good help. I' ve done what I wanted to.
fullVGraphRefresh() method of VisualGraph.as does very similar thing to what
I needed to do.

Thanks again!
__________ Information from ESET Smart Security, version of virus signature
database 4194 (20090628) __________

The message was checked by ESET Smart Security.

http://www.eset.com



__________ Information from ESET Smart Security, version of virus signature
database 4217 (20090704) __________

The message was checked by ESET Smart Security.

http://www.eset.com


cholid ridwan

unread,
Jul 5, 2009, 10:18:36 PM7/5/09
to flexviz...@googlegroups.com
Hi DjiAntika, ihave problem same as Ioannis Giovanakis, but i want it just one file xml, so when i change the contain of xml file and save it, when iclick the load or refresh button the view in ravis will be change follow the xml file  
Can you give me some guidelines how to do it?
Thanks
Cholid_Ridwan

cholid ridwan

unread,
Jul 5, 2009, 11:10:32 PM7/5/09
to flexviz...@googlegroups.com
hi all,how is to make the line(edge) in ravis is bold?
thanks

igiovani

unread,
Jul 6, 2009, 2:25:42 AM7/6/09
to BirdEye
If you use the code that this link suggests:
http://groups.google.com/group/flexvizgraphlib/browse_thread/thread/2b847cf523705a5d/1c6920bda252edd4?lnk=gst&q=xml#1c6920bda252edd4
you' ll do the job. It's all a matter where you call the the
HttpService.send() method in order the xml file to be called freshly
and vgraph refresh its data.
Another point is that in the url you can put either an "http://blabla"
syntax or a "C:/bla/bla/bla.xml" absolut address (yes with backslashes
not slashes) syntax or a relative syntax: "data/blabla.xml"

Yiannis

cholid ridwan

unread,
Jul 9, 2009, 10:56:49 PM7/9/09
to flexviz...@googlegroups.com
hi all,any problem with my code?
(has message error =faultCode:Channel.Security.Error faultString:'Security error accessing url' faultDetail:'Destination: DefaultHTTP')

<mx:Application
    ***
    creationComplete="xmlHttpService.send();"
    >
    <mx:HTTPService
        id="xmlHttpService"
        url="http://localhost/switch.xml"
        result="xmlResultSuccess(event)"
    resultFormat="e4x"
    fault="xmlResultFailure(event);"
    />

[Bindable]
            private var xmldata:XML;

           
            private function init():void {
                  Security.loadPolicyFile("http://localhost/switch.xml");                 
                xmlHttpService.send();               
                initLogging();
                 initData();

                var graph:Graph = new Graph("graph_id",false,xmldata);               
                vgraph.graph = graph;
            }

            private function xmlResultSuccess( event:ResultEvent ):void
                  {
                xmldata = event.result as XML;
                initData();
            }

            private function xmlResultFailure( event:FaultEvent ):void
                  {
                Alert.show( event.fault.message, "Error loading XML" );
            }

            private function initData():void {


                    vgraph.graph = new Graph("XMLAsDocsGraph",false,xmldata);
                   
            }

RaVIS

unread,
Jul 15, 2009, 4:00:21 AM7/15/09
to BirdEye
Hi,

A bit late but, i think the error come from your url : http://localhost/switch.xml
Because you're using an HTTPService, it's not necessary (and probably
a mistake) to tell him to search your file with an http protocol.
So, if your Flex app is at the root of your server : "localhost/
myFlexApp.swf", try giving a relative path request like
"url='switch.xml'"

DjiAntika.

cholid ridwan

unread,
Jul 15, 2009, 5:05:31 AM7/15/09
to flexviz...@googlegroups.com
Thanks very much DjiAntika, i know what the problem is...
Reply all
Reply to author
Forward
0 new messages