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 / New Users / March 2006

Tip: Looking for answers? Try searching our database.

not able to read an XSD file

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Pooja - 30 Mar 2006 22:57 GMT
Hi,

I have an xsd file. I'm trying to read it into a dataset or even any other
collection will do. But the problem is it is not getting read. Also, it is
not throwing any error. Kindly help me on the same.

Thanks,
Pooja
Cerebrus - 31 Mar 2006 05:10 GMT
Hi Pooja,

Please post the code you're using to try to read the data.

Regards,

Cerebrus.
Pooja - 31 Mar 2006 16:10 GMT
Hi,

Actually none of my code was working. Still I'll post whatever I tried. Hers
is the code:

1. In following code, I'm not able to reach the values of the items.

XmlSchema xsd;
XmlSchemas schemas = new XmlSchemas();
using(FileStream fs = new FileStream(@"C:\Schemas\CoafPrimitives.xsd",
FileMode.Open))
{
   xsd = XmlSchema.Read(fs, null);
   xsd.Compile(null);
}
               
foreach(XmlSchemaObject xso in xsd.Items)
{

}

2. In this code, the table count is always 0:

XmlDataDocument myXmlDataDocument = new XmlDataDocument();
StreamReader myStreamReader = new
StreamReader(@"C:\Schemas\CoafPrimitives.xsd");
myXmlDataDocument.DataSet.ReadXml(myStreamReader);
Console.WriteLine("Tables count=" +
myXmlDataDocument.DataSet.Tables.Count.ToString());

Please advice.

Thanks,
Pooja.
Cerebrus - 31 Mar 2006 19:06 GMT
Hi,

The use of the XmlSchemas class suggests that this is VS 2005 code. In
that case, I am unable to help you. I am not yet familiar with the 2005
version of VS.

Regards,

Cerebrus.
Pooja - 31 Mar 2006 22:40 GMT
Hi,

Thanks for replying.
Can you please have a look at the 2nd code. That is not using Schemas. Even
I'm working on VS 2003 and not 2005. So you can provide me any code that
works for VS 2003, Framework 1.1

Thanks,
Pooja.
Cerebrus - 31 Mar 2006 23:18 GMT
Hi,

As I mentioned, I tried *both* the code fragments, and they work for
me. I might be able to help you more if you could describe exactly what
you want to do after reading an XSD File... Or post atleast a part of
your XSD file, so that I can test the code with that file. Right now I
just tested with a sample XSD.

For the 1st code segment, using "Console.WriteLine(xso.ToString());"
within the foreach loop, I was able to output the types of upper level
elements in the file.
For the 2nd code segment, I was able to get a Table count of 1.

Regards,

Cerebrus.
Cerebrus - 31 Mar 2006 22:42 GMT
Hi,

1. What version of VS are you using ?

2. Are the two segments of code you posted related ? I can see that
they're trying to read the same XSD file, but how are they related to
each other ?

3. Both your segments of code seem to work for me, so it might be a
problem with the xsd file. BTW, don't forget to close your StreamReader
after you're done reading.

4. In the first code segment, what do you want to do with each
XmlSchemaObject ?

Regards,

Cerebrus.
Pooja - 31 Mar 2006 23:50 GMT
Hi,

Both the codes are not inter-related. 2nd one is not using Schemas. I'm
working on VS 2003 and not 2005. So you can provide me any code that
works for VS 2003, Framework 1.1

Thanks,
Pooja.
Cerebrus - 31 Mar 2006 23:57 GMT
Hi again,

I think I might be able to explain it better (and understand you
better), if we could chat in real-time. Do you use any sort of instant
messenger ?

Regards,

Cerebrus.
Pooja - 01 Apr 2006 00:21 GMT
Yes,

poojabanka@hotmail.com

Thanks,
Pooja.

Rate this thread:







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.