Greetings, Hans Breuer! > Hi Andrey, >> Am 15.02.2016 um 08:13 schrieb Andrey Repin <anrdae...@freemail.ru>: >> >> Greetings, All! >> >> I've been toying around with XML parsing, and I've used Dia shape as a guinea >> pig. This gave me some ideas, but first, a question: >> Where's the Dia DTD's are located nowadays? > https://git.gnome.org/browse/dia/tree/doc/shape.dtd
Thanks! Though, for embedding, https://git.gnome.org/browse/dia/plain/doc/shape.dtd would be more correct. And the document itself is in need of updated links, I see. (Now, do I have an account on gnome.org? Hmm... Probably yes.) >> Now, to the shapes themselves. >> I think, people subscribed to the list had seen this (well, similar) one >> >> <shape xmlns="http://www.daa.com.au/~james/dia-shape-ns" >> xmlns:dia="http://www.daa.com.au/~james/dia-shape-ns" >> xmlns:svg="http://www.w3.org/2000/svg"> >> <name>Custom - Styles mix</name> >> <svg svg:width="300px" svg:height="300px" svg:viewBox="0 0 3 3"> >> <circle >> dia:style="stroke: foreground;" >> svg:style="fill: yellow; fill-opacity: 255; stroke-width: 0.1; >> stroke-dasharray: 1 0.75; stroke-dashoffset: .5;" >> cx="1.5" cy="1.5" r="0.5"/> >> </svg> >> </shape> >> >> This was posted as a proposed concept to the request about separating >> decoration colors from diagram object properties. > Apparently I missed that discussion or can’t remember it… There it was: https://mail.gnome.org/archives/dia-list/2015-March/msg00009.html >> Now, how about this one? >> >> <?xml version="1.0" encoding="UTF-8"?> >> <!DOCTYPE shape PUBLIC "-//Dia//DTD Dia shape 1.0//EN" >> "https://git.gnome.org/browse/dia/plain/doc/shape.dtd"> >> <shape >> xmlns:dia="http://www.daa.com.au/~james/dia-shape-ns" >> xmlns:svg="http://www.w3.org/2000/svg"> >> >> <name>Custom - Styles mix</name> >> >> <?dia python.script();?> >> >> <svg svg:width="300px" svg:height="300px" svg:viewBox="0 0 3 3"> >> <circle >> dia:style="stroke: foreground;" >> svg:style="fill: yellow; fill-opacity: 255; stroke-width: 0.1; >> stroke-dasharray: 1 0.75; stroke-dashoffset: .5;" >> cx="1.5" cy="1.5" r="0.5"/> >> </svg> >> >> </shape> >> >> Advantages are quite many. >> 1. Upfront valid XML. >> 2. Clear separation of object design from object attributes. >> 3. Embedded scripting! Seriously. XML lets you embed parsing instructions! >> > Sorry, I don’t understand any of your proposed advantages. 1. Document processing declaration (<?xml ... ) necessary for correct parsing by external tools. Since I'm often writing my shaped by hands, knowing that it is at least syntactically correct, without booting it into editor, is an advantage. This also applies to #2 and #3. 2. Explicitly defined root tag. 3. Explicit human-readable format purpose declaration. 4. Default namespace may or may not be specified in the DOCTYPE declaration, but I prefer it to be there, it gives clarity to the both user and machine. No need to second-guess and backtrack. 5. Clearly separating attributes between namespaces, you can explicitly control, which attributes of the object are part of its functionality and can be controlled with Dia, and which are part of the object presentation and are not to be altered. 6. Embedding control logic in a form of Python scripts into shape itself allows for greater portability and consistency. To the level of embedding shapes into the diagram itself and having them execute same code in a same way on every installation. -- With best regards, Andrey Repin Monday, February 15, 2016 21:50:20 Sorry for my terrible english... _______________________________________________ dia-list mailing list dia-list@gnome.org https://mail.gnome.org/mailman/listinfo/dia-list FAQ at http://live.gnome.org/Dia/Faq Main page at http://live.gnome.org/Dia