XML Generation C# from helper class generated by XSD from a schema

I am working on creating XML from a very complex schema with multiple
complex types.  I've gotten through all the problems so far but this
one has me stymied.  It is probably simple to resolve.

The helper class is below - my code attempt is here.  At runtime I get
an exception also noted below.  The question - how to I use the helper
class to get the result also pasted below.

The result desired:

            <Identification>
               <NCPDPID>9900009</NCPDPID>
            </Identification>

The code attempt:

            rq.Pharmacy.Identification = new PharmacyIDType();
            rq.Pharmacy.Identification.Items[0] = "NCPDPID";
            ID.ItemsElementName[0] = ItemsChoiceType.NCPDPID;


Helper Class:

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd",
"2.0.50727.1432")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://
www.xxx.com/messaging")]
public partial class PharmacyIDType {

    private string[] itemsField;

    private ItemsChoiceType[] itemsElementNameField;

    /// <remarks/>
    [System.Xml.Serialization.XmlElementAttribute("BINLocationNumber",
typeof(string))]
    [System.Xml.Serialization.XmlElementAttribute("DEANumber", typeof
(string))]
    [System.Xml.Serialization.XmlElementAttribute("FileID", typeof
(string))]
    [System.Xml.Serialization.XmlElementAttribute("HIN", typeof
(string))]
    [System.Xml.Serialization.XmlElementAttribute("MedicaidNumber",
typeof(string))]
    [System.Xml.Serialization.XmlElementAttribute("MedicareNumber",
typeof(string))]
    [System.Xml.Serialization.XmlElementAttribute("NAICCode", typeof
(string))]
    [System.Xml.Serialization.XmlElementAttribute("NCPDPID", typeof
(string))]
    [System.Xml.Serialization.XmlElementAttribute("NPI", typeof
(string))]
    [System.Xml.Serialization.XmlElementAttribute("PPONumber", typeof
(string))]
    [System.Xml.Serialization.XmlElementAttribute("PayerID", typeof
(string))]
    [System.Xml.Serialization.XmlElementAttribute
("PriorAuthorization", typeof(string))]
    [System.Xml.Serialization.XmlElementAttribute("PromotionNumber",
typeof(string))]
    [System.Xml.Serialization.XmlElementAttribute("SecondaryCoverage",
typeof(string))]
    [System.Xml.Serialization.XmlElementAttribute("SocialSecurity",
typeof(string))]
    [System.Xml.Serialization.XmlElementAttribute
("StateLicenseNumber", typeof(string))]
    [System.Xml.Serialization.XmlChoiceIdentifierAttribute
("ItemsElementName")]
    public string[] Items {
        get {
            return this.itemsField;
        }
        set {
            this.itemsField = value;
        }
    }

    /// <remarks/>
    [System.Xml.Serialization.XmlElementAttribute("ItemsElementName")]
    [System.Xml.Serialization.XmlIgnoreAttribute()]
    public ItemsChoiceType[] ItemsElementName {
        get {
            return this.itemsElementNameField;
        }
        set {
            this.itemsElementNameField = value;
        }
    }
}

// items choice type:

[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd",
"2.0.50727.1432")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://
www.surescripts.com/messaging", IncludeInSchema=false)]
public enum ItemsChoiceType {

    /// <remarks/>
    BINLocationNumber,

    /// <remarks/>
    DEANumber,

    /// <remarks/>
    FileID,

    /// <remarks/>
    HIN,

    /// <remarks/>
    MedicaidNumber,

    /// <remarks/>
    MedicareNumber,

    /// <remarks/>
    NAICCode,

    /// <remarks/>
    NCPDPID,

    /// <remarks/>
    NPI,

    /// <remarks/>
    PPONumber,

    /// <remarks/>
    PayerID,

    /// <remarks/>
    PriorAuthorization,

    /// <remarks/>
    PromotionNumber,

    /// <remarks/>
    SecondaryCoverage,

    /// <remarks/>
    SocialSecurity,

    /// <remarks/>
    StateLicenseNumber,
}

0
10/30/2009 4:21:37 PM
dotnet.xml 7266 articles. 0 followers. Follow

0 Replies
894 Views

Similar Articles

[PageSpeed] 6

Reply:

Similar Artilces:

Message class changes
Using OL2002 I made a custom contact form called IPM.Contact.MyForm. I changed the message class of all the existing items in my folder, which is a sub-folder of the main Contacts folder, by using the omsgclas.doc macro that I found on slipstick.com. I also made "MyForm" the default form for that folder in its Properties. I view my items in this folder in a modified "Phone List" view and they are grouped by a custom field called "Frequency." When I need to change the value in the "Frequency" field, I've found that I can simply highlight the item ro...

Generate XSD from class
Hi, Is there a way to generate an XSD from a class programmatically, so without using xsd.exe? Thanks, B. xsd.exe uses a number of classes that are documented "for internal use only" in the Framework SDK documentation. You can use ILDASM or check in Rotor to see which ones they are. Alternatively you can program against the XSD inference assembly from [0] -- HTH Christoph Schittko [MVP] Software Architect, .NET Mentor [0] http://apps.gotdotnet.com/xmltools/xsdinference/ "Bert" <no@thanks.com> wrote in message news:Xns9458A5C4F6FB2nothankscom@195.130.132.70....

XML Header
Hi, I have some XML doc loaded in a C# Web Service. XmlDocument doc = new XmlDocument(); doc.LoadXml(myDoc); Code Missing to manipulate header (I would like to replace or manupulate all these XXXXX): <mso-XXXXXX productversion="XXXXXX"> <mso-application progid="XXXXX"?> doc.Save(myNewDoc); Any idea on how to access and manipulate data within the doc header? Thanks vbdev vb6dev2003 wrote: > I have some XML doc loaded in a C# Web Service. > XmlDocument doc = new XmlDocument(); > doc.LoadXml(myDoc); > > Code Missing to manipulate header ...

aliases generate error -10660
I just installed Office 2004 on a new iMac running OS 10.3.6 If the office application is not running and I double-click on an office document, I get the error message The operation could not be completed. An unexpected error occurered (error code -10660). If I have the application running and double click on a document it opens fine. Double clicking documents from other applications properly opens the application. I've uninstalled & reintstalled and problem still exists. Suggestions? Thanks, David In article <a5608d5.0412021043.5032a4d4@posting.google.com>, david@teton1....

Read XHTML into XML
Hi all, I need to read/parse XHTML aspx pages and look for certain tokens and content. How can I use a XmlTextReader for this? If not, any other ideas? Thanks in advance, JA Reyes. Jose Antonio Reyes wrote: > I need to read/parse XHTML aspx pages and look for certain tokens and > content. How can I use a XmlTextReader for this? If not, any other ideas? If the pages are well-formed XHTML then it is possible to use XmlReader (in .NET 2.0/3.0) or XmlTextReader (in .NET 1.x) to parse the XHTML documents. You can also use the other XML APIs .NET provides so using XPathNavigator and/o...

How to invoke the xml editor?
I installed vs2005 on a new xp pro machine, and installed everything except C++. When I click on a file with a ".xml" extension it is opened with IE. When I click file/Edit with XML Editor, it opens it with Notepad. If I click File/Open With and select XML Editor, it opens it with IE. So, where is the xml editor? Can it be invoked from withing VS? Where? Bill * billsahiker@yahoo.com wrote in microsoft.public.dotnet.xml: >I installed vs2005 on a new xp pro machine, and installed everything >except C++. When I click on a file with a ".xml" extension it is >opened ...

show XML schema and values
I have an XML document that looks like the following: <record> <Field1>value1</Field1> <Field2>value2</Field2> <Field3>value3</Field3> </record> What I'm aiming to do is to show the data in a report as in the following example: record: Field1 value1 Field2 value2 Field3 value3 The "Field1-3"-elements can have any name, so I'm trying to get a table that has in one result column the element name, and in the second colum...

Offline synch using XML web-services
This is a bit long-winded. Can somebody read thru these 2 use cases, and tell me if it is feasible ? :- Use Case : Replication before Offline Synch Scenario 1 : Oracle Server , MSDE client 1. User clicks on 'Go Offline'. System creates a MSDE SQL database in laptop (client), gets the schemas of the tables in Oracle, creates corresponding tables in client's MSDE SQL (mapping Oracle datatypes to SQL datatypes). 2. Offline replication program reads in the tables of the server into a typed datasets, converts the typed datasets into XML, and stores the XML in the client. (XML serial...

XML Serialization ... how to truncate <?xml...
While xml serializing object how can I truncate <?xml ...?> this line alone? I need to send the serialized xml data to a web method ... since SOAP already have <?xml tag there was some confusion Any help would be greatly appreciated Thank you Regards Raj Raj wrote: > While xml serializing object how can I truncate <?xml ...?> this line alone? Serialize to an XmlWriter created with XmlWriterSettings where you set OmitXmlDeclaration to true. -- Martin Honnen --- MVP XML http://msmvps.com/blogs/martin_honnen/ ...

error adding new Schema Field 04-21-04
Hi, When I attempt to add a new schema field to the "Lead" object in the Deployment Manager, I get the following error: "An error occured during the addtion of the new field. The addition failed." In the event log, I there are two relevant entries: "dmLog: Failed to add new Picklist attribute (CFPsolution) to Lead entity" and "dmLog: sp_repladdcolumn failed. - Timeout expired" I've previously successfully added a pickup list called "Sector" with 9 values. Therefore I don't think I've exceeded the 8000 char row limit. Apart from...

String to xml document
Hi there, I was hoping someone can help me with a little problem I can't seem to find any answers to. I've got a form wich will be posted. On receiving the post I would like to parse a formvar to a xml document. The contents of this formvar (string) will be a valid xhtml document. Can someone give me a startertip (or more :-)) on how to achieve this? tnx in advance, James van der Veen Sjeems wrote: > I was hoping someone can help me with a little problem I can't seem to find > any answers to. > > I've got a form wich will be posted. On receiving the p...

Beginner of XML
I am a beginner of XML. I want to group some files together with a xml file. (it includes a text file, and an image file and a video file) Can someone show me some guidelines? Please help. ...

Usage example for BigInteger and C++
One of the new additions to the .NET 4.0 framework is System.Numerics.BigInteger. Please can someone give a simple usage example? Thank you. "GeorgCantor" <GeorgCantor@discussions.microsoft.com> wrote in message news:5D42AABF-96E2-4E95-A537-3739C677C438@microsoft.com... > Please can someone give a simple usage example? http://tinyurl.com/yf4qpzl -- Mark Rae ASP.NET MVP http://www.markrae.net GeorgCantor schrieb: > One of the new additions to the .NET 4.0 framework is > System.Numerics.BigInteger. > > Please can someone give ...

Valid xml to read from an xml file?
I'm using vb.net, i get an error at the reader line saying the remote server can't be found. Is the below even valid? dim reader as XmlTextReader reader = new XmlTextReader ("http://www.mysite.com/my.xml") do while (reader.Read()) 'do some action here response.write(reader) loop thanx chumley XmlTextReader uses System.Net.WebRequest under the covers -- see if you can figure out how to create a connection that way. Usually there's some proxy server information missing that you can enable if you use WebRequest directly, and then pass the result of GetResponse()...

Example eConnect XML documents
MSDN says the following: Installing eConnect schema When you include the schemas component of the eConnect install, the installer places schema files in a schemas folder on your computer. The following schema resources are available: The install places the .xsd schema files in the directory c:\Program Files\Microsoft Great Plains\eConnect9\XML Schema\Incoming XSD Individual Schemas. The files in the directory contain the schema for each eConnect XML document. The install places a file named eConnect.xsd that contains the schema definition for all eConnect XML documents. The install typicall...

adding class to MFC wizard
Hello, When you create a MFC application with the wizard in VS.Net, at the end you can select what particular kind of view class you want to inherit from. I would like to be able to select my own special view class I have made. How can I add it to the list so the wizard will show it up? ...

Remove class style from CDialog
Hi, I need to remove the style CS_SAVEBITS from my dialogs. I tried to do it in CMyDialog::PreCreateWindow, but this method is not called in dialogs. Where can I remove this style from my dialogs ? Yoav. Could you use the same technique as used here from OnInitDialog()? http://www.codeguru.com/cpp/w-d/doc_view/viewmanagement/article.php/c3267/ Tom "Yoavo" <yoav@cimatron.co.il> wrote in message news:us9qnEnyGHA.4232@TK2MSFTNGP04.phx.gbl... > Hi, > I need to remove the style CS_SAVEBITS from my dialogs. > I tried to do it in CMyDialog::PreCreateWindow, but this...

Saving DataSet as XML in ADO format using VB.NET
Hi, I am trying to convert a lot of web reports from ASP/VB to ASP.NET/VB.NET. I would like to save my dataset in XML and then use XSLT to transform the XML. The catch is I would like to have the XML in the format that ADO uses versus the default format in which ADO.NET uses. Currently, I am using ADO within .NET, but I am concerned about the performance and it might improve if I used the native data providers for .NET. I am not sure if I am missing something but how do I save the .NET DataSet to XML in the OLD ADO format? Thanks for you help in advance and it is most appreciated. In the ...

XML variable for description on receipt?
Hi, I would like to add a description (actually all of those 3 extended descriptions) to display on the printed receipt under the main description. What is the variable to do that? Entry.Item.Description Entry.Item.ExtendedDescription Entry.Item.SubDescription1 Entry.Item.SubDescription2 Entry.Item.SubDescription3 R. "Zorian" <Zorian@discussions.microsoft.com> wrote in message news:F4425EAC-62B6-46FE-826A-D8BA2AA75DBB@microsoft.com... > Hi, I would like to add a description (actually all of those 3 extended > descriptions) to display on the printed receipt un...

Notes Schema Name
Hi all, Can anyone please tell me what is the notes schema name and whether or not I can apply a java script on it - in the onload or onsave options in the form. Tnx alot.. Hi, The schema name is Annotation. However it is not possible to customize the onload/onsave event the way you can do it with the other entities. However a callout is supported. You can write code for Create, Update, Delete and Assign. Hope this helps, Merijn van Mourik http://crmerijn.blogspot.com "Guy Shokrani" wrote: > Hi all, > > Can anyone please tell me what is the notes schema name a...

How can I generate a letter from an Outlook 2003 appointment scree
I many times have to send confirmations of appointments by snail mail. Is there a way to automate this process, by having the persons name and address automatically entered on a letter format? Can this interface with WORD? ...

xml to SQL
Hey we have a project in which a company produces a XML page in reply to actions on it's site. I see that SQL 2000 works well with XML so Can someone point me in the right direction, I would like to take the XML from thier SQL and have it "post" to own sql server (add,create, data, modifity and delete data on the fly). I was looking at doing XML to HTML and then passing to some a ASP but if we can grab from the responsetext then we could save time and headaches. Now I really know next to nothing about XML but I am reading all the newsgroups and pulled now TONS of xml / sql stuff ...

Cannot find mfcs42d.pdb for C++ 6.0 on Windows XP at runtime
I'm getting Find Symbols pop-up window while running C++ 6.0 saying "Please enter the path for mfcs42d.pdb". After I specify the file location at VC98\MFC\Lib (1,092 KB from 7/15/2000), I'm getting a note that the file is found but is not the correct one. I didn't have this problem working on Windows NT. Now I'm trying to run the recompiled version of the same code on Windows XP. Service pack 5 is installed. Please advise what to do. Thanks. ...

Need the top secret list of device setup classes included in Logo
Hi, The WDK doc has many pages, which have statements like that: "if the setup class of the INF is eligible for WHQL testing" or "If the device setup class of a driver package is included in the Windows Logo" or "If your driver's device setup class is included in the Windows Logo Program" or "if the Windows Logo Program has a test program for the device setup class" but none of these pages include the list of setup classes or a URL to that list. Usually they just refer to the top of Logo program http://www.microsoft.com/whdc/winlogo...

new xml file is larger than the original
i'm working on a windows application that will edit and create xml files from another application. the original file is 83k, the one created by my vb.net program is 153k but all i add is a new xmlelement when i use the other program and add a xmlelement is only increased the file to 85k. how come my application increased 70k in size and also added the <?xml version="1.0"?> when i didn't tell it to. how do i duplicated a xml file and only add the xml element that i want to insert. where did the extra 70k come from. thanks here is my code: Dim newEvtEnr...