I have written an XML file in Visual Studio.Net and then it has created a schema for me (hence there a few unecessary namespace references in there). The problem is that when i try to validate the xml file against the schema in Visual Studio it says it cannot locate the schema document, even though all the paths specified are correct. It could be a problem with Visual Studio because there are a few other features which are a bit iffy. I have tried looking for online tools that will check a document against a schema but only found http://apps.gotdotnet.com/xmltools/xsdvalidator/ which is offline at the moment!
Is there any other way for me to check it, or can any of you see any errors i have made in the code? I'm not too bothered if there are a few small errors in the schema with regards to the syntax of the xml file at the moment but i just want to know why Visual Studio cannot locate the schema file to check against.
I have attached the code, practice.xml and practice.txt (the schema file)
Many thanks
There doesnt seem to be a link reference in the XSL file to the XML document (unles im missing something..) If it is however, is it included into teh project that visual studio is using for this.
OR it could be that th epath is nor root relative to the project folder.
post or point me in the right direction ot the specified path that the XML file is specified in.
ta
Kai
As the information I give is useful in its nature, consider using the RATE POST feature located on the bottom left of this post please..
A few things that make a good Developer a Great One. Methodical and a thorough approach to research and design inevitably leads to success. Forward thinking is the key to Flow of control. Never test in the design environment, always test in real time, you get the REAL results. CBSE & OOSE are the same animal, they just require different techniques, and thinking. SEO is a globe of objectives, SE rankings is an end to a means for these objectives, not part of them. The key to good design is explicit attention to both detail and response. Think Freely out of the "Box" you're in..... You will soar to better heights.
Thanks for replying, I'm not quite sure what you mean though. There is no XSL file for this document, just an XML document 'practice.xml' and the schema for it 'practice.xsd' (although i had to rename it 'practice.txt' in order to attach it to my post).
The line in the XML document which references the schema is the xsi:schemaLocation="practice.xsd" bit which as far as i understand should link to the schema as long as both the XML document and the schema are in the same directory? I did also try using a non-local directory and referencing the schema from that but that didn't seem to work either. The URL is http://www.dur.ac.uk/s.j.marjoribanks and the files are named the same.
Looks like thats ok.. Ae they both included in the project file you are working on as Visual Studio can be cryptic in creating the file for you, but not including it in the project.....
dot use VS.NET for XML stuuf so going off the top of my head here. Try that and get back
Kai
As the information I give is useful in its nature, consider using the RATE POST feature located on the bottom left of this post please..
A few things that make a good Developer a Great One. Methodical and a thorough approach to research and design inevitably leads to success. Forward thinking is the key to Flow of control. Never test in the design environment, always test in real time, you get the REAL results. CBSE & OOSE are the same animal, they just require different techniques, and thinking. SEO is a globe of objectives, SE rankings is an end to a means for these objectives, not part of them. The key to good design is explicit attention to both detail and response. Think Freely out of the "Box" you're in..... You will soar to better heights.
Well as far as I'm aware when using Visual Studio for XML purposes it doesn't create a 'project' like it does when working with VB for example. They are treated as separate files
EDIT: Ok, i've looked around and it seems that i didn't quite understand the whole Visual Studio thing. You don't create a project but the files you are working with both have to be imported into the same 'Visual Studio Solution'. Why it can't find the file otherwise is beyond me! Thanks!
Anyhow, there isn't an error anymore saying that it can't locate the schema but there are a whole load of other errors. Basically for every element that i have declared in my XML document (as attached above) it brings up an error saying it is not declared. What does this mean?
Last edited by steve_marjoribanks; Nov 21st, 2005 at 11:00 AM.
Visual studio is backward when it comes to individual files and key paired files such as XML Schemas and such........
Youll avhe to declare each XML element that its in the XML file on the XML schema. Because XML is a text editor all tagas ahve to be declared when using an XML schema to encode/decaode XML or else you get the errors youre getting.
to be quite honest, I would stop using Visual Studio right now for XML. ITS abag of poo!!
and get the home edition of XMLspy (free). Specialist for XM<L and schemas and such so well up youre street and easier to use. Its the dogs balls for all things XML.
In the meantime, decale all the elements in teh XML file to the schema and youre away..
P.S... Rate me!! <cheek!!!>
Any other probs buzz back
Kai
As the information I give is useful in its nature, consider using the RATE POST feature located on the bottom left of this post please..
A few things that make a good Developer a Great One. Methodical and a thorough approach to research and design inevitably leads to success. Forward thinking is the key to Flow of control. Never test in the design environment, always test in real time, you get the REAL results. CBSE & OOSE are the same animal, they just require different techniques, and thinking. SEO is a globe of objectives, SE rankings is an end to a means for these objectives, not part of them. The key to good design is explicit attention to both detail and response. Think Freely out of the "Box" you're in..... You will soar to better heights.
Thanks for that. I'll give XMLSpy a go, i was only really using Visual Basic because i had it on my computer already and the text colouring/line numbering etc is useful!!!
I don't quite understand what you mean by declare all the elements in the schema though, I thought i had done!
ps. can't rate you at the moment, it says i've got to spread the love around!!
If its sayig that you not, youll just have to check them all. You probably not closed a tag, declared one along the lines of coding, etc.
XMLspy is great. this is one of the few office suites that I actually paid the going rate for as we use XML and RSS in alot of our intranet development for P2P amnd busines to business communications arrays and such, and its ACE!!!!! Teh hoem version is real good and only 40 mb, loads of usefull stuff the comes with the enterprise version, and no time limit!!!
Cheers
Kai
As the information I give is useful in its nature, consider using the RATE POST feature located on the bottom left of this post please..
A few things that make a good Developer a Great One. Methodical and a thorough approach to research and design inevitably leads to success. Forward thinking is the key to Flow of control. Never test in the design environment, always test in real time, you get the REAL results. CBSE & OOSE are the same animal, they just require different techniques, and thinking. SEO is a globe of objectives, SE rankings is an end to a means for these objectives, not part of them. The key to good design is explicit attention to both detail and response. Think Freely out of the "Box" you're in..... You will soar to better heights.
Ok, i've installed XMLSpy and I'm now working in that, it seems much better than Visual Studio already so thanks for that!
However, i am still getting error messages. When i validate the XML document it comes up with an error saying "This file is not valid: Unexpected element 'projectDetails' in element 'GeotechnicalProject'. Expected: projectDetails"
Hope you enjoy XMLspt.. Its a great asset to anybodies programming army for XML stuff.
Good luck
Kai
As the information I give is useful in its nature, consider using the RATE POST feature located on the bottom left of this post please..
A few things that make a good Developer a Great One. Methodical and a thorough approach to research and design inevitably leads to success. Forward thinking is the key to Flow of control. Never test in the design environment, always test in real time, you get the REAL results. CBSE & OOSE are the same animal, they just require different techniques, and thinking. SEO is a globe of objectives, SE rankings is an end to a means for these objectives, not part of them. The key to good design is explicit attention to both detail and response. Think Freely out of the "Box" you're in..... You will soar to better heights.