#### XML The data at the root level is invalid. Line 1, position 1.

Im getting this error while trying to read a xml file that i receive from a
POST

heres the code:

Dim strNodeResult As String
Dim NodeType As XmlNodeType
Dim objwriter As StreamWriter

Try
Select Case NodeType
'Case XmlNodeType.XmlDeclaration
'strNodeResult += "XML Declaration :" & MyXmlReader.Name
Case XmlNodeType.Element
Loop
End If
End If
'strNodeResult += "Element: " & MyXmlReader.Name
'Case XmlNodeType.Text
'strNodeResult += "- Value: " & MyXmlReader.Value
End Select
Loop
objwriter = New StreamWriter(Server.MapPath("item.txt"), True)
objwriter.WriteLine(strNodeResult)
objwriter.Close()
objwriter = Nothing
Catch ex As Exception
objwriter = New StreamWriter(Server.MapPath("error.txt"), True)
objwriter.WriteLine(ex.Message & " " & ex.StackTrace)
objwriter.Close()
objwriter = Nothing
End Try


 0
Korivo (3)
5/17/2005 7:51:07 PM
dotnet.xml 7266 articles. 0 followers.

3 Replies
716 Views

Similar Articles

[PageSpeed] 51

heres the error :
The data at the root level is invalid. Line 1, position 1.

"Korivo" wrote:

> Im getting this error while trying to read a xml file that i receive from a
> POST
>
> heres the code:
>
>         Dim strNodeResult As String
>         Dim NodeType As XmlNodeType
>         Dim objwriter As StreamWriter
>
>         Try
>                 Select Case NodeType
>                     'Case XmlNodeType.XmlDeclaration
>                     'strNodeResult += "XML Declaration :" & MyXmlReader.Name
> & " " & MyXmlReader.Value
>                 Case XmlNodeType.Element
>                         If MyXmlReader.Name = "Beer" Then
>                             If MyXmlReader.AttributeCount > 0 Then
>                                     strNodeResult += MyXmlReader.Name & ":"
>                                 Loop
>                             End If
>                         End If
>                         'strNodeResult += "Element: " & MyXmlReader.Name
>                         'Case XmlNodeType.Text
>                         'strNodeResult += "- Value: " & MyXmlReader.Value
>                 End Select
>             Loop
>             objwriter = New StreamWriter(Server.MapPath("item.txt"), True)
>             objwriter.WriteLine(strNodeResult)
>             objwriter.Close()
>             objwriter = Nothing
>         Catch ex As Exception
>             objwriter = New StreamWriter(Server.MapPath("error.txt"), True)
>             objwriter.WriteLine(ex.Message & " " & ex.StackTrace)
>             objwriter.Close()
>             objwriter = Nothing
>         End Try
>

 0
Korivo (3)
5/17/2005 8:22:05 PM
Begin by examining the content of the Request.InputStream. Use a regular
StreamReader and dump it to a string variable to see if you get *nothing
but* a valid XML document.
My guess, which is also suggested by your exception,  is that you'll get

Best regards,
Magnus

"Korivo" <Korivo@discussions.microsoft.com> skrev i meddelandet
news:E8F5B89B-D0E2-43B0-84BF-ACA49C5C23DD@microsoft.com...
> heres the error :
> The data at the root level is invalid. Line 1, position 1.
>
> "Korivo" wrote:
>
>> Im getting this error while trying to read a xml file that i receive from
>> a
>> POST
>>
>> heres the code:
>>
>>         Dim strNodeResult As String
>>         Dim NodeType As XmlNodeType
>>         Dim objwriter As StreamWriter
>>
>>         Try
>>                 Select Case NodeType
>>                     'Case XmlNodeType.XmlDeclaration
>>                     'strNodeResult += "XML Declaration :" &
>> & " " & MyXmlReader.Value
>>                 Case XmlNodeType.Element
>>                         If MyXmlReader.Name = "Beer" Then
>>                             If MyXmlReader.AttributeCount > 0 Then
>> ":"
>>                                 Loop
>>                             End If
>>                         End If
>>                         'strNodeResult += "Element: " & MyXmlReader.Name
>>                         'Case XmlNodeType.Text
>>                         'strNodeResult += "- Value: " & MyXmlReader.Value
>>                 End Select
>>             Loop
>>             objwriter = New StreamWriter(Server.MapPath("item.txt"),
>> True)
>>             objwriter.WriteLine(strNodeResult)
>>             objwriter.Close()
>>             objwriter = Nothing
>>         Catch ex As Exception
>>             objwriter = New StreamWriter(Server.MapPath("error.txt"),
>> True)
>>             objwriter.WriteLine(ex.Message & " " & ex.StackTrace)
>>             objwriter.Close()
>>             objwriter = Nothing
>>         End Try
>>


 0
5/18/2005 5:29:29 PM
Right on it Magnus, the xml that i was receiving was not 100% valid XML,
thanx o lot!

"Magnus" wrote:

> Begin by examining the content of the Request.InputStream. Use a regular
> StreamReader and dump it to a string variable to see if you get *nothing
> but* a valid XML document.
> My guess, which is also suggested by your exception,  is that you'll get
>
> Best regards,
> Magnus
>
> "Korivo" <Korivo@discussions.microsoft.com> skrev i meddelandet
> news:E8F5B89B-D0E2-43B0-84BF-ACA49C5C23DD@microsoft.com...
> > heres the error :
> > The data at the root level is invalid. Line 1, position 1.
> >
> > "Korivo" wrote:
> >
> >> Im getting this error while trying to read a xml file that i receive from
> >> a
> >> POST
> >>
> >> heres the code:
> >>
> >>         Dim strNodeResult As String
> >>         Dim NodeType As XmlNodeType
> >>         Dim objwriter As StreamWriter
> >>
> >>         Try
> >>                 Select Case NodeType
> >>                     'Case XmlNodeType.XmlDeclaration
> >>                     'strNodeResult += "XML Declaration :" &
> >> & " " & MyXmlReader.Value
> >>                 Case XmlNodeType.Element
> >>                         If MyXmlReader.Name = "Beer" Then
> >>                             If MyXmlReader.AttributeCount > 0 Then
> >>                                     strNodeResult += MyXmlReader.Name &
> >> ":"
> >>                                 Loop
> >>                             End If
> >>                         End If
> >>                         'strNodeResult += "Element: " & MyXmlReader.Name
> >>                         'Case XmlNodeType.Text
> >>                         'strNodeResult += "- Value: " & MyXmlReader.Value
> >>                 End Select
> >>             Loop
> >>             objwriter = New StreamWriter(Server.MapPath("item.txt"),
> >> True)
> >>             objwriter.WriteLine(strNodeResult)
> >>             objwriter.Close()
> >>             objwriter = Nothing
> >>         Catch ex As Exception
> >>             objwriter = New StreamWriter(Server.MapPath("error.txt"),
> >> True)
> >>             objwriter.WriteLine(ex.Message & " " & ex.StackTrace)
> >>             objwriter.Close()
> >>             objwriter = Nothing
> >>         End Try
> >>
>
>
>

 0
Korivo (3)
5/19/2005 1:59:16 AM

Similar Artilces:

Can I embed a clickable link that includes command line arguments?
I 'm familiar with the process of embedding a clickable link to a file located on a share accessible to the recipient, and do so regularly by using a UNC formatted path: \\ServerName\Path\to the \location\of the\file (Interesting ... the "<" ">" I wrapped the above line in dissappeared as soon as I entered the close bracket. In Outlook [plain text] I'm not used to that happening.) My question: is it possible to do the same thing to launch a .exe (or ..cmd) with command line arguments? Something like: \\UNC Path\Executable /argument1 /a...

How can I asign a number value to a text line in Excel?
tI have a Backgammon Club with Internal Club Rankings that are in Text. I want my members to report their wins - 1st, 2nd, and 3rd place - in tournaments to my web site . I would like them to imput: their nickname, date of tournament, tournament Room #, tournament points played for, and host of the tournament. I would further like the calculation to display any change in Ranking as a text cell. Additionally, I want to show for the member, how many more points are needed to get to the next levle and what that (Text)level is. If there is a "what if" for this please advise. Ri...

Combo Box from data in another tab
Is it possible to create a combo box from data that's in another tab? I have a combo box that's from data in hidden columns. But now I need to move all that hidden data to another tab in the same file. But when I go into properties and go to the ListFillRange option, it won't let me enter another tab name. -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.aspx/ms-excel/200508/1 I have called data from another tab with a combo box by doing th following: First - name the range of the data on the other tab. This can be don with the shortcut on the toolbar (l...

Adding a new data series to an existing chart
I have a stacked bar chart that shows monthly sales by customer type. I want to add an additional data series to show the monthly forecast, to be displayed as a point or line against the existing stacked-bar data. Any ideas? Select the data you want to plot. Drag onto the chart. XL will pop up with a dialog box asking for some information. Provide it and you will be all set. -- Regards, Tushar Mehta MS MVP Excel 2000-2004 www.tushar-mehta.com Excel, PowerPoint, and VBA tutorials and add-ins Custom Productivity Solutions leveraging MS Office In article <1418C2D7-4DF6-4945-A08A...

Excel 2000
Hi! *First off:* I have created a spreadsheet that has a dynamic range an data validation. *Next:* i know i can add options to the 'dynamic range' and my dro down menu will add the option to its list. *Problem:* How can I make it so the user can add data into th validated data list/drop down menu rather than having the user addin it into the dynamic range? *Example:*this drop down menu indicates how often a system is updated weekly, monthly, etc. etc... i don't want to restrict it, so i want t make it so they can indicate their own time on how often those update occur. TIA -...

Command line execution in Powershell
I've written a script to build parameters to pass to a command that will be executed via the command line. The trouble I'm having is finding a cmdlet that I can use to not only execute the .exe but pass the parameters needed for that .exe to run. For example - I want to execute "postemsg.exe" and use my p/s script to build the necessary parameters -- here's what the final command will look like: postemsg.exe -S <server IP> -r HARMLESS -m maint hostname=<server name> segment=7 new_mode=m multi=0 Enable_Maintenance Maint So far I've only ...

getting a single line from a file
I was wondering if someone could tell me how to read a single line from a text file. I tried using getline, but my MFC program does not recognize the getline function. Nor does it recognize <string> or <string.h> or using namespace std. So is there another function that I can use in MFC? Roger Take a look at the CStdioFile MFC class. -- Cheers Check Abdoul [VC++ MVP] ----------------------------------- "R.H." <roger.huggins@intermec.com> wrote in message news:e98o6IMmDHA.1764@tk2msftngp13.phx.gbl... > I was wondering if someone could tell me ho...

Data within a cell
If names are in cells as "last name, first name, middle initial" can a macro be run to change the order to "first name, middle initial, last name"? A formula will do Assuming you have spaces between commas and names, =MID(A2,FIND(",",A2)+2,FIND(",",A2,FIND(",",A2)))&RIGHT(A2,FIND(",",A2,FIND(",",A2)))&", "&LEFT(A2,FIND(",",A2)-1) Then just copy down. If you want this more permanent, copy the cells with formulas, right click, paste special. -- Best Regards, Luke M *Remember to click &q...

How do I make the x axis data the y axis data?
My graph automatically makes certain data the y axis and other data the x axis. I need to just reverse it for the graph I am looking for. Any suggestions? SLG, One option is to reverse the positions of the data on the spreadsheet. Assuming an XY chart, you would change a setup like this: x y 5 4 4 2 5 3 7 4 6 5 to this: y x 4 5 2 4 3 5 4 7 5 6 If this doesn't work, can you post back to let us know what type of chart and data you're using? ---- Regards, John Mansfield http://www.pdbook.com "SLG" wrote: > My graph automatically makes certain data the y axis ...

Prevent auto recoloring of chart when using Pivot Table data
I have crated a Pivot tabel with data I want to show in a Chart. My problem is when I refresh data the colours of the "data series" changes. For exaple I want one of my series "OK" always be shown in green colour, but after a refresh of pivot all colours changes. This problem is not only colouring. If I have made changes to my chart so that one series ar plotted on a secondary axis, and I change it to another chart type (e.g. the secondary should be shown as a line instead of column) this also changes when refreshing the data. Most irritating! Anyone that knows how to p...

Data entered from list automatically enters number in another cell
I am using Excel 2007 and here is an simplified example of what I need. Items Price Potatoes 4.35 Apples 5.55 Oranges 7.95 Onions 4.55 Carrots 3.75 Items Column is List for Valid entries in table below Prices are the numbers I want entered when I enter the Item If I enter Oranges from Dropdown List in A16 , I want Excel to automatically enter the number 7.95 3 columns over in D16,or if it is quite a bit easier, just 1 column over in cell B16 Example of table I want: My Entries: Excel Enters ...

converting plain data to table format
It has been a while since I used excel but I am almost sure there is a way to convert just plain rows and columns of data into a table format. This way I believe that adding rows to this block of data is as simple as tabbing after the last cell and it should just drop down to the next row and insert one??? correct?? Excel should recognize a contiguous range as a table, or list. Include headings in the first row, and leave at least one blank row and column between the table and other items on the worksheet. You can use the built-in data form to add records to the table (Data>Form). Or,...

Data Migration Framework 08-04-04
Hi, I am not understanding something pretty fundamental regarding the Data Migration Framework (DMF). I am looking to migrate a limited number of records (approx 1K) from Goldmine into MS CRM as Account records. I understand that the DTS in SQL can be used to load the data into the CDF database. On page 73 of the Data Migration Framework Guide (v1.2) it states that you use the Goldmine export utility to extract data from Goldmine. However, how do you use DTS to load this data into the CDF database as Goldmine exports it into Excel? Also, using the export facility in Goldmine you can only e...

uninstall from command line using alternate credentials
WinXP SP3. Is there a way to do this? I am trying to find a way for a power user to uninstall a program using the msiexec + uninstall string from the registry using admin account credentials. Alternativly, I have tried to get the user to do a "run as" on the appwiz.cpl file but I get an error. UPDATE: also tried making a shortcut and running as admin but there is still an error with starting the msiexec. It says something like error statring program, it may be disabled or have no associated programs. I checked the windows installer service and it is running. ...

Changes to requested ship date in SOP should roll down to lines
When changing the requested ship date at the header on open SOP orders you should have the option to roll this change down to existing SOP lines. -- Jim@TurboChef ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/Businesssolutions/Community/News...

Line Numbering
Can I add line numbers to an excel spreadsheet? If so, how? Thanks "Ernie" <edeleon68@hotmail.com> wrote in message news:126f501c3f6ef$e59575e0$a301280a@phx.gbl... > Can I add line numbers to an excel spreadsheet? If so, > how? > Thanks Use the formula =ROW() copied down. Hi do you neet the row numbers on your printout? If yes goto 'File - Pagesetup - Table' and check the option to inlcude row and column headings -- Regards Frank Kabel Frankfurt, Germany Ernie wrote: > Can I add line numbers to an excel spreadsheet? If so, > how? > Thanks ...

Line up records (sorting)
I have 2 columns. Column A has values (numbers for the taxlots o interest) that are not sorted in any order. Column B has the sam values plus a bunch of extraneous values that do not appear in column (numbers of other taxlots in the city). Columns C-G have values tha correspond to the values in column B (Owner information for the taxlo values in B) What I need to have happen is either search column B for the values i column A and delete all the extraneous records (columns B-G), or, alig the values in column A so that they correspond to the locations of th same values in column B. Not sure ...

get sql server schema to xml?
Hello, How can I get table/column schema of a sql server database? i want to convert the entire schema into an xml file. thanks in advance. You can use a DataReader's GetSchemaTable method "suzy" <suzy@spam.com> wrote in message news:ckNyb.372$nL5.173@news-binary.blueyonder.co.uk... > Hello, > > How can I get table/column schema of a sql server database? i want to > convert the entire schema into an xml file. > > thanks in advance. > > Oops, sorry for not posting the link... you can do it with the Connection Object as well... here's a ... Public Folder and Virtual Root Could somebody tell me what the following error means? and how to go about solving it? Event Type: Warning Event Source: NNTPSVC Event Category: None Event ID: 101 Date: 6/1/2004 Time: 8:47:46 PM User: N/A Computer: INTLOC Description: The server was unable to add the virtual root '/' for the directory '/Internet Newsgroups' due to the following error: The parameter is incorrect. The data is the error code. For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp. Data: 0000: 57 00 00 00 W... Thanks in advance Hi H... Hpw to serialize boolean to 0/1 into XML? I can deserialize my Xml that contains 0/1 to bool, but when I again serialize it, value is true/false. Is there some way to force boolean value to be serialized as 0 and 1, not true or false? Thanks. Rita wrote: > I can deserialize my Xml that contains 0/1 to bool, but when I again > serialize it, value is true/false. Is there some way to force boolean value > to be serialized as 0 and 1, not true or false? I suspect it is not possible, looking at http://www.w3.org/TR/xmlschema-2/#boolean the possible values are 0, 1, true, false but the canonical values are only tr... What defines an advanced level of Excel? I was wondering if somebody could help me with this. I was looking at applying for an office assitant job and it said I needed an advanced level of Excel. I have been using Excel for some time now, although I recently decided to do a short course starting from the basics to help identify what I may be missing in my knowledge. We didn't delve into complex formulars but covered all our basics and gave our selves the background knowledge to explor further. I am all over the place, such as inputing data, retreiving data from sources such as SQL server, text files and so on. Formatt... Data Range with more than value I am trying to assign codes to one of my worksheets based on pricing. The problem that I am running into is that the data that I am taking my information has a range of pricing Example below PRICE POINT/RANGE PP$0.01 TO \$1 PP0100 I need to have a formula that looks at "PRICE POINT/RANGE" and compare it to a column that has pricing (i.e .95). This formula/function should give me the "PP" code. Break the range up into two columns (Data - Text to columns). Assuming you don't have gaps/overlaps in your price range (why would you?) your formula ...