Page Index Toggle Pages: [1] 2  Send TopicPrint
Hot Topic (More than 10 Replies) XML issues (Read 7472 times)
Phil Jacques
Junior Member
**
Offline


.NET 2.0 Rocks!!!

Posts: 70
Joined: Oct 20th, 2006
XML issues
Nov 8th, 2006 at 6:47am
Print Post  
Stoyan,

I had a diagram with 200 boxes and 470 arrows. When i saved it in XML using the code in the help file, the generated XML was 800 K. Thats too huge to save in the database.

Is there any simpler and lighter format to save the flowchart in the database?

Also some of the boxes had text "O'Reilly", "D'souza" and "Smith & Berkley". Resulting XML did handle & as & , but the ' was not handled as "

Code
Select All
<Tag>DiagramComponent.InfoBox;590: 'Von President Albert D'Souza'</Tag>
AND
<Tag>DiagramComponent.InfoBox;6100: 'Marketing - Collections &amp; Payments'</Tag>
 



Any ideas on a lighter structure to save in the database?

Thanks a lot in advance  Smiley

Cheers

Phil
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: XML issues
Reply #1 - Nov 8th, 2006 at 9:12am
Print Post  
Phil,

Try the SaveToString and LoadFromString methods of the FlowChart class. They will encode the chart as an ASCII string, by representing each byte in the chart's binary stream as two hexadecimal digits. If you need even lighter structure, we can enhance SaveToString/LoadFromString so they use base64 encoding, where each 3 bytes are represented by 4 ASCII letters.

Stoyan
  
Back to top
 
IP Logged
 
Phil Jacques
Junior Member
**
Offline


.NET 2.0 Rocks!!!

Posts: 70
Joined: Oct 20th, 2006
Re: XML issues
Reply #2 - Nov 8th, 2006 at 10:54am
Print Post  
Stoyan,

i tried Save and Load from string, but the resulting file was marginally lesser than the original one. this was 630 K.

Another problem is both LoadFromFile and LoadFromXML display the diagram, but the boxes do not display labels after that.

Funny as this information is persisted in XML, and i assume it would be persisited in the string as well, but i dont know how it is not being displayed in the boxes.

Sad Oh man, i think serialization is going to be a pain it seems, or i would need to find some of my own methods for serialization.

Cheers

Phil
  
Back to top
 
IP Logged
 
Phil Jacques
Junior Member
**
Offline


.NET 2.0 Rocks!!!

Posts: 70
Joined: Oct 20th, 2006
Re: XML issues
Reply #3 - Nov 8th, 2006 at 11:15am
Print Post  
Stoyan

In addition to the above, you remember i had raised an issue about PDf export, i think the diagram is displayed in the same way as it used to get exported in a PDF without polytext setting.

Hmmm, something in the component i think. Do you need the files?

Cheers

Phil
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: XML issues
Reply #4 - Nov 8th, 2006 at 11:30am
Print Post  
How big is the binary file when you call SaveToFile? The SaveToString result should be that size x 2, and I can't believe it's almost as big as the XML file.

Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: XML issues
Reply #5 - Nov 8th, 2006 at 11:34am
Print Post  
Ok, please use SaveToFile and email me the file.

Thanks,
Stoyan
  
Back to top
 
IP Logged
 
Phil Jacques
Junior Member
**
Offline


.NET 2.0 Rocks!!!

Posts: 70
Joined: Oct 20th, 2006
Re: XML issues
Reply #6 - Nov 8th, 2006 at 12:23pm
Print Post  
Stoyan,

I did a few more save and load options for loaded diagrams, (maximum like 700 boxes and 1356 connections). The sizes are like in MegaBytes, for higher density diagrams.

Example for a small workflow - 50 boxes and 70 connections -
Binary - 277 K
Text - 553 K
XML - 398 K
JPEG - 91.4 K
PDF - 126 K

Numbers go higher for more complex diagrams.

I will send you the files.

Phil
  
Back to top
 
IP Logged
 
Phil Jacques
Junior Member
**
Offline


.NET 2.0 Rocks!!!

Posts: 70
Joined: Oct 20th, 2006
Re: XML issues
Reply #7 - Nov 8th, 2006 at 12:25pm
Print Post  
Stoyan,

Ok i solved the Diagram display error by tweaking the polytext property.

Sorry to raise that ...  Embarrassed

Phil
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: XML issues
Reply #8 - Nov 8th, 2006 at 12:27pm
Print Post  
Are there any images displayed in the boxes? - they might increase the saved diagram size a lot.

Stoyan
  
Back to top
 
IP Logged
 
Phil Jacques
Junior Member
**
Offline


.NET 2.0 Rocks!!!

Posts: 70
Joined: Oct 20th, 2006
Re: XML issues
Reply #9 - Nov 8th, 2006 at 12:31pm
Print Post  
Stoyan,

No no images in the boxes. But i am storing objects of my custom class in the tag of the box as well as arrow.

I have mailed you the files

Cheers

Phil
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: XML issues
Reply #10 - Nov 8th, 2006 at 12:35pm
Print Post  
Maybe the Tag objects take up much space when serialized - of what type are they? Tags are not serialized in XML by default, unless you handle the SerializeTag event.

Stoyan
  
Back to top
 
IP Logged
 
Phil Jacques
Junior Member
**
Offline


.NET 2.0 Rocks!!!

Posts: 70
Joined: Oct 20th, 2006
Re: XML issues
Reply #11 - Nov 8th, 2006 at 12:38pm
Print Post  
Well tag objects are simple classes which contain 2 objects and one bool in case of a connection and just one simple object with some strings and some Lists.

Do you mean that if i just make my tag as string object, it would reduce my file size?

Phil
  
Back to top
 
IP Logged
 
Phil Jacques
Junior Member
**
Offline


.NET 2.0 Rocks!!!

Posts: 70
Joined: Oct 20th, 2006
Re: XML issues
Reply #12 - Nov 8th, 2006 at 12:41pm
Print Post  
I have handled the serialize tag myself, from the code in your help file.

Code
Select All
private void SerializeTag(object sender, SerializeTagArgs e)
	{
	   object tag = null;
	   if (e.Object is MindFusion.FlowChartX.Group)
		tag = ((MindFusion.FlowChartX.Group)e.Object).Tag;
	   else
		tag = ((ChartObject)e.Object).Tag;

	   e.Representation = "";

	   if (tag != null)
	   {
		e.Representation = tag.GetType().ToString();
		e.Representation += ";";
		e.Representation += tag.ToString();
	   }
	}

	private void saveAsXMLToolStripMenuItem_Click(object sender, EventArgs e)
	{
	   XmlWriter writer = new XmlWriter(flowChart);
	   writer.SerializeTag += new SerializeTagEvent(this.SerializeTag);
	   writer.Options.WriteImages = true;
	   writer.Write(ShowSaveDialog("XML files (*.xml)|(*.*)"));
	}
 

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: XML issues
Reply #13 - Nov 8th, 2006 at 12:42pm
Print Post  
It depends on what's in the objects and what's in the lists. You might implement ISerializable in your Tag class so that you have complete control over which parts of the tag are saved when doing binary serialization.

Stoyan
  
Back to top
 
IP Logged
 
Phil Jacques
Junior Member
**
Offline


.NET 2.0 Rocks!!!

Posts: 70
Joined: Oct 20th, 2006
Re: XML issues
Reply #14 - Nov 8th, 2006 at 1:03pm
Print Post  
Stoyan,

I did some changes to the code to store pure strings in the tags.

Here are the sizes Example for a small workflow - 50 boxes and 70 connections -
Binary - 82 K
Text - 164 K
XML - 396 K (14 K Zip)
JPEG - 78.3 K
PDF - 124 K

and for 350 boxes and 1879 connections -
Binary - 1238 K
Text - 2476 K
XML - 5810 K (164 K Zip)
JPEG - 158 K
PDF - 1570 K

If you do a Zip of XML file the size reduces like anything, which gives me a hint that there are a lot of repetative structures in the XML.

I think like there should be standard properties on the top and box xml structures should have their changed properties only defined in their xml structure. This will reduce the xml sturcture, but i have doubts as to by how much.

Cheers

Phil
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint