all groups > dotnet xml > march 2007 >
You're in the

dotnet xml

group:

Illegal characters in path


Illegal characters in path GaryDean
3/30/2007 2:51:52 PM
dotnet xml: I'm getting an XML dataset from a web service passed as a string.
I then do
XmlDocument myXmlDoc = new XmlDocument();
myXmlDoc.Load(mystring);

This causes an exception: Illegal characters in string. the string contains

<?xml version=\"1.0\"
encoding=\"UTF-8\"?>\n<validate>\n\t\t\t\t\t<error>\n\t\t\t\t\t\t<message>Login
failed</message>\n\t\t\t\t\t</error>\n\t\t\t\t\t<sessionid/>\n\t\t\t\t</validate>

Is there something wrong with this string? could those tabs be causing the
problem?

Is there a utility tester anywhere that will tell me what's whats wrong with
an xml string?

Regards,
Gary Blakely

RE: Illegal characters in path Helena Kotas [MSFT]
3/30/2007 3:48:04 PM
Hello Gary,

The XmlDocument.Load method is expecting a file name or a URL. If you want
to load the XML from a string, you need to use the XmlDocument.LoadXml method.

Thanks,
-Helena Kotas, MSFT

[quoted text, click to view]
RE: Illegal characters in path v-wywang NO[at]SPAM online.microsoft.com
4/2/2007 4:23:01 AM
Hi Gary,
Thanks for Helena's reply.

public virtual void Load (string filename)

XmlDocument.load method is used for loading xml document from file.

http://msdn2.microsoft.com/en-us/library/875kz807.aspx
XmlDocument.Load Method

Howerver, if you want to load xml from string object, XmlDocument.LoadXml
method is support in this scenario.

http://msdn2.microsoft.com/en-us/library/system.xml.xmldocument.loadxml.aspx
[XmlDocument.LoadXml Method]

By the way, about how to test what wrong with an xml string? Copy the xml
string into xml file and open it with IE. Internet Explorer will tell us
the story.

Hope this helps,
Sincerely,
Wen Yuan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
RE: Illegal characters in path v-wywang NO[at]SPAM online.microsoft.com
4/4/2007 12:00:00 AM
Hi Gary,

Just want to check whether the issue has been resolved.
If it still persists or you have anything unclear, please feel free to let
me know. I'm glad to assist you.

Have a great day,
Sincerely,
Wen Yuan
AddThis Social Bookmark Button