Hallo!
So, I think this XML representation could be okay (see bottom of the mail):
Now I'm unsure if I should implement the parser myself or if I should use a XML parser (e.g. Xerces from apache) ?
Thanks for any thoughts, LG Georg
PS: XML examples: e.g.: a list container:
<?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE container SYSTEM "irgendwas.dtd"> <container> <h_list> <!-- is an element of PDContainer, so there could also be other datastructures like the normal PD array --> <list> <!-- this is the pd list --> <float> 34 </float> <symbol> afsdf </symbol> </list> <float> 423 </float> <symbol> sfad </symbol> <list> <float> -4 </float> <symbol> herc </symbol> </list> </h_list> </container>
or a map (uses key-value pairs):
<?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE container SYSTEM "irgendwas.dtd"> <container> <h_map> <key> <list> <float> 34 </float> <symbol> afsdf </symbol> </list> <float> 423 </float> </key> <value> <symbol> sfad </symbol> <list> <float> -4 </float> <symbol> herc </symbol> </list> </value> </h_map> </container>
Hallo, Georg Holzmann hat gesagt: // Georg Holzmann wrote:
So, I think this XML representation could be okay (see bottom of the mail):
Now I'm unsure if I should implement the parser myself or if I should use a XML parser (e.g. Xerces from apache) ?
I think, the parsing of the container xml files migth be easy enough, to not depend on external libraries. However there are some engines you could include directly into the externals.
One suggestion: It would be nice, if the basic datatypes float and symbol could allso be abbreviated as "f" and "s": "<s>Answer</s> <f>42</f> Or can the already?
Ciao
hi georg, frank,
Now I'm unsure if I should implement the parser myself or if I should use a XML parser (e.g. Xerces from apache) ?
I think, the parsing of the container xml files migth be easy enough, to not depend on external libraries. However there are some engines you could include directly into the externals.
why invent the wheel again and again if there are platform independent open source libraries out there? writing parsers - for even small languages - is far from easy and nearly always turns out to get very hairy once things should get extensible. if you want to do it from scratch you should imho at least use standard tools like yacc/lex and the like.
lg martin
Hallo, martin pichlmair hat gesagt: // martin pichlmair wrote:
why invent the wheel again and again if there are platform independent open source libraries out there?
I'm not against code reuse at all, but the Pd data types DTD is so simple, that relying on a big library like Xerxes would be overkill IMO, and it will make compiling more difficult. Instead the xml handling can be embedded using something like tinyxml, which is exactly that, tiny.
Ciao
why invent the wheel again and again if there are platform independent open source libraries out there?
I'm not against code reuse at all, but the Pd data types DTD is so simple, that relying on a big library like Xerxes would be overkill IMO, and it will make compiling more difficult. Instead the xml handling can be embedded using something like tinyxml, which is exactly that, tiny.
Yes, XML is also handled with a custom parser in pool. The general XML format is really not likely to change and if this is handled properly there should not be a problem. In pool it's only a few dozens of lines of code.
best greetings, Thomas