Hi there,
I was wondering if there is a way to exclude certain data( like the actual vector points ) since I only need the position and custom attributes.
(Also I noticed not that all objects have an x and y attribute...Am I doing something wrong? )
thanks,
Sidar
Exclude XML data
Exclude XML data
Last edited by Sidar on Mon Oct 03, 2011 4:17 am, edited 1 time in total.
Re: Exlude XML data
Exclude from what, where?Sidar wrote:I was wondering if there is a way to exclude certain data( like the actual vector points ) (…)
You don't tell what you are doing - how should others know whether it's right or wrong?Sidar wrote:(Also I noticed not that all objects have an x and y attribute...Am I doing something wrong? )

Hint: a minimal amount of context describing the task you are trying to achieve (with inkscape, with a script extension run from within inkscape, or possibly with external tools parsing SVG files created with Inkscape) might help to get useful answers.
Re: Exlude XML data
Exclude from what, where?
I think I was pretty sure we were talking about the XML generated by inkscapes interface. Hence the section SVG/XML Code.
I'm not sure how to question it different than I already have.
There is too much data in the SVG ( which is logical since it represents all the data ), but I have no use for all of it.
I just need the positions of each object created along side their custom attributes.
You don't tell what you are doing - how should others know whether it's right or wrong?
There isn't much to this is there?
Some object do have the X and Y attribute and some don't. All I did was create objects.
I'm asking whether this is normal or not.
Re: Exlude XML data
Sorry to have bothered you with my comment/questions then. I'm obviously not skilled to answer the first part of your question.Sidar wrote:I think I was pretty sure we were talking about the XML generated by inkscapes interface. Hence the section SVG/XML Code.
I'm not sure how to question it different than I already have.
Yes, it is (it depends on what these "objects" are).Sidar wrote:Some object do have the X and Y attribute and some don't. All I did was create objects.
I'm asking whether this is normal or not.
Among the objects created with the tools from Inkscape's toolbox
- only the rectangles (basic SVG shape <rect>) do have x and y attributes [1].
- The other shapes - special to Inkscape: ellipse/circle, star/polygon, spiral - have cx and cy attributes in the 'sodipodi' namespace (for internal use only - other SVG renderers use the regular path data present in the 'd' attribute). Note: these center coordinates do not yet have the transformations applied which might be present in a 'transform' attribute.
- Text objects (<text>), clones (SVG: <use>) do have x and y coordinates, as do embedded or linked bitmap images (<image>)
- For a complete list of which SVG objects can have an 'x' and 'y' attribute (<coordinate>), see this index page in the SVG specification: M.1 Regular attributes. Note that Inkscape itself does not necessarily 'write' all of those object types in its own files, but they can occur in foreign SVG files (even after editing in Inkscape).
You can convert rectangles (and other Inkscape shapes) into regular paths by applying Inkscape's menu command 'Path > Object to Path'. This will create regular SVG paths (<path>) - which do not have x and y attributes - or a group (<g>) of paths (when converting a text object aka outlining it).
[1] <rect> is the only one from the basic SVG shapes listed in the SVG 1.1 spec which Inkscape does create itself (though it can render all of them).
Re: Exlude XML data
Thanks.
I guess ill just have to keep all the other data. As well.
Would be nice if there is an option to exclude certain data ( I'm using inkscape as a "level" editor, so I don't really need all the numeral representation of the vector objects).
But there should be a way to create your own parser/exporter no?
I guess ill just have to keep all the other data. As well.
Would be nice if there is an option to exclude certain data ( I'm using inkscape as a "level" editor, so I don't really need all the numeral representation of the vector objects).
But there should be a way to create your own parser/exporter no?
Re: Exclude XML data
You can certainly write your own output extension to filter some of the data that you don't need.
Honestly, the logic won't be much different, if you'd prefer to start by just writing your own standalone application to strip out the extra information from saved svg files. If this is all your doing, XSL might be a quick way to describe this transformation and what data you are interested in keeping. I'll be putting together a little tutorial next week for a way to plug an executable (like this) into inkscape as an extension.
Honestly, the logic won't be much different, if you'd prefer to start by just writing your own standalone application to strip out the extra information from saved svg files. If this is all your doing, XSL might be a quick way to describe this transformation and what data you are interested in keeping. I'll be putting together a little tutorial next week for a way to plug an executable (like this) into inkscape as an extension.
Re: Exclude XML data
Inkscape can handle XSL-based transformations as extensions internally - there should be no need to use an external (Windows-only) executable. See for example the XAML extension shipping with Inkscape (svg2xaml, xaml2svg).LiquidAsh wrote:If this is all your doing, XSL might be a quick way to describe this transformation and what data you are interested in keeping. I'll be putting together a little tutorial next week for a way to plug an executable (like this) into inkscape as an extension.