Repository.XFRACAS.SerializeXMLObjectToByteArray: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(18 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Template:APIClass|Repository Class|Repository}}
{{DISPLAYTITLE:Repository.XFRACAS.SerializeXMLObjectToByteArray Method}}{{Template:API}}{{Template:APIBreadcrumb|.[[Repository Class|Repository]]}}
An helper function to serialize XMLs for import into XFRACAS through a byte array
== Method Syntax ==
{{APIName|'''SerializeXMLObjectToByteArray'''(}}
{{APIPrefix|ByRef}}
{{APIName|pData() }}
{{APIPrefix|As Byte}}
{{APIName|,}}
{{APIPrefix|ByRef}}
{{APIName|pObject }}
{{APIPrefix|As Object}}
{{APIName|)}}
{{APIPrefix|As Integer}}<br>
{{APIComment|Uploads an import file for processing and returns the system ID of the uploaded}}


== Parameters ==
'''pData'''
{{APIComment|A defined byte array to return the }}


'''pObject'''
<onlyinclude>Serializes the XML file for import into XFRACAS. Returns a '''Boolean''' value; when true, indicates a successful serialization.</onlyinclude>
{{APIComment|An serializable XML object.}}


== Usage Example ==
== Syntax ==
  '{{APIComment|Declare a new repository connection class.}}
  '''.XFRACAS.SerializeXMLObjectToByteArray'''(''pData()'', ''pObject'')
{{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 ===
===Parameters===
{{APIComment|Declare a new repository connection class.}}
        Private WithEvents MyRepository As New Repository


{{APIComment|Connect to the desired Synthesis repository.}}
''pData''
        Dim Success As Boolean = False
        Success = MyRepository.ConnectToRepository("RepositoryFileNamePath")


{{APIComment|Define an serializable XML Object.}}
:Required. Byte. A defined byte array.
        Dim xmlObject As Object = Nothing
        'populate the xmlObject with values to import


{{APIComment|Define the byte array.}}
''pObject''
        Dim byteArray As Byte() = Nothing


{{APIComment|Serialize the xmlObject into the byteArray.}}
:Required. A serializable XML object.
        Dim SerializeSuccess As Boolean
 
        SerializeSuccess = MyRepository.SerializeXMLObjectToByteArray(byteArray, xmlObject)
== Example ==
 
 
'''VB.NET'''
{{APIComment|'Connect to a Synthesis enterprise repository.}}
  {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
  MyRepository.ConnectToSQLRepository({{APIString|"MyServer"}}, {{APIString|"MyDatabase"}})
{{APIComment|'Define a serializable XML object and populate with values to import.}}
  {{APIPrefix|Dim}} xmlObject {{APIPrefix|As Object}} = {{APIPrefix|Nothing}}
  {{APIComment|...}}
 
{{APIComment|'Define the byte array and then serialize the object to the byte array.}}
  {{APIPrefix|Dim}} byteArray {{APIPrefix|As Byte()}} = {{APIPrefix|Nothing}}
  {{APIPrefix|Dim}} SerializeSuccess {{APIPrefix|As Boolean}}
  SerializeSuccess = MyRepository.XFRACAS.SerializeXMLObjectToByteArray(byteArray, xmlObject)
{{APIComment|'Import the XML byte array into XFRACAS entity ID# 10.}}
  {{APIPrefix|Dim}} ImportXMLSystemID {{APIPrefix|As Integer}}
  ImportXMLSystemID = MyRepository.XFRACAS.ImportXfracasXml(10, XFRACASImportType.Incident, byteArray, {{APIString|"XMLFileTitle"}}, {{APIString|"XMLFileDescription"}})
{{APIComment|'Process the imported file.}}
  MyRepository.XFRACAS.ProcessXfracasImports()

Latest revision as of 16:44, 10 March 2016

APIWiki.png


Member of: SynthesisAPI.Repository


Serializes the XML file for import into XFRACAS. Returns a Boolean value; when true, indicates a successful serialization.

Syntax

.XFRACAS.SerializeXMLObjectToByteArray(pData(), pObject)

Parameters

pData

Required. Byte. A defined byte array.

pObject

Required. A serializable XML object.

Example

VB.NET

 'Connect to a Synthesis enterprise repository. 
  Dim MyRepository As New Repository
  MyRepository.ConnectToSQLRepository("MyServer", "MyDatabase")

 'Define a serializable XML object and populate with values to import. 
  Dim xmlObject As Object = Nothing
  ... 
  
 'Define the byte array and then serialize the object to the byte array. 
  Dim byteArray As Byte() = Nothing
  Dim SerializeSuccess As Boolean
  SerializeSuccess = MyRepository.XFRACAS.SerializeXMLObjectToByteArray(byteArray, xmlObject)

 'Import the XML byte array into XFRACAS entity ID# 10. 
  Dim ImportXMLSystemID As Integer
  ImportXMLSystemID = MyRepository.XFRACAS.ImportXfracasXml(10, XFRACASImportType.Incident, byteArray, "XMLFileTitle", "XMLFileDescription")

 'Process the imported file. 
  MyRepository.XFRACAS.ProcessXfracasImports()