Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Class for XML

Status
Not open for further replies.

jenlion

IS-IT--Management
Nov 13, 2001
215
I need to create an XML file that looks like this:
Code:
<ShipControl>
    <CarrierIdentifier domain="SCAC">FDE</CarrierIdentifier>
</ShipControl>

I have:
Code:
Partial Public Class cXMLRequestShipNoticeRequestShipControl
    <System.Xml.Serialization.XmlElement()> _
    Public CarrierIdentifier() As cXMLRequestShipNoticeRequestShipControlCarrierIdentifier

End Class

...

Partial Public Class cXMLRequestShipNoticeRequestShipControlCarrierIdentifier
    <System.Xml.Serialization.XmlAttribute()> _
    Public domain As String
End Class

To fill it:
Code:
            Dim xcxml_Request_ShipNoticeRequest_ShipControl_CarrierIdentifier(1) As cXMLRequestShipNoticeRequestShipControlCarrierIdentifier
            Dim CarrierID As New cXMLRequestShipNoticeRequestShipControlCarrierIdentifier
            CarrierID.domain = "SCAC"
            xcxml_Request_ShipNoticeRequest_ShipControl_CarrierIdentifier(0) = CarrierID

Obviously I've left out other fields. I had an xsd converted partly to a module, but it didn't include these fields, and I'm having a hard time finding an example of how to add this one -- where there's an element with a value and an attribute.

Can someone tell me what I need to plug in so that I can set the "FDE" portion?

 
In case anyone in the future comes along looking for the answer....

The class needed to look like this:
Code:
Partial Public Class cXMLRequestShipNoticeRequestShipControlCarrierIdentifier
    Private domainfield As String
    Private valueField As String

    <System.Xml.Serialization.XmlAttributeAttribute()> _
    Public Property domain() As String
        Get
            Return Me.domainfield
        End Get
        Set(ByVal value As String)
            Me.domainfield = value
        End Set
    End Property

    '''<remarks/>
    <System.Xml.Serialization.XmlTextAttribute()> _
    Public Property Value() As String
        Get
            Return Me.valueField
        End Get
        Set(ByVal value As String)
            Me.valueField = value
        End Set
    End Property

End Class


And the code, like this:
Code:
                Dim CarrierID As New cXMLRequestShipNoticeRequestShipControlCarrierIdentifier
                CarrierID.domain = "SCAC"
                CarrierID.Value = ShipMethSCAC
                xcxml_Request_ShipNoticeRequest_ShipControl_CarrierIdentifier(0) = CarrierID
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top