← Back to team overview

kicad-developers team mailing list archive

Re: kicad save file format


What I was thinking, is using a library that made for us the syntax work, that's why I was thinking about XML, which is very used, well known, and very easy to use. I made some tests with TinyXML, Hear is an example :

TiXmlDocument doc;
TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "", "" );
doc.LinkEndChild( decl );

TiXmlElement * root = new TiXmlElement( "root" );
doc.LinkEndChild( root );
TiXmlElement * msg = new TiXmlElement( "SCH_TEXT" );
//root->LinkEndChild( msg );

wxString Name = m_Text;
msg->LinkEndChild( new TiXmlText(Name.mb_str( wxConvUTF8 )));
if(doc.SaveFile( "/tmp/essai.xml" ))
wxMessageBox(_("File Successfully saved\n\n"));

With that code I get :

<?xml version="1.0" ?>

Which is clear, easy to write. That's what I was thinking about. Parse this file is very easy, and we don't have to write anything :)

al davis a écrit :

On Tuesday 05 May 2009, Damien RANNOU wrote:
> I have a question about file save format : wouldn't it be
> interesting to use XML file format instead of actual kicad
> file format ? Xml parser are integrated in wxWidget (for
> example
> :http://wiki.wxwidgets.org/Object_serialization_using_XTI_and <http://wiki.wxwidgets.org/Object_serialization_using_XTI_and>
> :_XML).
> Using XML file format would be interesting for
> interoperability, cleaner save code in object (because
> wxwidget make a lot) and cleaner backup code (why do not use
> the same structure between classical objects and Text (and
> other things) ?)

not really ..

XML is just a syntax. The syntax doesn't really matter. You
could just as well choose C-like, Ada-like, Lisp-like, or

What matters is how the data is represented and organized.

Regarding interoperability, you want a format that is defined by
some kind of standard, and is in common use. If you can't find
one that is an exact match, look at the neighbors, and what you
might want to interoperate with.

Kicad is very limited because of the lack of import and export
facilities. There is a serious need for a general translator

I suggest something based on extending a netlist format, such as
the structural subset of Verilog. It might be easier to think
of the Spice format for this, but it is too restrictive and

I make a write-up to get started for gEDA, here:
http://geda.seul.org/wiki/geda:format_translation <http://geda.seul.org/wiki/geda:format_translation>

It should be easy to extend it to represent layout too.

Ideally, this system would support gEDA and Kicad equally, and
provide a path between them, both ways. It could also provide
import and export capability, and links to simulators and other

You could use this format directly, but to get started, the best
way is to use it as a neutral intermediate format so there is no
pressure to change the tool formats.

I have a start for this with Gnucap language plugins. The work
needed is to make a driver program for a stand-alone translator,
and language plugins for the schematic and layout programs.

My plate is too full to do it, but I can guide someone else. Is
anyone here interested in making the translator?



41, rue Yves Collet
29200 BREST

Follow ups