1 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6 <link rel=
"stylesheet" media=
"screen" type=
"text/css" href=
"./style.css" />
7 <link rel=
"stylesheet" media=
"screen" type=
"text/css" href=
"./design.css" />
8 <link rel=
"stylesheet" media=
"print" type=
"text/css" href=
"./print.css" />
10 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8" />
15 <h1 class=
"sectionedit1394"><a name=
"xml_file_formats" id=
"xml_file_formats">XML File Formats
</a></h1>
19 This page is a starting point for discussions on using
<acronym title=
"Extensible Markup Language">XML
</acronym> for commonality between gEDA applications.
23 One major goal of this effort is to provide advanced file format features while still maintaining backward compatibility with the existing file formats (and be able to bring an old design forward with ease if you wish).
27 Another main goal is to start addressing the Symbol Library Hacker task discussed at
<a href=
"geda-tasks.html" class=
"wikilink1" title=
"geda-tasks.html">tasks
</a>.
31 Yes, this effort is self concious because of
<a href=
"geda-usage.html#can_we_change_geda_to_use_an_xml_file_format" class=
"wikilink1" title=
"geda-usage.html">can_we_change_geda_to_use_an_xml_file_format
</a>
32 The concerns expressed there will hopefully be addressed as part of this effort to minimize the impact to existing file formats, and not tie up core developer time on this work. Specifically issues
2,
3,
4 and
5 are valid concerns, but they can be overcome with good design and a little bit of coding, especially if this is treated as a wrapper or evolution rather than a totally new file format.
36 While the initial version of the schema has both a large and small format for gschem files, it is assumed that the smaller will progress further to reduce the amount of “file bloat” associated with putting the files in this format.
40 While there are plenty of arguments for and against
<acronym title=
"Extensible Markup Language">XML
</acronym>, it does provide one key feature that can be difficult to implement in a custom file format, and that is unification of the different data types each gEDA program expects with minimal impact to the existing programs. What this schema currently does is separately define gschem file formats and PCB file formats. The part schema then allows for both of these to be combined into a “part” file without change thus allowing for “heavy” parts containing both symbols and PCB elements. It will also allow for a project to be stored in a single archive file if the user so chooses. It thus provides a kind of wrapper functionality that maintains internal structure formats.
44 It also introduces file format validation making sure that the file is well-formed and also, using Schematron, makes sure that constraints on data in the file are checked. This can be a real plus for managing parts like on gedasymbols.org when files can be “easily” validated for format and content on upload with some perl code.
48 An initial git repository is at
<a href=
"http://github.com/oblivian/geda-xml/tree/master" class=
"urlextern" title=
"http://github.com/oblivian/geda-xml/tree/master" rel=
"nofollow">http://github.com/oblivian/geda-xml/tree/master
</a>
52 Right now it provides schema for gschem symbol and schematic files, and a PCB file format (adapted from parse.y).
53 The part/part.xsd schema is for combining the individual schemas into a part format capable of both regular and heavy parts.
57 convert-symbol.pl (when it is done) will write a gschem symbol to the
<acronym title=
"Extensible Markup Language">XML
</acronym> format.
58 It also performs validation against the
<acronym title=
"Extensible Markup Language">XML
</acronym> Schema itself and Schematron rules also stored in the schema files.
62 The
<acronym title=
"Extensible Markup Language">XML
</acronym> Schema for gschem files provides for a “lightweight” file format that should allow for an overlay on the normal file reading routines in libgeda without modification.
66 So a line in gschem is represented as
70 <gs:l p=“
200 800 200 200 3 0 0 0 -
1 -
1” /
>
78 L
200 800 200 200 3 0 0 0 -
1 -
1
82 But the validation is handled by the
<acronym title=
"Extensible Markup Language">XML
</acronym> parser rather than writing extra validation code.
86 The
<acronym title=
"Extensible Markup Language">XML
</acronym> Schema makes sure the symbols are well-formed, and the Schematron makes sure the data is valid in the “p” attributes.
93 <li class=
"level1"><div class=
"li"> <acronym title=
"Extensible Markup Language">XML
</acronym> Schema for gschem, PCB and .xpart file format.
</div>
98 Work that needs to be done to get this effort really started:
101 <li class=
"level1"><div class=
"li"> Finish convert-symbol.pl.
</div>
103 <li class=
"level1"><div class=
"li"> Write
<acronym title=
"Extensible Stylesheet Language Transformations">XSLT
</acronym> to convert “xpart” file back to .sym/.fp format.
</div>