www.Chart4.NET | Samples

Loads data from an XML file. See example below for the desired Xml format.

Namespace:  UnifoChart.Hierarchy
Assembly:  UnifoChart.Hierarchy (in UnifoChart.Hierarchy.dll) Version: 2.6.0.0 (2.6)

Syntax

C#
public string LoadFromXmlFile(
	string FilePath
)
Visual Basic (Declaration)
Public Function LoadFromXmlFile ( _
	FilePath As String _
) As String
Visual Basic (Usage)
Dim instance As HierarchyData
Dim FilePath As String
Dim returnValue As String

returnValue = instance.LoadFromXmlFile(FilePath)
Visual C++
public:
String^ LoadFromXmlFile(
	String^ FilePath
)
J#
public String LoadFromXmlFile(
	String FilePath
)
JScript
public function LoadFromXmlFile(
	FilePath : String
) : String
JavaScript
function LoadFromXmlFile(FilePath);

Parameters

FilePath
Type: System..::.String
Filename including the path of the file, that has valid XML content. FilePath can be a full local path or a web address.

Return Value

Returns blank if succeeded, XML validation message otherwise.

Remarks

  • All the attributes in 'item' tag is optional. If you want to set a different tooltip (other than text), node value or photo index, use the following attributes:
    CopyXML
    <item text='What\nis\nhierarchy?' value='NodeH' tooltip='About' photo='0' url='#idWhat'/>
  • The 'value' attribute in tags is not mandatory. If you are to give values, ensure that the given values are unique. Otherwise the nodes cannot be identified correctly.
  • Content of any attribute other than the specified ones will be added to the text of the node.

Examples

CopyC#
//webform control
string sPath = Request.Url.GetLeftPart(UriPartial.Authority);
string sResult = HierarchyWeb1.hpcData.LoadFromXmlFile( sPath + "/sample.xml" );
//winform control
string sResult = hierarchyWin1.hpcData.LoadFromXmlFile( Application.StartupPath + "\\sample.xml");
hierarchyWin1.hpcData.ExpandAll();
hierarchyWin1.Refresh();

XML Format:
CopyXML
 <?xml version='1.0' encoding='utf-16'?>
 <chart>
   <settings PhotoPath='' PhotoSpecification='UsePhoto_ImageList4Levels' />
   <data>
     <item text='Everything is Hierarchical' url='#idEisH'>
       <item text='What is hierarchy?' url='#idWhat'>
         <item text='Structure' url='#idStruct'/>
         <item text='Organization' url='#idOrgn'/>
         <item text='Classification' url='#idClass'/>
       </item>
       <item text='Why hierarchy is important?' url='#idWhy'>
         <item text='Intention' url='#idInt'/>
         <item text='Knowledge' url='#idKnow'/>
       </item>          
       <item text='Which hierarchy matters?' url='#idWhich'>
         <item text='Stress' url='#idStress'/>
         <item text='Point of View' url='#idPOV'/>
       </item>      
       <item text='Whether level matters?' url='#idWhether'/>
       <item text='When to use?' url='#idWhen'>
         <item text='Analyse' url='#idAna'/>
         <item text='Modify' url='#idMod'/>
       </item>         
       <item text='Who to assign?' url='#idWho'>
         <item text='Sub-expert' url='#idExpert'/>
       </item>        
       <item text='How to describe?' url='#idHow'>   
         <item text='Table of Contents' url='#idTable'/>
         <item text='Hierarchy-Chart\nImpression\nBird`s-Eye View\nTotality\nAccessibilty' url='#idHC'>
           <item text='Static diagrammming /Drawing' url='#idHCs'/>
           <item text='Dynamic programming' url='#idHCd'/>           
         </item>
       </item>
       <item text='What to do?' url='#idWhatTo'/>
     </item>
   </data>
</chart>

See Also