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

Similar Articles

[PageSpeed] 11

Reply:

Similar Artilces:

Generating Multiple Choice Tests
I currently use Access 2003 to create tests. I am looking to use a grouping and random sampling method to improve efficiency. In as much that I use access to create tests now, is VBA an appropriate platform for randomizing and group sampling or should I go to an independent language. Any advice will be greatly appreciated. -- mhm karst, ******UNTESTED... Something like... SELECT TOP 1 Rnd([TestID]) AS Expr1, TestText FROM tblTests ORDER BY Rnd([TestID]) -- Gina Whipp 2010 Microsoft MVP (Access) "I feel I have been denied critical, need to know, inform...

XmlSchema classes help needed
Hi All, I am having hard time figuring out how to programmatically construct a schema with following comple type: <xs:complexType name="A"> <xs:sequence> <xs:element minOccurs="1" maxOccurs="1" name="B" type="B" /> <xs:element minOccurs="1" maxOccurs="1" name="C" type="C" /> </xs:sequence> <xs:anyAttribute> </xs:complexType> Specifically I can not find any way to insert the "XmlSchemaAnyAttribute" instance into the complex type I have. A...

random number generator
hi there i don't know if this is the right section, however I was wondering is there some vba or formulae to generate random numbers in a certain range I would be very greatful if you can help me Thanks Owen -- manclad ------------------------------------------------------------------------ manclad's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=30016 View this thread: http://www.excelforum.com/showthread.php?threadid=497074 I like J.E. McGimpsey's =RandInt(). http://www.mcgimpsey.com/excel/udfs/randint.html manclad wrote: > > hi there ...

Receipt
Does anyone know whether it's possible to use a string as part of the conditional expression ? The code I'm trying to use is : <IF> <CONDITION> Entry.Item.ItemLookupCode = "GV" </CONDITION> <THEN>"XYZ"</THEN> <ELSE>"123"</ELSE> </IF> It's working fine if I replace the "GV" with a number, but always hits the ELSE expression when it's a string. I've also tried using a string variable here, which also fails. tnx TJ Nope, no string comparisons. -- -- Glenn Adams Tiber Creek Cons...

Saving/Loading Xml to/from an Xml file
Hi I have a function called GetXml that returns Xml as expected. I then use: Dim saveFile As New SaveFileDialog and the configure saveFile. Having got the file and the Xml, how can I then write the Xml to the file? Also, how could I load the Xml back in to a string using an OpenFileDialog (openFile) or similar? Regards, Carl Gilbert "Carl Gilbert" <cnl@newsgroup.nospam> wrote in message news:OHk4WC5qEHA.628@TK2MSFTNGP09.phx.gbl... > Having got the file and the Xml, how can I then write the Xml to the file? Dim writer As System.IO.StreamWriter writer = ...

XML Security
I have posted this on ASP security to no avail. I have a web app written in c#. This app dynamically creates an Xsl doc from user defined info in the database. It also creates an instance of another c# class. This object gets passed into the Xsl doc as a parameter, and it is called from within the stylesheet to perform various functions during transformation. This object also uses some gdi32 and other unmanaged code. The I am seeing is that various exceptions (SecurityException, namely) are thrown from the component any time these methods are called. I have tried granting FullTru...

Generate URL and trigger
Let's see if I even phrase this question correctly. We use an Access DB to enter appointments for our company. There are hundreds of querys, but in reality all the information is stored in one Table. (There are other tables used for drop down info, etc.) We are going to start using a web based software that will do additional things for us. We will continue to use the Access DB. The Web software guys are telling me to have our Access DB generate a URL for each appointment entered and have it automiatically uploaded to their software using the auto generated URL. They acted...

Retrieving default values specified from XML Schema file
Hi All, I have an VS.NET 2003 app which will be processing XML files, some of which will have empty elements (for example, <Item />). I have an XSD file which should supply default values, but I am not able to read these plugged in value using an XMLDocument object. The validation is working fine--it's just not providing any default values. Has anybody tried this? Am I must be missing something? This is one of those that "should be simple..." Here's a simplifed version of the code and XML files: XmlDocument xmldoc = new XmlDocument(); XmlSchemaCollection my...

How fill Dataset from XML file?
How do I use an XML file to fill a dataset? Any code examples? XML format: <Server> <Name></Name> <Ip></Ip> <OS></OS> </Server> The XML file has 10 of these records. Thanks! I found it! http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vbcode/html/vbtskcodeexamplereadxmlintodatasetfromxmlfile.asp "VB Programmer" <growN0SPAM@go-intechN0SPAM.com> wrote in message news:%23wswLBQOEHA.3708@TK2MSFTNGP10.phx.gbl... > How do I use an XML file to fill a dataset? Any code examples? > > XML f...

Identifying all Namespace / Prefixes when reading an XML
How do I identify all of the namespace / prefix pairs associated with an XML document I am reading? Thanks for any help. Paul PaulF wrote: > How do I identify all of the namespace / prefix pairs associated with an XML > document I am reading? XPath has a namespace axis you could have your code walk. It depends on how you read your XML document, with Xml(Text)Reader you do not have XPath support. With XPathDocument or XmlDocument you do. XPath expression is //namespace::* or (with duplicates removed) //namespace::*[not(. = ../../namespace::*] Note that the prefix xml is a...

ASP.NET Caching XML
In the world of MSXML 4.0 - one of the techniques used was caching the DomDocument in the application cache with ASP. Updates made to individual nodes could occur concurrently. Is this still possible in .NET? Or is the a better design to use. Paul Jansz wrote: > In the world of MSXML 4.0 - one of the techniques used was caching the > DomDocument in the application cache with ASP. > Updates made to individual nodes could occur concurrently. > > Is this still possible in .NET? Or is the a better design to use. I believe the same goes for System.Xml.XmlDocument class of .NE...

XML
I can not locate XML on my Data menu for Excel. I checked to see if it was an add-on but it's not. You don't say which version and edition of Excel you are running. From Excel 2003 help. Note XML features, except for saving files in the XML Spreadsheet format, are available only in Microsoft Office Professional Edition 2003 and Microsoft Office Excel 2003. Excel 2007 has XML support also. Gord Dibben MS Excel MVP On Tue, 24 Jul 2007 10:08:03 -0700, emi <emi@discussions.microsoft.com> wrote: >I can not locate XML on my Data menu for Excel. I checked to see if it wa...

Error message: c:\windows\system32\avgxch32.dll
I am running Cloudmark's Spamnet within Outlook 2002. When I try to delete a large number of emails from the Spam folder (choosing Edit/Select All/Delete) I get the following error message: "c:\windows\system32\avgxch32.dll could not be installed or loaded. This problem may be resolved by using Detect and Repair on the Help menu. Out of memory or system resources. Close some windows or programs and try again." a. Even if no other programs are open, the problem still occurs. b. Running Detect and Repair makes no difference. c. Worst of all, I cannot close the error window. Wh...

Generate current month
=SUMPRODUCT((TEXT(A6:A500,"mmm")="jul")*1) is what I was given to get referrals in a current month. I'm setting up a general program so that it is easy to use for my co-workers and supervisors. Is there a way to insert something for "jul" that will enter the current month on its own? Hi try =SUMPRODUCT((TEXT(A6:A500,"mmm")=TEXT(TODAY(),"mmm"))*1) Though I would use: =SUMPRODUCT(--(MONTH(A6:A500)=MONTH(TODAY()),--(A6:A500<>"")) -- Regards Frank Kabel Frankfurt, Germany Brandy wrote: > =SUMPRODUCT((TEXT(A6:...

How to generate different series of document nos for different users..
We would like GP 8.0 to auto-generate different document numbers for each user. For example: User A will be assigned INV document numbers 1-100 and User B will assigned INV document numbers 101-200 and so on. Is that possible in GP 8.0? If so, how do I go about it? Any ideas? Thanks very much in advance for you help. -Surendra It would have to be a customized solution. VBA or Dexterity are your best bets, for now. With GP 9 you will be able to use Visual Studio 2005 to create customizations, too. "Surendra" wrote: > We would like GP 8.0 to auto-generate different do...

generate .NET code from visio 2003
Hi ! How can i Generate .NET code from a UML made in visio 2003 ? I did searh the net and found this link but it says 404 ? http://msdnaa.net/Resources/Display.aspx?ResID=1949 the article title is Generating .NET Code Using Visio Enterprise Architect's UML So any one know how do that or any one have back up copy of this article Thanks which version of v2003 are you using. The EA version which comes with vs.net I believe has the process in the help facility. v2003 pro does not support forward engineering of uml... Al "Suhail Kaleem" <suhailkaleem@mailyoulike.com>...

How to view a complete schema when using schema includes/imports?
I've got a parent schema file that references complex element types that are defined in several "child" schema files and I used the schema imports statement to include them into the parent schema's default namespace. I would like to generate a complete/single-file instance of the schema to simplify things but I can't figure out how to do it. Each schema seems to live in it's respective memory space inside the SchemaIncludesCollection. Any idea how I could traverse all of the "virtual" nodes in the parent schema to create a physical representation of what t...

EFT Generation Locking Up
We occasionally are having problems with our EFT File Generation locking up. It basically generates part of the file and then dies. The problem is that Great Plains thinks the file was successfully generated and won't allow us to create it again. The batch does not show up in the File Generation List. We have been testing on our development server with changing the ME234602 and ME234603 tables to try and allow us to rerun the EFT File Generation but nothing seems to work. Does anyone know what table we need to modify to be able to rerun an EFT File Generation? I found a Knowl...

schema-root public folder
I am looking at dismounting and at some time removing Public Folder stores from my front end Exchange servers, as from what I've read public folder stores should never have been created on my Front End server. We don't have any user public folders on the front end servers, I'm not entirely sure why public folders were ever created on them. What I do have is 2 copies of schema-root one on each of 2 front end servers (not replicas of each other) There are no replicas of this folder on any Back End servers. There are however replicas of subfolders to schema-root such as 'M...

How to set custom class name for MFC frame window?
When you create a frame window in MFC using following code: BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CMDIFrameWnd::PreCreateWindow(cs) ) return FALSE; // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs cs.lpszClass = AfxRegisterWndClass(0); return TRUE; } In Spy++, the default frame name is Afx:00400000:0. How can I set custom name instead of the default name? Thanks. Michael On Wed, 16 Nov 2005 14:49:47 -0800, "Michael" <Michael@discussions.microsoft.com> wrote: >When you create a frame window in MFC usi...

Extending XmlDocument and associated classes to provide character positions.
OK here's is what I wish to do. I have an XML file that I want to read into an XmlDocument. I then want to be able to interrogate the XmlNodes to find both their start AND end character positions within the original file. So e.g. <tagA><tagB>sometext</tagB></tagA> ^ ^ ^ ^ ^ ^ 0 6 12 19 26 33 tagA: start=0, end=33 tagB: start=6, end=26 sometext: start=12, end=19 I have seen the LineInfo example within the .net docs, see: "Extending the DOM" ms-help://MS.VSCC/MS.MSDNVS/cpguide/html/cpconextendingdom.htm and ...

How can I show some of the attributes of a UML Class Diagram?
I have a huge class with a lot of attributes and operations. I plan on using multiple drawings to illustrate different parts of each class, but I do not know how to show some, but not all, of the attributes ( and operations). "noodle-head" <noodle-head@discussions.microsoft.com> wrote in message news:AD0CEB3D-7370-444D-867E-5F65FB1DE26D@microsoft.com... >I have a huge class with a lot of attributes and operations. I plan on >using > multiple drawings to illustrate different parts of each class, but I do > not > know how to show some, but not all, of the...

xml within xml?
Hi all, I wish to embed an xml document within an element of another xml document. If I enclose the child xml within a CDATA section will the DOM not parse the child xml? What is the best way to do this? Additionally what should the parent element be defined as in the xsd? I noticed xs:anytype throws an error when validating the final xml doc. TIA, RP RP wrote: > Hi all, I wish to embed an xml document within an element of another xml > document. If I enclose the child xml within a CDATA section will the DOM not > parse the child xml? What is the best way to do this? Additionally...

Has ANYONE found a cure for the C++ Runtime Error?
It is very apparent that many of us our having this problem. Has anyone found a solution? Hi Brian, maybe here http://home.arcor.de/andreas.roeder-privat/English%20Help.htm#55 -- Ich habe nichts gemacht, gestern gings noch Bravestar2004@Arcor.de Join me in my Forum @ http://mitglied.lycos.de/bravestar2004 "Brian Harclerode" <BrianHarclerode@discussions.microsoft.com> schrieb im Newsbeitrag news:06CB01A9-BC91-4332-9DF6-B69AA377357A@microsoft.com... > It is very apparent that many of us our having this problem. Has anyone > found a solution? ...

Do I have to extend the schema?
Hi all, We have windows 2003 forest functional level and exchange 2003 servers. I need to install exchange 2007 management tools. Do I have to extend the schema in the current windows 2003 & exchange 2003 envir.? Thank you. On Wed, 23 Jun 2010 12:51:54 -0700, ed <ed@discussions.microsoft.com> wrote: >Hi all, > >We have windows 2003 forest functional level and exchange 2003 servers. >I need to install exchange 2007 management tools. Do I have to extend the >schema in the current windows 2003 & exchange 2003 envir.? Yes. --- Rich Matheisen ...