File Formats |
Tue, 17 June 2003 14:20 |
|
LEit | | Lt. Commander | Messages: 879
Registered: April 2003 Location: CT | |
|
Does anyone have thoughts on file formats for .x, .m, rules files, and other files needed.
I'm leaning toward XML, but I don't know the details of XML, help would be appreciated.
Encryption will be needed, but I'm going to skip that for now.
- LEitReport message to a moderator
|
|
|
|
|
Re: File Formats |
Wed, 18 June 2003 18:25 |
|
|
If hosts are willing to go to the effort of altering code then yes, it is impossible...protecting against non-editors is relatively simple with public+private key pair encryption.
Report message to a moderator
|
|
|
Re: File Formats |
Wed, 18 June 2003 20:56 |
|
John Marasco | | Crewman 3rd Class | Messages: 5
Registered: June 2003 | |
|
TinyXML is more than just a parser it's a DOM (Document Object Model). I've never used it but I read the documentation and it might be nice depending on where you want to go. TinyXML will read XML and verify that it is legitimate (parse) then put it into a hierarchical element/attribute/text object structure for code access (DOM). The limitation of tinyXML is that it only verifies that you have valid XML, not that the XML is in the right structure for your code. For that you need a parser that will validate the XML against a DTD (the DTD is being replaced by the Schema) for your application. TinyXML would be helpful but in a limited way.
For example
<ship_design type="destroyer" name="flee" armor="200">
<capability type="armor" value="100"/>
<capability type="shield" value="100"/>
<ship_design type="frigate" name="bite" armor="45">
<capability type="shield" value="100"/>
</ship_design >
</ship_design >
tinyXML would tell you this XML is fine and stick it into a DOM for your code to read. Your code would probably choke when trying to transfer the data from the DOM to your class structure because a ship_design class wouldn't be contained within another ship_design class.
If you are working in Windows (for some reason this isn't in the FAQ) then you can use the Microsoft DOM classes stored in msxml3.dll (msxml.dll is ver 2.0 and IIRC there are at least 2.6 and 2.7 versions out there as well). This will parse the code against a DTD/Schema and the dll loads with Explorer. I doubt there is a Windows box out there without some version of the Microsoft DOM.
If you are going to use a DOM then it is likely you will output the XML from a DOM and then read it back into a DOM. As such then XML parsing issues will not be as prevalent as DTD/Schema parsing issues. Of course, if you were going to build a lot of XML by hand (as you might given the need to test just the host portion of the system) then having just the XML parser (tinyXML) would be helpful.
Personally, I've worked with several commercial parsers (Omnimark and FastTag) and the MS DOM. None of these offer a nice GUI interface for just checking the validity of an XML file. This is a functionality that I never saw in a product but would have been helpful. With the products we are talking about you have to run code to check if the XML parses. I didn't find any major flaws in the MS DOM. I used it to parse XML within VB COM components and ASP pages on the server and within javascript on the client.
Another way to use XML is to skip the parser and insert XML parsing functionality into your classes. Using the tinyXML source you could hack their document and element class and then subclass your classes from the hack. This might be above and beyond what you are trying to do but it would allow for a nice sort of encapsulated read/write functionality.
--John
[Updated on: Wed, 18 June 2003 21:02] Report message to a moderator
|
|
|
|
Re: File Formats |
Fri, 20 June 2003 00:29 |
|
|
Like the interface it might be worthwhile making the file IO modular and allow for other formats besides XML. All it takes is a buffer class. (eg)It could then be made to facilitate direct P2P play.(maybe)
Report message to a moderator
|
|
|