Repository.XFRACAS.SerializeXMLObjectToByteArray: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 22: Line 22:


== Usage Example ==
== Usage Example ==
'{{APIComment|Declare a new repository connection class.}}
{{APIPrefix|      Private WithEvents MyRepository As [[New Repository]]}}
'{{APIComment|Connect to the desired Synthesis repository.}}
{{APIPrefix|Dim}} Success {{APIPrefix|As Boolean}} = {{APIPrefix|False}}
Success = MyRepository.[[Repository.ConnectToRepository|ConnectToRepository]]("RepositoryFileNamePath")
'{{APIComment|Define an serializable XML Object.}}
{{APIPrefix|Dim}} xmlObject {{APIPrefix|As Object = {{APIPrefix|Nothing}}
{{APIComment|'populate the xmlObject with values to import}}
'{{APIComment|Define the byte array.}}
{{APIPrefix|Dim}} byteArray {{APIPrefix|As Byte() = {{APIPrefix|Nothing}}
'{{APIComment|Serialize the xmlObject into the byteArray.}}
{{APIPrefix|Dim}} SerializeSuccess {{APIPrefix|As Boolean}}
SerializeSuccess = MyRepository.SerializeXMLObjectToByteArray(byteArray, xmlObject)
=== Reformatted Usage Example ===
{{APIComment|Declare a new repository connection class.}}
{{APIComment|Declare a new repository connection class.}}
         Private WithEvents MyRepository As New Repository
         Private WithEvents MyRepository As New Repository

Revision as of 21:52, 18 October 2013


An helper function to serialize XMLs for import into XFRACAS through a byte array

Method Syntax

SerializeXMLObjectToByteArray( ByRef pData() As Byte , ByRef pObject As Object ) As Integer
Uploads an import file for processing and returns the system ID of the uploaded

Parameters

pData A defined byte array to return the

pObject An serializable XML object.

Usage Example

' Declare a new repository connection class. 
       Private WithEvents MyRepository As New Repository
' Connect to the desired Synthesis repository. 
Dim Success As Boolean = False
Success = MyRepository.ConnectToRepository("RepositoryFileNamePath")
' Define an serializable XML Object. 
Dim xmlObject {{APIPrefix|As Object = Nothing
 'populate the xmlObject with values to import 
' Define the byte array. 
Dim byteArray {{APIPrefix|As Byte() = Nothing
' Serialize the xmlObject into the byteArray. 
Dim SerializeSuccess As Boolean
SerializeSuccess = MyRepository.SerializeXMLObjectToByteArray(byteArray, xmlObject)

Reformatted Usage Example

Declare a new repository connection class.

       Private WithEvents MyRepository As New Repository

Connect to the desired Synthesis repository.

       Dim Success As Boolean = False
       Success = MyRepository.ConnectToRepository("RepositoryFileNamePath")

Define an serializable XML Object.

       Dim xmlObject As Object = Nothing
       'populate the xmlObject with values to import

Define the byte array.

       Dim byteArray As Byte() = Nothing

Serialize the xmlObject into the byteArray.

       Dim SerializeSuccess As Boolean
       SerializeSuccess = MyRepository.SerializeXMLObjectToByteArray(byteArray, xmlObject)