Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / XML / July 2006

Tip: Looking for answers? Try searching our database.

Invalid carachter loading xml

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Fabri - 03 Jul 2006 11:02 GMT
I'm trying to parse a xml source.

1) I query via webservices one table and obtain this output

================================================================
<?xml version="1.0" encoding="utf-8"?>
<ExecuteReaderResult
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.mysite.com">
  <DataSet>
    <xs:schema id="NewDataSet" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
      <xs:element name="NewDataSet" msdata:IsDataSet="true"
msdata:UseCurrentLocale="true">
        <xs:complexType>
          <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element name="Table">
              <xs:complexType>
                <xs:sequence>

                  <xs:element name="id" type="xs:int" minOccurs="0" />
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:choice>
        </xs:complexType>
      </xs:element>
    </xs:schema>
    <diffgr:diffgram
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">

      <NewDataSet xmlns="">
        <Table diffgr:id="Table1" msdata:rowOrder="0">
          <id>PIPPO</id>
        </Table>
        <Table diffgr:id="Table2" msdata:rowOrder="1">
          <id>PLUTO</id>
        </Table>
      </NewDataSet>

    </diffgr:diffgram>
  </DataSet>
  <Error>false</Error>
  <ErrorText />
</ExecuteReaderResult>

================================================================

2) I try to read it this way:

   
    Dim reader As New XmlTextReader(OutputXML)

    ' OutputXML is a string with the xml value above

I obtain "invalid carachter"

Can you point me to some workarounds?

I only have to parse <Table> nodes for "PIPPO" and "PLUTO".

Any help appreciated.

Best regards.

Signature

fabri
MKDS: Joker® - <waiting for ds lite...>
AC:Fabrizio, Kanoemi, 1890 4700 1546
Tetris DS: 748422 559210

Oleg Tkachenko [MVP] - 04 Jul 2006 08:54 GMT
>     Dim reader As New XmlTextReader(OutputXML)
>
>     ' OutputXML is a string with the xml value above

The argument of the XmlTextReader constructor is XML file path, not XML
content in a string. If you want to read string, use StringReader class:

(C#)
XmlTextReader reader = new XmlTextReader(new StringReader(OutputXML);

or if you are doing .NET 2.0 then

XmlReader reader = XmlReader.Create(new StringReader(OutputXML));

Signature

Oleg Tkachenko [XML MVP, MCPD]
http://blog.tkachenko.com | http://www.XmlLab.Net | http://www.XLinq.Net


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.