Please enable JavaScript to view this site.

HL7 C# Script Reference

 

In all of your C# Scripts you have access to System.Xml and can use it to create simple or complex XML documents. The COREScriptXML class is based on a class that we have used for years to provide shortcuts to read and create simple XML documents.

 

This class implements the COREException class for your convenience.

 

 

 

 

Public Properties:

 

Property Name

Data Type

DocumentValue

string - You can GET the xml string value the System.XML equivalent of Document.OuterXml. If you SET DocumentValue it is the equivalent of calling OpenFromString().

IsLoaded

bool (read only) - Will indicate whether there is currently an open XML document.

Value

string - You can GET the xml string value the System.XML equivalent of Document.DocumentElement.OuterXml. If you SET Value it is the equivalent of calling OpenFromString().

 

Public Methods:

 

Method

Return Value

Convert(DateTime value)

bool- Pass a valid DateTime in value and it creates all of the string properties and Converted will be set to true.

FormattedValue()

string- Will return the formatted (IE indented) XML string value OR an empty string if not IsLoaded.

GetAttribute

(

 XmlElement iNode,

string strAttributeName,

 string strDefaultValue = ""

)

string- Will return the value of an XML Attribute from the XMLElement iNode named strAttribute or the strDefaultValue if strAttribute does not exist.

 

NOTE: There is an override for this method and you can also call using XMLNode iNode.

GetRootChildren()

XmlNodeList - Will return a System.Xml.XmlNodeList of the document root element. Will be null if Isloaded is false OR if there are no child nodes.

GetRootElement()

XmlElement- Will return the XML document root element or null if Isloaded is false.

GetXMLDocument()

XmlDocument - Will return the System.Xml.XmlDocument. Will be null if Isloaded is false.

OpenFromFile(string fileName)

bool - Will attempt to load the XML data file in fileName. If successful will return true and Isloaded will be set to true, otherwise returns false.

OpenFromString(string value)

bool - Will attempt to load the XML document from the XML string value. If successful will return true and Isloaded will be set to true, otherwise returns false.

OpenFromSteam

(

 System.Io.Stream value

)

bool - Will attempt to load the XML document from the System.Io.Stream value. If successful will return true and Isloaded will be set to true, otherwise returns false.

Save

(

string fileName,

bool overWriteIfExists = false,

 bool formatTheXML = false

)

bool - Will attempt to save the XML document into file fileName. If the file exists it will be overwritten if overWriteIfExists is true. If formatTheXML is true then the XML string value will be formatted. Will return false if IsLoaded is false, if fileName exists and overWriteIfExists is false, or if fileName is not a valid Windows path\filename.

SetAttribute

(

 XmlElement iNode,

string strAttributeName,

 string value

)

void - Will set the value of an XML Attribute on the XMLElement iNode named strAttribute to value if strAttribute does not exist it will be created.

 

NOTE: There is an override for this method and you can also call using XMLNode iNode.

XMLAddNode

(

 XmlElement iNodeParent,

string strXMLValue

)

XmlNode- Will add a child XMLNode to iNodeParent using the string strXMLValue. You can use this method to add fully formed XML including all children etc into the XML document as a child node of iNodeParent.

 

NOTE: There is an override for this method and you can also call using XMLNode iNodeParent.

 

 

  

Keyboard Navigation

F7 for caret browsing
Hold ALT and press letter

This Info: ALT+q
Nav Header: ALT+n
Page Header: ALT+h
Topic Header: ALT+t
Topic Body: ALT+b
Exit Menu/Up: ESC