Repository.XFRACAS.SerializeXMLObjectToByteArray: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
{{Template:APIClass|Repository Class|Repository}}
{{Template:API}}{{Template:APIBreadcrumb|10|.[[Repository Class|Repository]]}}
A helper function to serialize XMLs for import into XFRACAS through a byte array.
 
 
<onlyinclude>Serializes an XML file for import into XFRACAS. Returns a '''Boolean''' value; when true, indicates a successful import.</onlyinclude>


== Syntax ==
== Syntax ==
*SerializeXMLObjectToByteArray( pData() {{APIPrefix|As Byte}}, pObject {{APIPrefix|As Object}}) {{APIPrefix|As Integer}}
'''XFRACAS.SerializeXMLObjectToByteArray( pData() {{APIPrefix|As Byte}}, pObject {{APIPrefix|As Object}}) {{APIPrefix|As Integer}}'''
 
===Parameters===
 
''pData'
 
:Required. Byte.
 
''pObject''
 
:Required. A serializable XML object.


Parameters
== Example ==
:''pData'': A defined byte array to return the


:''pObject'': A serializable XML object.


== Usage Example ==
  '''VB.NET'''
  '{{APIComment|Declare a new repository connection class.}}
   
  {{APIPrefix|Private WithEvents MyRepository As New [[Repository Class|Repository]]}}
  {{APIComment|'Add code to connect to the Synthesis repository.}}
  '{{APIComment|Connect to the desired Synthesis repository.}}
  {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
{{APIPrefix|Dim}} Success {{APIPrefix|As Boolean}} = {{APIPrefix|False}}
  {{APIComment|...}}
  Success = MyRepository.[[Repository.ConnectToRepository|ConnectToRepository]]("RepositoryFileNamePath")
   
  '{{APIComment|Define an serializable XML Object.}}
  {{APIComment|'Define a serializable XML object and populate with values to import.}}
{{APIPrefix|Dim}} xmlObject {{APIPrefix|As Object}}={{APIPrefix|Nothing}}
  {{APIPrefix|Dim}} xmlObject {{APIPrefix|As Object}} = {{APIPrefix|Nothing}}
{{APIComment|'populate the xmlObject with values to import}}
  {{APIComment|...}}
  '{{APIComment|Define the byte array.}}
 
{{APIPrefix|Dim}} byteArray {{APIPrefix|As Byte()}}={{APIPrefix|Nothing}}
  {{APIComment|'Define the byte array and then serialize the object to the byte array.}}
  '{{APIComment|Serialize the xmlObject into the byteArray.}}
  {{APIPrefix|Dim}} byteArray {{APIPrefix|As Byte()}} = {{APIPrefix|Nothing}}
{{APIPrefix|Dim}} SerializeSuccess {{APIPrefix|As Boolean}}
  {{APIPrefix|Dim}} SerializeSuccess {{APIPrefix|As Boolean}}
SerializeSuccess = MyRepository.XFRACAS.[[Repository.SerializeXMLObjectToByteArray|SerializeXMLObjectToByteArray]](byteArray, xmlObject)
  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()

Revision as of 17:56, 27 October 2015

APIWiki.png


Member of: SynthesisAPI10.Repository


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

Syntax

XFRACAS.SerializeXMLObjectToByteArray( pData() As Byte, pObject As Object) As Integer

Parameters

pData'

Required. Byte.

pObject

Required. A serializable XML object.

Example

VB.NET

 'Add code to connect to the Synthesis repository. 
  Dim MyRepository As New Repository
  ... 

 '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()