MakeMusic
SmartMusic Finale Garritan MusicXML

SVG vs DOM (OT)

Moderator: Michael Good

SVG vs DOM (OT)

Postby Jane Singer » Tue Aug 27, 2002 1:22 am

OK, I tried creating an SVG document as I would a normal DOM document. Then I realized it was ridiculous to put in all the font and glyph elements, element by element in the code. So I made a file of only these definitions, and then imported it into a DOM using the org.apache.batik parser. Then I added the text elements.

Seems fine, but I noticed on the Batik page
(http://xml.apache.org/batik/domapi.html) they say that this DOM object should then be cast to an SVGDocument object. So there must be a difference.

I realize that this is not really a MusicXML topic, but you guys are just so helpful.

Jane


Brian Grainger wrote:
Jane Singer wrote:Right, OK, I know how to do that, but the JSVGCanvas will display it if I create it that way?

As long as the DOM document you create is valid SVG, I can't see why there would be any problems. There really is no difference in the SVG whether you create it in a text editor, paint it in a graphics program, or build it directly from DOM nodes. Those are just different ways to produce the same result.

Regards, Brian
Jane Singer
 
Posts: 27
Joined: March, 2014
Reputation: 0

RE: SVG vs DOM (OT)

Postby Michael Good » Tue Aug 27, 2002 11:33 am

Hi Jane,

I don't know much about SVG, but I do know that SVG has defined an extended version of the DOM as part of their specification. So I would imagine that you would create an SVGDocument object from your program. You should be able to treat it the same way as the DOM object, but also be able to make use of SVG-specific objects and methods.

Best regards, Michael
Michael Good
VP of MusicXML Technologies
MakeMusic, Inc.
User avatar
Michael Good
 
Posts: 2197
Joined: March, 2014
Reputation: 0

Re: SVG vs DOM (OT)

Postby Brian Grainger » Tue Aug 27, 2002 10:20 pm

--Boundary_(ID_1ExYfo7y6gPUITIMBqWl9A)


Jane Singer wrote:Seems fine, but I noticed on the Batik page
(http://xml.apache.org/batik/domapi.html) they say that this DOM object should then be cast to an SVGDocument object. So there must be a difference.

To quote from that page:

As we have created an SVG Document, we can cast this document to an SVGDocument (defined in the org.w3c.dom.svg package) if needed.

I think that's saying that you may cast your Document object to an SVGDocument object if you wish, but you aren't required to. It would give you access to specific Batik methods and properties for SVG documents, but you could still manipulate your Document object with standard DOM routines only if you chose not to do the cast.

If you don't do the cast, you can still use the SVG namespace, normal XML methods, etc. You just won't have the extra SVG-specific routines which Batik provides.

Regards, Brian

--Boundary_(ID_1ExYfo7y6gPUITIMBqWl9A)
Brian Grainger
 
Posts: 111
Joined: March, 2014
Reputation: 0

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron