Программирование в IIS

Пример 1.12

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ' ChairID - read only '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Public Property Get ChairID() As String ChairID = Trim(m_sID) End Property

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'GetChairState 'serializes object state into XML DOM 'to look like this <Chair ID="" Color="" /> ' 'in: nothing 'out: returns DOMDocument30 object filled '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Public Function GetChairState() As DOMDocument30 On Error GoTo Sub_Error_Handler Const ERROR_MESSAGE_INFO = "GetChairState"


Dim xmlChair As MSXML2.DOMDocument30 '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'note : Constructing the XML using 'string concatenation and using the 'XML object to validate is another 'strategy often times used. '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

'refresh the object OpenChair Me.ChairID

'build XML document Set xmlChair = New DOMDocument30

'create the element for Chair Set xmlChair.documentElement = _ xmlChair.createElement(CHAIR_ELEMENT)

'add the Chair attributes xmlChair.documentElement.setAttribute _ (CHAIR_ID_ATTRIBUTE), ChairID xmlChair.documentElement.setAttribute (CHAIR_COLOR_ATTRIBUTE), color

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub_Exit_Done: 'return object Set GetChairState = xmlChair

On Error Resume Next 'destroy objects Set xmlChair = Nothing

Exit Function

Sub_Error_Handler: ProcessErr " Failure serializing chair into XML. "

End Function

Листинг 1.12. Function GetChairState

Закрыть окно

Содержание  Назад  Вперед