CSV to XML, now to validate

hiya, 
I have a 3rd party function that converts a CSV to an XML doc.
I now need to validate the xmlDoc.I understand that I need a valid XSD for
the newly created xmlDoc, but the xmlDoc contains no schema definitions
etc.I'm not sure how to create an XSD, so that the fields are restricted to
"integer" datatypes etc.

Been looking for a while.I assume that I don't have to manually write an
XSD?maybe I should create a "dummy" table in sqlServer, then generate a
dataset to get the XSD?Or, maybe vis studio 2003 has tools to make this
easier?

Any suggestions appreciated.

cheers, 
yogi

-- 
Message posted via http://www.dotnetmonster.com
0
forum6168 (38)
4/4/2005 2:14:06 PM
dotnet.xml 7266 articles. 0 followers. Follow

4 Replies
607 Views

Similar Articles

[PageSpeed] 19

use the tool XSD.exe that comes with Visual Studio to generate an XML Schema 
from a XML doc

Gabriel Lozano-Mor�n

"chris yoker via DotNetMonster.com" <forum@DotNetMonster.com> wrote in 
message news:0a53faf053d645f8bfcf05f30cd72b7e@DotNetMonster.com...
> hiya,
> I have a 3rd party function that converts a CSV to an XML doc.
> I now need to validate the xmlDoc.I understand that I need a valid XSD for
> the newly created xmlDoc, but the xmlDoc contains no schema definitions
> etc.I'm not sure how to create an XSD, so that the fields are restricted 
> to
> "integer" datatypes etc.
>
> Been looking for a while.I assume that I don't have to manually write an
> XSD?maybe I should create a "dummy" table in sqlServer, then generate a
> dataset to get the XSD?Or, maybe vis studio 2003 has tools to make this
> easier?
>
> Any suggestions appreciated.
>
> cheers,
> yogi
>
> -- 
> Message posted via http://www.dotnetmonster.com 


0
4/4/2005 2:18:41 PM
cheers Lorenzo, 
I have successfully located the xsd.exe
When I click on it, a DOS window opens up for a few seconds then closes.Is
this normal behaviour?I understand that I should probably supply args, but
I thought that it would open in DOS mode and stay open, waiting for input?

Is thare any way that I can:
1) assign this xsd.exe to my run directory, so that I can simply type in
Run --> Xsd.exe?
2) keep the xsd.exe open?

Sorry for the questions, command line stuff isn't my strongpoint ;-)

many thanks, 
              yogi

-- 
Message posted via http://www.dotnetmonster.com
0
forum6168 (38)
4/4/2005 2:50:01 PM
You should open a Visual Studio .NET 2003 command prompt and type the 
following:

XSD.EXE yourxml.xml /o:c:\outputdir

Gabriel Lozano-Mor�n

"chris yoker via DotNetMonster.com" <forum@DotNetMonster.com> wrote in 
message news:6a309637c8234c518ef795643a5fbef2@DotNetMonster.com...
> cheers Lorenzo,
> I have successfully located the xsd.exe
> When I click on it, a DOS window opens up for a few seconds then closes.Is
> this normal behaviour?I understand that I should probably supply args, but
> I thought that it would open in DOS mode and stay open, waiting for input?
>
> Is thare any way that I can:
> 1) assign this xsd.exe to my run directory, so that I can simply type in
> Run --> Xsd.exe?
> 2) keep the xsd.exe open?
>
> Sorry for the questions, command line stuff isn't my strongpoint ;-)
>
> many thanks,
>              yogi
>
> -- 
> Message posted via http://www.dotnetmonster.com 


0
4/4/2005 2:58:40 PM
thanks Gabriel.
this now creates them all with a default dataType of "string".I assume that
I now go in and manually change the datatypes (if required) to integer etc?
you've been a great help.

BTW, here's a wee article that I've just found, explaining the motivation +
approaches for xml schemas:
http://www.developerfusion.com/show/2386/1/

cheers, 
yogi

-- 
Message posted via http://www.dotnetmonster.com
0
forum6168 (38)
4/4/2005 3:28:47 PM
Reply:

Similar Artilces:

DATA VALIDATION #27
I NEED TO VALIDATE ENTRIES. EACH ENTRY CONSIST OF A NUMBER AND A LETTER LIKE 6A OR 6B. A, AND B TO BE ACCEPTED ONLY IF THEY ARE FROM THE ENGLISH ALPHABET Hi! Do you mean a single digit (0...9) and a single letter( A...Z) ? If so, one simple way is to create a data validation list with all th possible combinations. The following very basic VBA routine will pu such a list in column A. Sub fillit() r = 1 For i = 0 To 9 For j = 1 To 26 Cells(r, 1) = i & Chr(j + 64) r = r + 1 Next Next End Sub Are you familiar with Data > Validation? Al -- Alf -----------------------------------...

.CSV to .PRN
I am having trouble saving a .CSV file as a .PRN format - it is cutting the information in the sheet off about 20 columns in - any suggestions? I am doing the basic File - Save as. Thanks, Melissa Have you formatted the sheet with a fixed-width font so you can set the field widths exactly? What is sum of field lengths? There used to be a limit of ~240 characters per line in PRN files. On Mon, 18 Oct 2004 10:13:08 -0700, "Melissa" <Melissa@discussions.microsoft.com> wrote: >I am having trouble saving a .CSV file as a .PRN format - it is cutting the >information i...

Help with parsing XML document.
Hi, I am going nuts with this. Can you help me write a code to parse this XML document. I need to get values from all the tags and assign them into variables. See code below. The code is in VBScript. Many thanks, Roger. <% option explicit response.expires = 0 Response.CacheControl = "no-cache" response.buffer = true Response.ContentType = "text/html" Dim xmlString xmlString = "<?xml version=""1.0""?>" & _ "<ResponseService Version=""2.3"">" & _ " <Header>" & _ ...

xml serialization #5
All - I'm pretty comfortable with simple XML serialization of objects. However I observed something the other day and I wanted to know if I solved it the right way. Basically if I have a string which contains a single xml node, I can serialize with this line of code: object = (object)serializer.Deserialize(new XmlTextReader(xml,XmlNodeType.Element,null)); where xml is the string that represents the node However if the string contains two nodes that individually would serialize to the "object" I have to do the following to be able to serialize to an array. Code looks like t...

XML #2
I created a database in MS Access 2000 that I collect data and then through queries I export the data to MS Excel 2003. I don't have any problems with that. But is there a way that I can create mappings from MS Excel 2003 to XML? I have learned how to import XML data into MS Excel 2003, but if the data originates in MS Excel 2003 how can I get it out to XML? Can anyone suggest books/websites? Or is there a tool that I can use? Thank you in advance! -- Ryan W Ryan, MS Access 2003 provides this functionality. You can export to XML as an option and create a schema which then can be ...

Receipt XML
I would like an extra claim receipt to be printed if a workorder has been issue with the ItemLookupCode "Service". I would print out an extra claim slip with the our company name, Name of customer, barcode number of workorder, Comments and a statement stating that items must be pickup within xx days of being repaired. Jeff if you out there - I' am sure you could do this in your sleep. Danny This is a multi-part message in MIME format. ------=_NextPart_000_010A_01CA5BC8.98F39ED0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-...

Repeater and XML Node List
Alrighty, so if I have an XmlNodeList as the data source for a repeater, in my repeater, I would like to do things like: <%# DataBinder.Eval(Container.DataItem, "ChildNodes[0].InnerText") %> But everytime I do it says stuff like: 'System.Xml.XmlChildNodes' does not allow indexed access. Of course, it's perfectly happy to use FirstChild.NextSibling.InnerText, but I'd like to use indexed methods or properties, but it does not seem to work. Here is sample code: <%@ Page Language="C#" autoEventWireup="false"%> <%@ Import Namespa...

Is XML robust enough?
Is the DataSet using XML robust enough? I had a table with an autoincrement column in it for an row index. After doing some completly non related work the XML file would not reload. I looked at the XML file and I had a missing row that was replaced by a copy of another row. So I had two rows with the same data, and same IDs in it. From the time the XML file was good to the time it was corrupt the application never deleted a row or added a row. Columns in the row were modified but none were deleted or added, but yet this problem happend. Now I am wondering if XML access in DotNet is robu...

Product Suggestions & Feedback Now Available in Newsgroups!
Greetings Community Members! As you may or may not have noticed the newsgroups now give you the ability to post Product Feedback and Suggestions! Up until about a week and a half ago product suggestions were only entered via our secure web sites (only accessible for our certified partners or customers on an enhancement plan), but we have since changed this process to allow anyone in the community to submit product suggestions! For those of you using Microsoft’s Web based newsgroup reader I hope this is a feature that you are enjoying. For those of you using different newsgroup readers,...

Creating a csv
I have a spreadsheet with a list of email addresses in the first column. I want to create a CSV file. If I choose Save as---> csv and then open the csv file in Notepad the list is saved as a list with carriage returns after each email address and no commas. So how do i turn the list into a continuous list with no breaks and a comma seperating each one? I'm using Excel 2007 Thanks Tony Open the file in MSWord and do an edit|replace (or the MSWord 2007 equivalent) to change the paragraph mark (under the More button and then under the Special button) to a comma. Tony Williams wrote: ...

Importing CSV files problem
Hi Guys, I am currently working on a project that invloves importing of CSV files to Excel. Double-clicking the CSV file opens the file automatically in Excel. We have enclosed our data in quotation marks (i.e. "SomeData") to prevent errors arising from strings that have commas as part of the data. This works fine for us. However, The problem arises when we import data that look like numbers written in scientific notation but are actually some other data which should not be expressed in scientific notation (example "1E306" is expressed as "1E+306"). ...

CSV elements don't get split up in cells
Hi, I recently installed a German version of excel and now when I open m CSV files they don't get seperated anymore by the commas. The whol line is just written in one cell. When I had the US version installed the data was split up after eac comma and distributed into the corresponding cell. How can I achieve the same thing in the German version -- Message posted from http://www.ExcelForum.com tom You could try renaming the file to .txt rather than .csv When you try to open this in Excel it will start the Text Import Wizard which will give you much more control over the import of th...

create xml document based from schema
I have the following schema. I need to know how to make an xml document based from it. The main worry I have is the DateTime field. <?xml version="1.0" encoding="utf-8"?> <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="NewsArticle"> <xs:complexType> <xs:sequence> <xs:element name="Description" type="xs:string" /> <xs:element name="Body" type="xs:string" />...

Saving As .CSV
Hello, here's the situation: I downloaded an .xls file from my broker and opened it in Excel. The original file was delimited by commas and I had to choose comma delimited in order for Excel to display it in columns/rows correctly. I made some changes to the file, then saved it with a new name. The problem is, I can find no way to save it as a comma delimited file again. Saving it as a Workbook places quotes around the commas and creates spacing between text (when I view it in Wordpad), and saving it as a Text File (Tab delimited) does just that--makes it TAB delimited, not comma...

Parsing CSV
Hi, im using A file with records in my mfc application, i need to read*/write records to the file anybody ahs a clue where should i start? Take a look at CStdiofile and CString::Format() (for output) and CString::Tokenize() (for parsing input). You can use ReadString() and WriteString() to access the file line by line. Tom "fima" <fkpkot@gmail.com> wrote in message news:eXA9vp95FHA.1184@TK2MSFTNGP12.phx.gbl... > Hi, > im using A file with records in my mfc application, i need to read*/write > records to the file anybody ahs a clue where should i start? >...

command button validation
I have the following code in an Access Form: It works well; however, if a user enters the form and hits the command button below (54) (without entering any info) the command triggers the Msgbox event, without checking form/table validation. Conversely, if a user enters the form and types even a keystroke, then hits the command button, Access knows to kick in the validation that I've set up and instructs the user to populate required fields. Question: how to make the code below check for form/table validation even if the user types nothing into the form? Thanks for your help ~ alex Pri...

When saving CSV excel always prompts about the file format
I work with a lot of csv files all day and they have to be this format for other applications and scripts to use them. Everytime I save Excel prompts "filename.csv may contain features that are not compatible with csv, do you want to keep this format". This is the case even with Control S. The only formating is that I make the columns big enough for me to read whats in each cell. Anyway - can I turn off this prompt so that Excel just saves the file as csv? Thanks, Simon Try this before the save Application.DisplayAlerts = False and reset it after the save Application.Di...

Conditional validation :-)
Hi, I am using list validation in column A where user can choose 1-9 in each cell. What I wish to create is: if A1=1 then the validation list for B1 is 1.1 to 1.9 if A1=2 then the validation list for B1 is 2.1 to 2.9 and so on.... In effect, its conditional which validation list is being used. How do I set this up?? Thanks in advance Robert Hi! Here's one way: Create a table like this somewhere on your sheet: 1 1.1 2.1 3.1 ... 9.1 2 1.2 2.2 3.2 ... 9.2 3 1.3 2.3 3.3 ... 9.3 4 1.4 2.4 3.4 ... 9.4 ... 9 1.9 2.9 3.9 ... 9.9 Assume the table is in the ran...

XML Comment documentation
Where can I find some documentation on creating XML comment files. I would like to know the format/conventions for creating them. Hello, "WALDO" <MidnightNOSPAMAlley@hotmail.com> schrieb: > Where can I find some documentation on creating XML > comment files. I would like to know the format/conventions > for creating them. There are some tools available for creating these files. My XML Comments FAQ: VB Commenter: http://www.gotdotnet.com/team/ide/ -> section "VB Commenter" XML Documentation: http://www.gotdotnet.com/team/vb/ -> section "XML ...

import CSV
I am trying to import a csv file into excel or access(both are XP verson). Both apps use the General format meaning if it thinks a field is a date it makes it a date. I need this turned off. I want 5-9 to remain 5-9. Please help thanks Milton Snider wrote: > I am trying to import a csv file into excel or access(both are XP verson). > Both apps use the General format meaning if it thinks a field is a date it > makes it a date. I need this turned off. I want 5-9 to remain 5-9. Please > help > thanks > > Milton, I think you can rename the .CSV file to .TX...

unexpected line breaks in .csv
I have a spreadsheet with around 125 records and 130 fields. Not all of the fields are populated for all records; several of the fields have no entries at all. When I save the file in .csv format, each record gets a line break in a different place. I can't correlate it with the length of the record in characters or fields, or with which fields are/aren't populated. It appears that each record is being broken into 4 pieces. This makes it impossible to import the file into the target application. Can anyone help me eliminate or at least learn how to work around the problem??...

Excel viewers
Excel can load both "traditional" excel files with the .xls extension, and it can also open "XML" excel files with the .xls extention. Why can't the Excel viewer open both. Currently it can only open excel files; it doesn't recognise XML files. Ultimately, I'd like to produce a markup file which I can then launch with the Viewer. Any suggestions? >>Currently it can only open excel files; it doesn't recognise XML files. The viewer has been around quite a while, well before Excel 2003 which is the first version that can read/write XML file. I ...

download CSV or xls fomat
Hi My bank only allows download of CSV/TXT or XLS format. Please can you advise which format is best to use and how to upload the file to Money in the quickest way? (When I was with my old bank, I've was able to download a 'Money' formatted file and I could 'Open' it directly into Money). Is this still possible with cvs or xls? Thank youi. None of those can go into Money directly. There are converters that might get you there, but would probably require some technical effort on your part. What are you up for? "April" <noreply@mail.com> wrote...

XML samples
Does anyone have good links for MSXML sample code? I need to parse XML files and convert to HTML with a somewhat different format. It may be easier just to parse the strings, but I figure that MSXML is worth a look if I don't have to start from scratch. On Thu, 25 Mar 2010 14:01:39 -0500, mayayana wrote: > Does anyone have good links for MSXML sample code? I need to parse XML > files and convert to HTML with a somewhat > different format. It may be easier just to parse the strings, but I > figure that MSXML is worth a look if I don't have to start from s...

Import csv file of users into Exchange 2003
Hi, I am using Windows 2003 and Exchange 2003. I have recently been asked to incorporate a list of 2000+ users/e-mails from a csv file so that our internal users can use select the names from the address book. It is likely that this list will be update on a monthly basis, therefore I need to be able to remove entries and re-populate with the new list. Is the best method for doing this via the Csvde utility? Do the users have to become a part of Active Directory? Can I create them into a separate list which can be accessible via internal users accessing the address book and selecting a "...