XmlReader, asp.net 2, and xmlexception help needed

Hello, 
  I am very new to the xmlreader in asp.net 2, I was just tring to read the 
contents of is in the xml output. here is the sample code:

       Dim settings As New XmlReaderSettings()
        Dim reader As XmlReader
        reader = XmlReader.Create(XMLOutput, settings)
        While reader.Read()
            If reader.IsStartElement() Then
                If reader.IsEmptyElement Then
                    TextBox1.Text = TextBox1.Text + reader.Name
                Else
                    TextBox1.Text = TextBox1.Text  + reader.Name
                    reader.Read() 
                    If reader.IsStartElement() Then 
                        TextBox1.Text = TextBox1.Text + vbCr + vbLf +  
reader.Name
                    End If
                    TextBox1.Text = TextBox1.Text + reader.ReadString() 
                End If
            End If
        End While


When this is run I get 
"System.Xml.XmlException: The 'META' start tag on line 4 does not match the 
end tag of 'HEAD'. Line 5, position 3." 

I have to assume that this is something in the XMLOutput.

Is there a way to just raw dump everything in the string text of the 
XMLOutput so I can see what is in it?

I tried 
    Response.Write(XMLOutput.ToString())

but I just get:
System.Xml.XmlTextReaderSystem.Xml.XmlTextReader 


Ugh,
Tdar

0
Tdar (3)
5/17/2006 6:57:02 PM
dotnet.xml 7266 articles. 0 followers. Follow

5 Replies
407 Views

Similar Articles

[PageSpeed] 26

Hi Tdar,

To get all the contents of XMLOutput, which is an XmlTextReader, you can 
use ReadOuterXml method. If the XMLOutput's position is at the root node, 
try

Response.Write(XMLOutput.ReadOuterXml())

HTH.

Kevin Yu
Microsoft Online Community Support

============================================================================
==========================
When responding to posts, please "Reply to Group" via your newsreader so 
that others may learn and benefit from your issue. 
============================================================================
==========================

(This posting is provided "AS IS", with no warranties, and confers no 
rights.)

0
v-kevy (347)
5/18/2006 1:41:03 AM
Hi,
 Well I still get an error even with what you sugested, 
the error again is still The 'META' start tag on line 4 does not match the 
end tag of 'HEAD'. Line 5, position 3.

The current code is:

        Dim XE As New XMLExchange
        Dim XMLOutput As XmlReader
        XMLOutput = XE.sendXML(xmltosend.ToString)

        If XMLOutput.IsEmptyElement Then
            Response.Write("Element empty")
        End If
        If XMLOutput.IsStartElement() Then
            Response.Write("Got here - start")
            Response.Write(XMLOutput.ReadOuterXml())
        End If
        Response.Write(XMLOutput.ToString())
        Dim XE As New XMLExchange
        Dim XMLOutput As XmlReader
        XMLOutput = XE.sendXML(xmltosend.ToString)
        If XMLOutput.IsEmptyElement Then
            Response.Write("Element empty")
        End If
        If XMLOutput.IsStartElement() Then
            Response.Write("Got here - start")
            Response.Write(XMLOutput.ReadOuterXml())   
        End If



THE xmlexchange(XE in my code) has this in it :
    public XmlTextReader sendXML(string XMLtoSend)
    {
        XmlTextReader reader1 = null;
       string text1 = this.APIurl + "?xml=" + 
HttpUtility.UrlEncode(XMLtoSend);
       this.RequestObject = (HttpWebRequest)WebRequest.Create(text1);
       this.RequestObject.Accept = "text/xml";
       this.RequestObject.ContentType = "application/x-www-form-urlencoded";
       this.RequestObject.Method = "GET";
       this.RequestObject.Timeout = 10000;
       //this.RequestObject.Proxy = new WebProxy(this.ProxyString);
       try
       {
         this.ResponseObject = 
(HttpWebResponse)this.RequestObject.GetResponse();
       reader1 = new XmlTextReader(this.ResponseObject.GetResponseStream());
          
       }
        catch (Exception exception1)
       {
           WebException exception2 = new WebException(exception1.Message);
           throw exception2;
       }

      // return reader1;
        return reader1;



is there any other way of seeing that I am getting sent to me?


"Kevin Yu [MSFT]" wrote:

> Hi Tdar,
> 
> To get all the contents of XMLOutput, which is an XmlTextReader, you can 
> use ReadOuterXml method. If the XMLOutput's position is at the root node, 
> try
> 
> Response.Write(XMLOutput.ReadOuterXml())
> 
> HTH.
> 
> Kevin Yu
> Microsoft Online Community Support
> 
> ============================================================================
> ==========================
> When responding to posts, please "Reply to Group" via your newsreader so 
> that others may learn and benefit from your issue. 
> ============================================================================
> ==========================
> 
> (This posting is provided "AS IS", with no warranties, and confers no 
> rights.)
> 
> 
0
Tdar (3)
5/18/2006 3:18:02 PM

TdarTdar wrote:


> When this is run I get 
> "System.Xml.XmlException: The 'META' start tag on line 4 does not match the 
> end tag of 'HEAD'. Line 5, position 3." 

Is the XML you read in well-formed? It sounds simply as if it is not 
well-formed and the reader gives the appropriate error message.


-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
0
mahotrash (1777)
5/18/2006 3:30:26 PM
Well I don't know if it is well formed, this is why i want to see what is 
there to see 
what is wrong then i can report it to the company that makes the software 
that is sending me the not well formed xml packet.


"Martin Honnen" wrote:

> 
> 
> TdarTdar wrote:
> 
> 
> > When this is run I get 
> > "System.Xml.XmlException: The 'META' start tag on line 4 does not match the 
> > end tag of 'HEAD'. Line 5, position 3." 
> 
> Is the XML you read in well-formed? It sounds simply as if it is not 
> well-formed and the reader gives the appropriate error message.
> 
> 
> -- 
> 
> 	Martin Honnen --- MVP XML
> 	http://JavaScript.FAQTs.com/
> 
0
Tdar (3)
5/18/2006 5:12:01 PM
Hi,

The error message means there are some error in the xml content or the xml 
is invalid. In this case, I suggest you try to debug in the sendXML method. 
Try to check XMLtoSend to see if there is anything wrong. Can it be loaded 
to an XmlDocument?(Which means it is a valid xml string.)

Kevin Yu
Microsoft Online Community Support

============================================================================
==========================
When responding to posts, please "Reply to Group" via your newsreader so 
that others may learn and benefit from your issue. 
============================================================================
==========================

(This posting is provided "AS IS", with no warranties, and confers no 
rights.)

0
v-kevy (347)
5/22/2006 9:27:08 AM
Reply:

Similar Artilces:

Caption Issue #2
The newsletter has a colored gradient with columns. The caption in the column has a white background. How can one include the gradient in the caption to match the overall scheme? >-----Original Message----- >The newsletter has a colored gradient with columns. The >caption in the column has a white background. How can one >include the gradient in the caption to match the overall >scheme? >. > Hi - If you set the fill to "no fill" would that give you the effect you are looking for (the background will show through.) OR fill> fill effects and ...

Problems with creating a newsletter
I chose the form "Newsletter - email". I have created a 3 page newsletter. Now, I have NO IDEA how to send it out as an email. I do not want to send it as an attachment. I cannot figure out which "save as" format or what I need to do so that i can email this newsletter. Is there a website that goes through how to do this? Am I correct when I say that it has to be html in order for me to send it as email? That is not one of the options. Any help you give me would be greatly appreciated. Thank you, Markis www.adreamforabetterworld.com ...

Meeting updates #2
My users cannot update meetings created when they were on the old email server. I have noticed that the old string is still mapped to the meeting. e.g x400;c=us;a= ;p=Org name;o=exchagne;s=Lastname;g=firstname; Take a look at the following article: 275134 XADM: Cannot Reply to Messages That Are Sent from a User Account That http://support.microsoft.com/?id=275134 The same thing applies to meetings. How did you move them and what version(s) of Exchange? Thanks, Richard Roddy Microsoft Exchange Support This posting is provided "AS IS" with no warranties, and confers no ri...

Changing SQL Server for CRM 1.2
As my SQL server is currently on its last breath I am in the process of moving our CRM 1.2 databases to a new dedicated serever. I have detatched the databases from the old server, copied the files to the server and attached them. I have then gone into CRM deployment manager and changed to the SQL server to the new server. That all appears to work fine, no error messages. But when users try to access the CRM system they get an error and the CRM server event log fills with error messages. A few are listed below: dmLog: Failed to execute the SQL batch in the file sqlbatch.sql. MSCRM P...

How do you turn off/on the "1" or "2" or "+" or "-" view hide/unh.
What is or how do you control, turn on/off the small "1" "2" or "+" "-" hide/unhide view buttons right above the "A" cell? Sometimes shows when I hide columns. Hi 'Data - Goup/Outline' -- Regards Frank Kabel Frankfurt, Germany Seth wrote: > What is or how do you control, turn on/off the small "1" "2" or "+" > "-" hide/unhide view buttons right above the "A" cell? Sometimes > shows when I hide columns. You can toggle them to hide or display with <Ctrl> <8> Usi...

Help, I cannot Save!
I created a document and locked the worksheet to protect the formulars before creating a template for the document. But now when I open th document and insert a new sheet using the template I created, th document will refuse to save. Once I click on save, office assistant will say "doc not saved". Wha could I have done wrong? PLease help. computerfinema -- computerfinema ----------------------------------------------------------------------- computerfineman's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=3716 View this thread: http://www.excelforum.c...

Steps to Share Outlook on 2 different drives
This is a problem created by a dual boot of XPPSP2 on one drive C:\ and Vista on another drive E:\ that I use to format for new builds of Vista on the same box. I want to take my Outlook 2003 in box and folders on two different drives on one box and combine them so that all the emails go to one account and all the folders can be shared or used on each drive. I want to do the same with Outlook Express as well, and since this is an *Outlook newsgroup, I'll just take what I learn here and apply it to the ..dbx folder(s) in it. The idea is to receive email on both drives in one in one...

printing 2 charts on single page
Using Excel 2k, Win 2k I was trying to print to line charts on a single page to demonstrate the corelation between the two data sets. I would like to print in portait mode with one chart on top of page and one on bottom. Excel only seems to offer putting chart 2 on a separate page or embedding it in chart one. I am not very familiar with excel charting capabilites can anyone suggest a resorce? Thanks ...

Macro Help 11-24-09
I have one workbook of data (1 tab) that has data for 20 different Sales Reps (different names). I need to copy all data for "Rep A" into a separate worksheet, and same for "Rep B" and so on. At the end I would have 1 tab for all data and 20 tabs with the data for each rep. Basically, I need to copy and paste each rep data into a new worksheet within the same workbook but didn't want to do it manually. I hope this makes sense. See Ron de Bruin's site for code. http://www.rondebruin.nl/copy5.htm Also check out his easyfilter add-in. http://www.ro...

Help Required
Hi, Whenever I open Outlook 2003, I am getting a dialog box which displays the following message: Microsoft Office Outlook has encountered a problem and needs to close. We are sorry for the inconvenience When I click Debug it displays a message box with the following error message "The instruction at "0x3007e993" referenced memory at "0x0000000:. The memory could not be read" When I click No it Visual Studio JIT debugger pops up. I uninstalled and installed several times but still the problem persists. Is there any regsitry entry that I've to modify/delete? ...

Offline folder problems #2
Hi Guys, Basically I installed Outlook 97 on my office PC which is connect to microsoft exchange server. For some reason all of my messages were copied into offline folders, this causes a problem, whenever I open up outlook I get this message. Upload of offline changes could not be completed you do not have sufficient permission to perform this operation on this object. See the folder contact or see your system administrator. I do not administrator access on my user profile, every time I open outlook it resets everything I have changed (view etc) and gives that error message. How ...

Excel 97 VBA Help File
In the MS Excel Visual Basic Reference help file contents page, I click on Functions and it only offers me functions beginning with the letter S. So, I have a list of Solver and SQL functions. But what about all the other functions in VBA, for example for doing arithmetic and manipulating dates and strings? Why don't they show up? Are they left out because those functions are all part of Visual Basic generally, and the Excel VBA help file is specific to the _extra_ functions in Excel VBA? It's the only explanation I can think of. Am I right, or have I got a corrupted help file (vbaxl...

HELP Recovering addresses and email from Outlook 2003
I had some serious driver issues that required re-installing XP from disc. I did use the backup option and have a backup of all the old data. And of course had to reinstall Office 2003. Will third party software restore my old email and addresses or am I out of luck?? Thanks for the help texraid wrote: > I had some serious driver issues that required re-installing XP from > disc. I did use the backup option and have a backup of all the old > data. And of course had to reinstall Office 2003. > > Will third party software restore my old email and addresses or am I > out of lu...

Need Help with Deleting Empty Paragraphs in Word 2003
I have written the code below to delete all empty paragraphs at the end of a document and then place the cursor at the end of the last paragraph. It works fine as a stand alone sub in a new doc, but fails inside the real document that contains other code that manipulates several documents. The failure is that it will delete the last empty para, but then gets stuck looping inside the While...Wend because subsequent .Delete are not happening. So, the question is why would this work in one document, but then fail in another? n = 0 ...

help need with VC 6.0 IDE and mfc
Hello, First let me explain the scenario where i m using this requirement. We are Using CustomAppWizard and designing a wizard .One of the wizard pages will Insert Composite controls as many as the user wants . 1.So i should be able to dynamically insert ATL controls without using Insert Control Dailog. 2. can any one tell me how to dynamically create Template file in TEMPLATE folder of resource view . 3. I want to include many files created by templet files and add them to build by editing newproj.inf Is it possible to do this. 4.I would even like to know if i have 2 ifles in my C drive h...

Receiving Transaction Entry #2
I went into Receiving Transaction Entry to record the receipt of an item. The invoiced price did not agree with the purchase order. I had to add Shipping and adjust the provincial tax. I went to the proper screen to over-ride the calculated tax and the system told me that I couldn't do that because I had not filled in all the BOLD, RED areas. At that point I wanted to close down that screen, but the system would not let me do that either. I could minimize the screen and then I could also see that there wasn't any required information that had not be entered. The only way I c...

Opening pub files created with older Publisher versions #2
I have just upgraded to Publisher 2003 from 2000 and am having trouble with pub files sent to me for our chuch newsletter which is using Publisher 97 The text is not wrapping around graphics boxes. Can I fix this? I really don't want to go back to Pub 200 Thank Richard this is caused by Publisher 97 not been printer independent. Even if you went back to Publisher 2000, unless you have the identical font versions and printer driver you would have issues with formatting. It sounds like the person sending you the file has a garbage HP inkjet printer. Get them to install the HP5P laser p...

Help me identify my missing permission (Cannot open public folder) -2147217843 (Maybe Authentication Fails?)
The following snippet of code throws an error number -2147217843. When I googled this error code, I see many references to authentication failed. I am assuming my problem is some kind of permission related problem on the "MyNewFolder" public folder. -- start code --- Dim objFolder As New CDO.Folder Dim f As ADODB.Field 'sURL is like: file://./backofficestorage/mydomain.com/Public Folders/MyNewFolder/ objFolder.DataSource.Open sURL, , adModeReadWrite, adFailIfNotExists --- end code -- I have code that runs before this that actually creates the "MyNewFolder" publ...

Associating Multiple Existing Contacts to an Account, Until CRM 2.x
I have racked my pea-sized brain for endless days for a way to associate multiple existing contacts (or accounts) to an account. My client has accounts that have many contacts (or accounts) involved at different stages of acquiring a new account. The logical method would be to add a custom attribute with lookup functionality into the existing CRM contact or account objects but this is not possible with CRM 1.x. The resulting UI would allow an end user to associate different contacts (or accounts) to an account. Example: Account: ABC - AccountPhysician: (existing account or con...

WordWrap lost in .net ?
In VB6 we have the WordWrap property, whiche enables the growth of the label control. It's useful, because we just have to put text into it, and the control resizes itself properly. I need to manage the same behavior in FW4, WPF. But the label is not multiline, and I didn't find any control which grows to wrap its content. Maybee I'm missing something somewhere ? Do you have a solution ? Christian Being a web developer, I can't claim to know a lot about that, but after looking at the documentation, I found the following: ms-help://MS.VSCC.v90/MS.MSDNQTR....

VCard issue #2
This is a weird problem, but when I send a vcard to someone, it shows up in my sent items as a vcf file, and has a vcard icon on it, but when the recipient gets the VCard, it shows up as msg file, with an envelope icon as the attachment. When I open it, nothing is there - it's empty. I can't find anything regarding this problem on google or MS's website. Anybody have any ideas? Is it a problem with Outlook? Do I need to do a detect and repair, a reinstallation? Thanks for your help! Does the same happen when you send a message to yourself? Is he/she able to see it w...

Some Excel formatting functions taking a long time to work #2
Excel 2000 SP3 When I use some formatting functions for the first time in a session, such as bold, increasing font size etc, it takes up to 30 seconds to work. Meantime Excel is locked up until it completes that formatting call. I suspect faulty DLL? Has anyone experienced this? How to fix (other than a complete re- install) ? Any advice appreciated. Piri On Nov 5, 8:39=A0am, Piri <wiremu.pare...@hotmail.com> wrote: > Excel 2000 SP3 > When I use some formatting functions for the first time in a > session, such as bold, increasing font size etc, it takes =A0up to 30 > secon...

Need HELP! for Linking data
Could someone please direct me to where I can learn how to link date in a work book. i.e., I have individual pages for each subject but I need the data that is entered in these individual pages to transfer to the Master page without having to manually in put it.........TNX Bubey, There are not too many bits about linking worksheets or workbooks that I can find. But have a look at the links below, in case they give you the information you need. I think it is frustratingly one of those things which is very easy when you know how, or if you can get someone to actually show you, but if you hav...

2 Domains, 1 Exchange Server
Hi, We're trying to go with 2 seperate 2003 domains, but with only one Exchange 2003 Server. What would be needed for the domain that the Exchange server is not in to access e-mail? We've contemplated having those users use OWA, but would really like them to be able to use Outlook 2003. We're a school district and want to segregate the kids domain from the administration domain, but only have funding for one Exchnage server. Any ideas\help will be appreciated. TIA. Hi, This should explain what it requires: http://support.microsoft.com/?id=278888 Leif "tj woo...

Creating a Macro to Delete Commas #2
I have an excel file that the size will varry. I need a macro that will check all the fields for a comma. If there is one I would like to get rid of it. Does anyone have any idea how to do this? I have no idea and I have been assigned this task. Help --- Message posted from http://www.ExcelForum.com/ No macro required. ctrl-H for find/replace. find , replace nothing (leave the replace field blank). You can of course record that within a macro if you wish. Drabbacs >-----Original Message----- >I have an excel file that the size will varry. I need a macro that will >check ...