[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Transfer data from Sql Server 2005 to Adobe Flex 2.0 as xml

Posted on 2007-08-11
Medium Priority
Last Modified: 2012-06-27
Why is Adobe Flex 2.o  giving me the error "The markup in the document precending the root element must be well-formed" when trying to load xml via an .aspx script produced string, yet it works if I save the string as a .xml?

I am calling the script in Flex as such

<mx:XML id="treeData" source="bin\xml\user_list.aspx" />

THis is my .aspx

<?xml version="1.0" encoding="iso-8859-1"?>
<%@ Page Language="VB" Debug="true" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Web" %>


Dim ConnString as String  = "-------------------------------------"

'      get users from database
Dim userConn As New SqlConnection( ConnString )

Dim userSQL as String = "SELECT * FROM userAccounts ORDER by last_name ASC;"
Dim userCommand As New SqlCommand(userSQL, userConn)
Dim userDataReader As SqlDataReader = userCommand.ExecuteReader

Dim dataOutPut as String = ""                                                    

dataOutPut += "<nodeTop>"

While userDataReader.Read()   '      read move count forward by one, returns false if next one does not exist
'WHILE  groupCount < 10

            dataOutPut += "<node label='" & userDataReader("user_name") & "'>"
          dataOutPut += "<node user_name='" & userDataReader("user_name") & "'/>"
            dataOutPut += "</node>"

End While


dataOutPut += "</nodeTop>"




I really just need to know the best way to share data between Flex and SQL Server without resorting to web or data services.  I want to do it strickly through scripts or if sql server has something better im all ears.  Thanks
Question by:DILORENZO
  • 2
  • 2
LVL 58

Expert Comment

ID: 19677446
Even though you are producing the correct xml the content type would still be text/html. Adobe Flex might be expecting text/xml. So add

Response.ContentType = "text/xml"

before Response.Cache line and try it again.

Author Comment

ID: 19677469
I still get the same results.  Im pulling my hair out here because I use to have this application working fine.  I just got a new computer and setting everything up like my old on has been a nightmare.
LVL 58

Expert Comment

ID: 19677476
I don't know how Adobe Flex works but some browsers cache the ContentType and need a restart. Is there something like that in Adobe Flex?

Author Comment

ID: 19677516
I can not believe I spent hours on this.

The reference...

<mx:XML id="treeData" source="bin/xml/menu.aspx" />

Should have been..

<mx:XML id="treeData" source="http://localhost/xml/menu.aspx" />

It has to be absolute rather than relative.  That is a kick in the pants.  Thank you for your help

Accepted Solution

Vee_Mod earned 0 total points
ID: 19706863
Closed, 125 points refunded.
Community Support Moderator

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
This video teaches users how to migrate an existing Wordpress website to a new domain.

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question