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
1999 Views

Similar Articles

[PageSpeed] 41

Reply:

Similar Artilces:

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 ...

Problem opening an XML file in Excel
I have Excel Professional 2003 (11.6113.5703) which has an XML conversion function but am not able to successfully open an XML document. I am working on a source file which was sucessfully opened by another part who also has Excel professional 2003. We both went through the same process, but she did not get the "Microsoft Office encountered errors when importing the following files" but I did. Her Excel file formats correctly using the XML tags as column headers, my file does not. Here is how I opened the file: >Opened as XML list, OK. Then a message, "The specified...

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...

generate WM_MOUSEMOVE msg on controls in Dialog box application
Hi guys, can you please tell me how WM_MOUSEMOVE message will fire when we move the cursor on common controls in Dialog based Application. actually this message is generate when we move mouse on non-control area i mean where control does not lie and when we move the mouse on control then this message does not fire. i am waiting for your reply. thanks <raghunandan_1081@yahoo.com> wrote in message news:1152106435.262003.84490@a14g2000cwb.googlegroups.com... > Hi guys, can you please tell me how WM_MOUSEMOVE message will fire when > we move the cursor on common controls in Dialog b...

Close Generated Campaign Activities
Hi Found quite a few posts about this in one form or another but no real answer so I wondered if anyone had got round it yet. Our Marketing Manager created a direct mailing campaign and generated 3000 letters to mail out. Great - all done and dusted, the mailers have gone out and we have a nice activity for each Account. He is now left with 3000 open letter activites assigned to him that clog up his workplace. The only answer that I have seen to rectify this is to either to do a save as completed 3000 times or delete them (not very good if you want to see who has been sent what!!) ...

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 ...

Problem Generating PO Number
Hi, Were having a problem generating a PO number. Whenever we create and click OK to the PO (Or transfer) it tells us the order requires that a PO Number be inserted - would I like to create one. If you say yes it generates 10000000 everytime and doesn't allow us to save that purchase order as the number. It is obviously struggling to calculate what the next order number is. Why is that? How does it calculate the PO Number and what may cause it to do this? Thanks, Matt ...

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...

Free map XML web service?
I want to create an XML web service that allows a user to enter two U.S. addresses, and be able to obtain step-by-step driving directions. At first I was hoping that Yahoo or Mapquest would have a web-based API that I can use, but I can't find any APIs for them. PLEASE let me know if they (or any other map sites) have these APIs. So my second alternative is to find a free XML web service somewhere out there that can provide more or less the same functionality. That way, I can still create my custion XML web service, and have it call the 3rd party web service to do the job. Microsoft&...

How to initialize a class member array.
I have an array, which is a class member define in header file. Since I can't initalize it in header file when I define it, how can I initialize it in constructor, like this Array[8][8] = {1, 2, ....}; Thanks. S.Yang wrote: >I have an array, which is a class member define in header file. Since I >can't initalize it in header file when I define it, how can I initialize >it in constructor, like this >Array[8][8] = {1, 2, ....}; You can't. There's no array initialization syntax that can be used in a ctor to initialize array members. You'll have to initialize...

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/ ...

Which GP feature can generate EFT text file (Payable cheque)
We need to generate text file be sent to bank for cheque printing & sending cheque to customer. I am using GP 10, but i do not find the window that can generate EFT text-formatted output file. and I expect it in (Tools>>Setup>Purchasing>EFT Payables Setup>EFT file> generation). However, my current GP 10 do not have this window for me to prepare data for generate the text file. Please advise. Thank you. EFT for Payables Management. Best regards, -- MG.- Mariano Gomez, MIS, MCP, PMP Maximum Global Business, LLC http://www.maximumglobalbusiness.com The...

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. ...

Classes gone from class list
Why might some of my classes dissappear from the Class View in VS2005? I am also getting error 2079 for some classes that were fine half an hour ago and still exist in the Class View window. The header and cpp files for the missing and broken classes are included in my project. Everything was fine until about half an hour ago - I added 1 pure virtual operation to a base class and a concrete method to 9 subclasses, (I think this is irrelevant!) and half of the classes are now missing and I can't use the others. The method was called SortList() and calls a list sort operation specifi...

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()...

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 ...

Missing Events in Properties Window C++ MFC
I'm trying to create a win app using Visual Studio 2005 but when I set up an MFC project and drop objects on a form, I cannot see any events in the property window. Any ideas why? Am I expecting too much? ...

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 ...

can i use excel to generate web links
Hi, I work for a charity - we're going through our donors at the moment and have to search for each one individually in the charity commision website. I was wondering if there's a way of using excel, which already has our data in, to generate urls linking to the above site's (or any) search engine incorporating the contents of a cell. ie: i'm searching for dog the search page url is www.search.com/search=?? and want to genenerate www.search.com/search=dog I want to generate one of each of these for each donor any thoughts would be greatly appreciated thanks simon Maybe yo...

2007 Schema Prep #2
I extended my AD last night for 2007 and have a few questions to verify it was successful: I have a root domain (domain.local) that houses my schema master and a child domain (domain.net) that has Exchange 2003. I ran setup /prepareAD then ran setup /preparedomain: domain.net and both said they completed successfully. However, I was expecting to see the new OU (Microsoft Exchange Security Groups) in my child domain. It is present in my root domain. Is that all correct? In my child domain I now have a new global security group call Exchange Install Domain Servers. Last thing, the D...

XML edit
How do I edit EML ,as in the Z report? -- billr Save a copy. Then open a copy in notebook and edit away. -- Elizabeth M. "billr3" <billr3@discussions.microsoft.com> wrote in message news:4FB551D6-6B5F-4CF4-BB83-40CEA229D5F7@microsoft.com... > How do I edit EML ,as in the Z report? > -- > billr Bill, I think Elizabeth _really_ meant notepad! ;-) -- * Get Secure! - www.microsoft.com/security You must be using Outlook Express or some other type of newsgroup reader to see and download the file attachment. If you are not using a reader, follow the link below...

Programticaly Manipulate XSD?
I would like to write a C# program to read in a .xsd document, traverse it's nodes, and write out a new, modified xsd. I can't seem to find any .Net methods that allow me to traverse the XSD. Suggestions? -- Bill Hertzing Tools Development TeaLeaf Technology, Inc. Apologies - I found a post with a great example, later in this newsgroup. -- Bill Hertzing Tools Development TeaLeaf Technology, Inc. "Bill Hertzing" wrote: > I would like to write a C# program to read in a .xsd document, traverse it's > nodes, and write out a new, modified xsd. I can't seem ...

CComQIPtr and XML question
Hi all! On VC6 this code worked perfectly: MSXML::IXMLDOMDocumentPtr CXMLDocItem::GetXMLNode() { CComQIPtr<MSXML::IXMLDOMDocument> docPtr = CXMLItem::GetXMLNode(); return docPtr; } It is a part of Expat XML wrapping library. But, on VS2008 it gives me the following error: error C2664: '_com_ptr_t<_IIID>::_com_ptr_t(int)' : cannot convert parameter 1 from 'ATL::CComQIPtr<T>' to 'int' 1> with 1> [ 1> _IIID=_com_IIID<MSXML::IXMLDOMDocument,& _GUID_2933bf81_7b36_11d2_b20e_00c04f983e60> ...