Strongly Typing XML String/Document Argument

Hello All,

I have the following abstract function:

public abstract BookList LoadBooks(string ListBookXml);
public abstract BookList LoadBooks(XmlDocument ListBooks);

Is there any way to type the argument of each function so that it
corresponds to the required schema without resorting to an
XmlSerializable class as a parameter?

Thanx

0
11/13/2007 2:18:02 AM
dotnet.xml 7266 articles. 0 followers. Follow

2 Replies
651 Views

Similar Articles

[PageSpeed] 57

XML is a pretty wide funnel, without resorting to a searialisable type you'd 
have to consider XML validation and maybe throw up an exception.

Glenn

"Schemed" wrote:

> Hello All,
> 
> I have the following abstract function:
> 
> public abstract BookList LoadBooks(string ListBookXml);
> public abstract BookList LoadBooks(XmlDocument ListBooks);
> 
> Is there any way to type the argument of each function so that it
> corresponds to the required schema without resorting to an
> XmlSerializable class as a parameter?
> 
> Thanx
> 
> 
0
GlennAB (2)
11/13/2007 11:01:00 AM
I figured as much.

I think it would be a nice feature to be able to enforce a contract
that could expose the xml type expected and accept it as an xml string
or document parameter.  I guess behind the scenes all the validation
code would need to run anyways and any performance gains would be lost
anyways.

Thanx

0
11/13/2007 4:51:47 PM
Reply:

Similar Artilces:

Security based on Account Type
Can we define security/access based on field(s), say Account Type of Account, when Account Type is anything but "TypeA", all users of the system have full access, however when Account Type is "TypeA", only certain group(s) of people can see the accounts, how should I implement it? thanks A way I've been working on is to put some client side code, so that when the type of an account changes, the client side code will change the owner of the account, together with playing with the business unit security settings to achieve this. what do you guys think? appreciate...

How do I share User-Defined Custom Chart Types in Pivot Charts?
When I send file out to others, they can't see my user-defined chart that I modified and saved, and did a record macro to see each time data is changed. How can I share this? Excel Pivot Chart Question...... ...

Can i strong Type some xml format?
Hi, I wonder, if like typed dataset, i can strong type some xml schema. I have function which receives some xml document as parameter, Is there some mechanism to force the user to pass only this specific xml document (some specific schema)? ...

Changing Inventory Item Types #2
In GP7.5, is there any way to change inventory item types once they have been used? Can the item be deleted and then recreated at the end of a year? Are there any utility programs that can do this? In particular, I've got some "sales inventory" items that I want to convert to "kits" and others that need to be "services" We are on 8.0, but I don't think it is possible to change the item type - not even with Professional System Tools. We have changed the item name (via tools) to include the word Discontinued. Then we set up a new item to repl...

Specified argument was out of the range of valid values. Parameter name: index
I have a GridView that I'm trying to implement a Confirm OnDelete. The below code works except that I'm getting the error "Specified argument was out of the range of valid values. Parameter name: index" when ever I click Update. I know that this is happening because there are no controls now in that cell. What condition can I test against? Thanks /////////////////CODE///////////////////// <asp:GridView ID="SOCCatGridView" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"...

Multiple arguments?
When using an argument set to convert text to numerals between 2 sheets, I have found that I can only use a maximum of 2 arguments. If there is more than 2 options within the text to convert how would I do this? I.e. Other = O Gas Warm Air = G Gas / Oil = G Electric Storage = E etc... Thanks... Are you talking about VBA or functions? Assuming you meant functions you would need to use more than one character (in this case to make them different from each other), how else would you or anyone else differentiate between G and G? Regards, Peo Sjoblom "Ed Anton" wrote: >...

How can I type more than one line of text into a cell in Excel?
I am using Excel to organize contact information, names, addresses, phone numbers, etc. I would like all of this information in one cell and in the standard format of: name address phone etc. I do not know how to make Excel accept more than one line of text, unless I cut and paste it from a Word document. Could someone please tell me how to format the cells so that more than one line of text can be accepted in a cell? Hi use ALT+ENTER for inserting line breaks -- Regards Frank Kabel Frankfurt, Germany "watermark" <watermark@discussions.microsoft.com> schrieb im Newsb...

Can't type in AnswerWizard or Index of code window help
Hi All, I run Access 2002 Developer. Recently, when I open help from visual basic code window, it won;t let me type text in the answer wizard or index search boxes. The icon switches to a horizontal, double arrow, as if I was trying to resize the pane. I can't figure out what stupid thing I've done. I sure miss help, though. Does this sound familiar to anyone? Help! - Max ...

how do you type on here
does anyone know to type on here like letters "cheesy balls" <cheesy balls@discussions.microsoft.com> wrote in message news:1BDD3DFA-758F-4245-B761-8C5DA9DC42F6@microsoft.com... > does anyone know to type on here like letters Yes - press the relevant keys on your keyboard. press "reply" at the top in between "new" and "show:" "Gordon" wrote: > > "cheesy balls" <cheesy balls@discussions.microsoft.com> wrote in message > news:1BDD3DFA-758F-4245-B761-8C5DA9DC42F6@microsoft.com... > >...

How do I type white letter with black borders?
I know it must be simple, but how do I white letters with black borders or black letters with white borders? DennisS <DennisS@discussions.microsoft.com> was very recently heard to utter: > I know it must be simple, but how do I white letters with black > borders or black letters with white borders? Either use WordArt or an outline font. -- Ed Bennett - MVP Microsoft Publisher http://ed.mvps.org/ ...

Update/Delete/Insert data from XML
Hi all, I've been though many posts in this group and have yet to find one that helps me understand how to accomplish my goal. I have an XML document that stores user specific values that I need to maintain based on options they select in a web app. Here's the XML: <?xml version="1.0" encoding="utf-8" ?> <MyConfig> <UserInfo> <UserName>Joe Schmoe</UserName> <ReportAttributes> <ReqdFields> <Field Name="Address"/> <Field Name="City" /> <Field Name="Close_Date&q...

strong name
Hi I just wonder is it any point to use the sn kommand to create a strong name file when I can do all this from VS ? I mean that if I take property on a project and then select the Signing tab I can both create and assign this strong name to my assembly. //Tony "Tony Johansson" <johansson.andersson@telia.com> wrote in message news:u5LbebUtKHA.5936@TK2MSFTNGP04.phx.gbl... > I just wonder is it any point to use the sn kommand to create a strong > name file when I can do all this from VS ? Back in the times of VS2002 and VS2003 you could NOT do ...

How do I remove all spaces in a text string
Simply stated, how would I remove all space in a text string. Before: AA 123 ZZ After: AA123ZZ Excel 2003 Thanks, dn One way: =SUBSTITUTE(A1," ","") In article <CF88068F-D7E6-40F7-A13C-A938C7C08324@microsoft.com>, "dn" <dn@discussions.microsoft.com> wrote: > Simply stated, how would I remove all space in a text string. > > Before: AA 123 ZZ > After: AA123ZZ > > Excel 2003 > > Thanks, > dn > Or even select the range first and edit|replace what: (spacebar) with: (leave empty) replace all. dn wrot...

Conditional Formatting on an XML list
Hi folks Another Excel newbie requiring assistance with conditional formatting, I'm afraid. My problem: I've been tasked by my employer to create a Spreadsheet in MS Excel 2003 for the purpose of displaying an XML *list* which is output from one of our legacy 3GL systems. I've created the spreadsheet using the map genetrated automatically by Excel, based on the actual XML file to be imported, and I can import the data at will. No problem there (I've set the import function to overwrite all previously stored data on selecting the 'refresh all' option on the import to...

XSD/Schema: Who do I set a default for a date-type element?
If I specify a default value in an .xsd-File like this ... <xs:element name="element1" type="xs:dateTime" minOccurs="0" default="2004-02-10T00:00:00.0000000+01:00" /> .... and try to build a dataset with xsd /d Dataset.xsd, i receive an "value doesn't fit the datatype" error. I tried already formats like "2001-01-01" or "2000/01/01" with the same result. Does someone know the right format? This is my original file: <?xml version="1.0" encoding="utf-8" ?> <xs:schema id="Dataset1...

Outlook will not spell check document
when I typ a document in outlook to email and I do a spell check this message comes up "Spell & Grammer check is complete Test market with do not check spelling or grammer was skipped. " When I type an email it does not correct any misspelled words. Can you help ...

Merging Few XML
Hi, I need to merge few XML DB file in one big XML, nay easy way biside reading one by one and writing a new big one ?? Thanks, Paolol Hello! > Hi, I need to merge few XML DB file in one big XML, nay easy way biside > reading one by one and writing a new big one ?? You could use XSLT and its document()-function, maybe something like this (untested, possibly wrong) <transform xmlns="..." xmlns:o="out"> <template match="/"> <o:bigfile> <for-each select="/files/file"> <copy-of select="document(.)/ro...

Item Type Change
How can you change an item type from Miscellaneous to Sales Inventory if there is already sales order history for this item? -- Ray You can't. Not legitimately. And, with sales history, if you change it through a back door, sales history will be wrong, you will get unpredictable results from a Historical Stock Status, and loads of other possible nasty things. Create a new Sales Inventory Item. -- Richard L. Whaley Author / Consultant / MVP Documentation for Software Users For help learning and better using Dynamics GP,... check out our books at http://www.AccoladePublications....

Stocks that blend strong growth prospects with financial stability
http://wonderfulthings.blogspot.com/2004/12/stocks-that-blend-strong-growth.html http://wonderfulthings.blogspot.com/ ...

What data type is a HANDLE?
I have got some idea now of what a handle is and what it is for, but what data type is it? Is it an address, or is it a pointer (or is it something else)? The reason I need to know is this: I’ve been given a null-terminated string and I’ve been told it is a handle to a window in hexadecimal format. I need to hide that window. This is what I’ve tried so far (where splash is the buffer containing the string): CString str; str.Format("Ox%s", splash); unsigned long l = strtoul(str,NULL,16); CWnd::FromHandle(l)->ShowWindow(SW_HIDE); but there is a problem in treating the unsigned ...

Why can't I see pictures when inserted in documents in Publisher?
When I try to insert a picture into a Publisher document, or receive publisher docs with pictures in them, I don't see the pictures on the screen. They are there as the boundary box for the picture is visible, and I can actually save the picture as a file and view the jpeg. I have checked the view - picture - display options and they are set up OK i.e. view detailed image. Also send image back/forward, but still no joy. Can anyone help me here . . . please?? Help and solution here Q: Why can I not see images/shapes/lines when editing my publication? http://ed.mvps.org/Static.aspx?=P...

Defining a type or element for this element/complex data type ...
Hi <ClubNight Name = "Go club" Date = "2006-09-09"> Discussed a few simple proverbs. <Attendee Name = "RJ"/> <Attendee Name = "TT"/> <Attendee Name = "RB"/> </ClubNight> I'm trying to work out if I can actually define this as a complex type in my schema. I can do it no problems without the text 'Discussed a few simple proverbs." but no matter how I fiddle with extending a simple type and so on, I just can't get it working. Is it actually possible? Thanks for any advice. Emma <emma_middleb...

Cannot combine stock charts with other chart types in Excel 2007
I just noticed that Excel 2007 60-day trial version totally corrupted my Excel 2003 chart that combines a stock chart with line charts and X-Y charts. Then when I try to create such combined chart from scratch, I get a message saying "Some charts cannot be combined with other charts"! My department does a lot of statistical analysis, and we've been overlaying other chart types on top of stock charts since Excel 2000. Is there a way to do this in Excel 2007 or will MS add this feature as a service pack? For an example of the combined chart, see this website: http://peltier...

Purchase Orders
Since upgrading to version 8.0, we are having problems with our purchase orders. If there is only one shipping method for the PO, then the "Ship To" information does not appear. If there are multiple shipping methods, the PO "sort of" prints out OK if you select the "Print separate POS per ship to address". You get the correct totals etc. The PO seems to confuse shipping method with ship to address. This is the PO straight out of the can with no modifications. I went back to our ver 7.5 PO, but it goes awry if there are multiple ship methods on the PO...

v2003 XML Map, Enumeration to drop-down list
I have XSD files with enumerations to constrain the value of specific elements. I want to use Excel to enter data using the XSD. When I apply the XSD as an XML Map I can assign a cell to each element and create a List which will get exported as an XML document. All good so far. For the cells that are constrained, if I don't enter a proper enumerated value into a cell, when I export I get a message like this: 'element' violates enumeration constraint of 'a b c d e'. The element {URIpath}Name with value 'foo' failed to parse. If I ensure that I enter correct case-...