I have a well-formed XML file that I am trying to load into a dataset
using the ReadXML method. It keeps telling me that "there are multiple
root elements". I can view the data using XML Designer in Visual
Studio 2003 without any problems and the schema and file have been
validated using several different tools. I even successfully generated
a typed dataset with Visual Studio 2003 by importing the XML into my
project. I'm baffled, does anyone have any thoughts?
This is the latest version. I've tried it using various xmlReadModes
and without the ReadXmlSchema call but I get the same exception every
time.
Dim y As New DataSet
Dim xmlPath as String = "..\01.xml"
Dim xmlFileStream As New FileStream(xmlP ath, FileMode.Open)
Dim xmlTextReader As New XmlTextReader(x mlFileStream)
Try
y.ReadXmlSchema ("..\01.xsd" )
y.ReadXml(xmlFi leStream, XmlReadMode.Ign oreSchema)
Catch ex As Exception
Throw ex
End Try 2 1809
HI,
You need to add DataTable for the DataSet and Columns for the DataTable the same time.
MSDN site has really good topic with sample code showing you how to accomplish this: http://msdn.microsoft.com/library/en...asp?frame=true
-- Yingzi
This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm
Note: For the benefit of the community-at-large, all responses to this message are best directed to the newsgroup/thread from which they originated.
-------------------- From: "bf*****@comcas t.net" <bf*****@comcas t.net> Newsgroups: microsoft.publi c.dotnet.xml Subject: Baffling READXML problem Date: 19 Oct 2005 09:39:27 -0700 Organization : http://groups.google.com Lines: 29 Message-ID: <11************ **********@g43g 2000cwa.googleg roups.com> NNTP-Posting-Host: 146.243.4.157 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google. com 1129739980 7411 127.0.0.1 (19 Oct 2005 16:39:40 GMT) X-Complaints-To: gr**********@go ogle.com NNTP-Posting-Date: Wed, 19 Oct 2005 16:39:40 +0000 (UTC) User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322),gzip( gfe),gzip(gfe) X-HTTP-Via: 1.0 proxysv03.jud.s tate.ma.us:3128 (Squid/2.4.STABLE6) Complaints-To: gr**********@go ogle.com Injection-Info: g43g2000cwa.goo glegroups.com; posting-host=146.243.4. 157; posting-account=KjtniQ0 AAAAnunjTbEKn-UFEdcuIddxr Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!ne wsfeed00.sul.t-online.de!t-online.de!news. glorb.com!postn ews.google.com!
g43g2000cwa.goo glegroups.com!n ot-for-mailXref: TK2MSFTNGXA01.p hx.gbl microsoft.publi c.dotnet.xml:89 85 X-Tomcat-NG: microsoft.publi c.dotnet.xml
I have a well-formed XML file that I am trying to load into a dataset using the ReadXML method. It keeps telling me that "there are multiple root elements". I can view the data using XML Designer in Visual Studio 2003 without any problems and the schema and file have been validated using several different tools. I even successfully generated a typed dataset with Visual Studio 2003 by importing the XML into my project. I'm baffled, does anyone have any thoughts?
This is the latest version. I've tried it using various xmlReadModes and without the ReadXmlSchema call but I get the same exception every time.
Dim y As New DataSet
Dim xmlPath as String = "..\01.xml"
Dim xmlFileStream As New FileStream(xmlP ath, FileMode.Open)
Dim xmlTextReader As New XmlTextReader(x mlFileStream)
Try y.ReadXmlSchema ("..\01.xsd" ) y.ReadXml(xmlFi leStream, XmlReadMode.Ign oreSchema)
Catch ex As Exception Throw ex
End Try
Thanks but that example is in the regular documentation. The only
reason the data table and columns were created was in order to write
out an xml file so it could subsequently read it back in.
Additionally, the "Original" data set is not a typed dataset. The
example doesn't really address my problem, i.e. I don't know the size
and shape of the XML, (that's why I'm reading the XML schema) and I
want to place it in a typed dataset. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: TimS |
last post by:
I am getting a baffling File not found error (0x800A0035).
I am writing asp on a windows 2000 server. I build a path and filename from
several fields in a jet database using SQL commands, like this:
Sql = "SELECT dirs.rootname,dirs.dirname FROM dirs"
RS.open Sql
RS.movefirst
do while not RS.EOF
temp1=trim(RS("rootname"))
|
by: DraguVaso |
last post by:
Hi,
I should use XML to synchronize the data from different (VB.NET)
applications, and I was just wondering which Overloads of these functions
( ReadXmlSchema, ReadXml and WriteXml) goes the fastest? I don't think the
ReadXMLSchema would give a lot of difference, but maybe the overlaods of
ReadXml and WriteXml will. Especially with larges files/datatables...
Should I use the IO.Stream? The XmlReader/XmlWriter?
|
by: Jeffrey A. Voigt |
last post by:
I'm having trouble loading some xml data into a dataset via the ReadXML
call. I'm loading into the dataset an xml schema prior to the ReadXML call.
I see that there IS in fact, 3 records that should be created in the dataset
with the provided xml. However, after the ReadXML statement there are no
rows in the DataSet.Tables ? IS there something I'm missing? I can
assure you that the schema is correct, since it was originally created with...
|
by: CB |
last post by:
Using C# in .Net 2003, DataSet.ReadXml fails when a percentage (%) sign
is in the filename followed by 2 hex characters. Seems that the %
sign is likely encoding the following 2 hex characters. So
c:\test%ab.xml fails for ReadXml since %ab is interpreted as 171 and
c:\test171.xml does not exist. There is no problem with c:\test%mn.xml
because "mn" is not a hex code. If I replace the % sign with %25
(25hex = 37dec = ascii code for %),...
|
by: Mike |
last post by:
I have posted this before, but no one responds, so here
it goes again. I think my question is intimidating people
and I have no idea why?!? This is not a new concept. You
can do this with other programming languages, so why is
C# so different? Again, here is my baffling C# question.
I have C# code that opens an application, but right after
it opens I am confronted by prompts for information
(i.e. "Please enter your id"). I would like to...
| |
by: Double Echo |
last post by:
Hi,
Forgive me if I ask a dumb question, I'm new to classes and object programming with PHP,
and cannot figure out what the problem is with this class. Maybe I have overlooked
something but just can't see it. The error message usually means a typo or something
that I missed.
I get this error:
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in crypt_class.php on line 6
|
by: Mac |
last post by:
I'm trying to validate input from an xml source to a dataset in
dotnet2.0. As far as I can see, type errors correctly cause an
exception, but values that are the correct type but do not satisify
xsd:restriction conditions are ingested without a murmur. Is this a bug
or a feature?
Very frustrating.
Evidence:
1) XML data
<?xml version="1.0" encoding="utf-8"?>
|
by: Angel \Java\ Lopez |
last post by:
Hi people!
I'm running a Visual Studio 2005, Professional, on Windows XP Professional.
I've found a little big problem, reading a DataSet. If I try:
ds.ReadXml("c:\data.xml")
it raises the exception ONLY in Web Sites:
|
by: ERingmae |
last post by:
Hi,
The environment is .NET 2.0, the language is C# and the problem is
reading XSD file with xs:redefine section correctly to a
XMLDataDocument.DataSet.
What I am trying to do:
I am trying to create a DataSet object from an XSD file by using
XMLDataDocument class.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |