libxml setCompressMode() only works with backslash
BlitzMax Forums/Brucey's Modules/libxml setCompressMode() only works with backslash| 
 | ||
| Hi Brucey In Windos XP: It seems setCompressMode() only works with backslashed files, - and not when there are forward slashes in the filename: SuperStrict
Import bah.libxml
Local doc:TxmlDoc = TxmlDoc.newDoc("1.0")
If doc Then
	Local root:TxmlNode = TxmlNode.newNode("root")
	
	doc.setRootElement(root)
	doc.setCompressMode(9)
		
	Local filename:String = "C:/data/test.dat"	
		
	'filename = filename.Replace("/","\") ' uncomment this line to get compresssion
		
	doc.saveFile(filename)
End If | 
| 
 | ||
| Ok. Thanks. I suppose the module should do the conversion for you :-) | 
| 
 | ||
|  I suppose the module should do the conversion for you :-)   I think that would be the best, cause it's a subtle error, and BlitzMax tends to convert everything to forward slashes. (AppDir etc.) Once again thanks for this extremely useful module. | 
| 
 | ||
| It's in SVN now. I applied the same theory to saveFormatFile() also. Come to think of it, I wonder if it would be possible to save direct to a TStream too. That might be useful for some people. | 
| 
 | ||
| Great.  Come to think of it, I wonder if it would be possible to save direct to a TStream too. That might be useful for some people.   I would like to "intercept" what is read and written in order to decrypt/encrypt the compressed data to avoid tampering with saved games. Would that be possible? | 
| 
 | ||
| If I can get it into a TStream, then you could probably do that, yes. Whether or not I can... well... ;-) | 
| 
 | ||
| lol, No worry, I think I can do it now by using TxmlDoc.parseDoc() and TxmlDoc.ToString() zipping and encrypting myself. | 
| 
 | ||
| Okay, I've added TStream support to saveFile() and saveFormatFile(). This means you can now either pass in a String or a TStream. (The function signatures have changed, but won't require a change to your code) The only issue with TStream is you *don't* get compression, because currently Libxml itself only supports compression on files (the source is full of TODOs, so I guess they want to add that at some point). But possibly handy to someone :-) |