Main Page | Report this Page
.NET DotNet Forum Index  »  XML Forum  »  XML Generation C# from helper class generated by XSD...
Page 1 of 1    

XML Generation C# from helper class generated by XSD...

Author Message
Thane Hubbell...
Posted: Fri Oct 30, 2009 6:21 am
Guest
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,
}
 
 
Page 1 of 1    
All times are GMT - 5 Hours
The time now is Fri Dec 11, 2009 6:45 am