Repository.XFRACAS.ImportXFRACASXML
Jump to navigation
Jump to search
Member of: SynthesisAPI10.Repository
Imports an XML byte array into a desired XFRACAS entity. Returns an Integer that represents the system ID of the byte array.
All XML files must first be in the XFRACAS XML format before they can be successfully imported. To view the XFRACAS formats, see the XFRACAS9/10 Import Business Logic (PDF) document.
Syntax
.XFRACAS.ImportXFRACASXML(entityID, importType, byteData, fileTitle, fileDescription)
Parameters
entityID
- Integer. The ID number of the XFRACAS entity to import the data into. (Required)
importType
- The type of XFRACAS element (e.g., incident, problem, etc.) to import. Can be any XFRACASImportType constant. (Required)
byteData
- Byte(). The byte array of the XML to import. (Required)
fileTitle
- String. The file title of the XML file byte array to import. (Required)
fileDescription
- String. A description of the XML to import. (Required)
Example
VB.NET 'Add code to connect to a Synthesis repository. Dim MyRepository As New Repository ... 'Get a list of XFRACAS entities in the current project in the connected repository. Dim ListOfXFRACASEntities() As NameIdPair ListOfXFRACASEntities = MyRepository.XFRACAS.GetAllXFRACASEntities() 'Search the entities list for the desired entity name, to find the Entity ID Dim DesiredEntityID As Integer For Each Entity As NameIdPair In ListOfXFRACASEntities() If Entity.Name = "DesiredEntityName" DesiredEntityID = Entity.ID Exit For End If Next 'Define a serializable XML object, and then populate it 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 MyRepository.XFRACAS.SerializeXMLObjectToByteArray(byteArray, xmlObject) 'Import the XML byte array into the desired XFRACAS entity. In this example, we assume that the XML object type describes an Incident. Dim ImportXMLSystemID As Integer ImportXMLSystemID = MyRepository.XFRACAS.ImportXFRACASXML(DesiredEntityID, XFRACASImportType.Incident, byteArray, "XMLFileTitle", "XMLFileDescription")