On Thursday 20 December 2001 19:35, Anthony Shawver wrote:

> I created simple little test program to illustrate my problem.  The test
> program has 2 parts; the first part reads an SVG file from disk(I enclosed
> the one (test.svg) that I used for testing) & transcodes(this works).  The
> second part uses a method in the class to create a very simple SVG Document
> & transcodes it(this doesn't work).  When you run the code, you will notice
> that no errors are thrown.  However the first part creates a valid jpg
> whereas the second produces a blank image.  So from this I have 2
> questions: 1) Why isn't the SVG Document able to be transcoded properly &

Your test.svg file does not have the proper DOCTYPE to say that this is an 
SVG document. So you should add the following lines in test.svg

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd";>

<svg xmlns="http://www.w3.org/2000/svg"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; width="???" height="???">

...

</svg>


> 2) why isn't the transcoder throwing an exception on the SVG Document?

See thomas's analysis.

Conlcusion:

SVG relies on DOM level 2 spec which is namespace aware. 
So you always have to use the createElementNS(svgNs, localName)
method. Where svgNS is the namespace URI of SVG, and localName is the local 
name of the element to create.

PS: to set attributes, use setAttributeNS(null, qualifiedName). For futher 
details regarding why 'null' is used (attributes are always in the default 
namespace) - see the W3C namespace specification.

Thierry.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to