>>>>> "AS" == Anthony Shawver <[EMAIL PROTECTED]> writes:

AS> Thanks, Thierry.  I appreciate your time & help.  However, I am still not
AS> getting it to work.

AS> I created simple little test program to illustrate my problem.  

    Good test, now we can really help you I think...

AS> So from this I have 2 questions:

AS> 1) Why isn't the SVG Document able to be transcoded properly & 

    It is transcoded properly. :) 

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

    Because it transcoded it properly. :)

    The problem is that you weren't creating your elements in the SVG
namespace.  The SVG specification says that an SVG interpreter must
ignore elements (and their children) that it doesn't understand) So
all it sees is the <svg width="200px" height="100px"> with no
children. Hence the empty 200x100 pixel image.  The following version
of createTestDoc2 results in a document with 'X-axis label' over a
tall skinny rectangle, which I think is the intent.

    private void createTestDoc2(Document xmlDoc)
    {
        Element svgDocElement = (Element)xmlDoc.getDocumentElement();
        //set size
        svgDocElement.setAttributeNS(null, "width",  "200px");
        svgDocElement.setAttributeNS(null, "height", "100px");
        //build axis label(s)
        Element  xLabelElement = (Element)xmlDoc.createElementNS(svgNS, "g");
        svgDocElement.appendChild(xLabelElement);
        xLabelElement.setAttributeNS(null, "transform", "translate(40,20)");
        Element  xTextElement = (Element)xmlDoc.createElementNS(svgNS, "text");
        xLabelElement.appendChild(xTextElement);
        xTextElement.appendChild((Text)xmlDoc.createTextNode("X-axis label"));
        xTextElement.setAttributeNS(null, "style", "font-family:Verdana; font-size:8; 
fill:blue");
        //adding description
        Element  descElement = (Element)xmlDoc.createElementNS(svgNS, "desc");
        svgDocElement.appendChild(descElement);
        descElement.appendChild((Text)xmlDoc.createTextNode("My Description"));
        //adding line
        Element  axisElement = (Element)xmlDoc.createElementNS(svgNS, "g");
        svgDocElement.appendChild(axisElement);
        Element  polylineElement = (Element)xmlDoc.createElementNS
            (svgNS, "polyline");
        axisElement.appendChild(polylineElement);
        axisElement.setAttributeNS(null, "style", 
                                   "fill:none; stroke-width:1; stroke:black");
        polylineElement.setAttributeNS(null, "points", 
                                       "65.0,40.08  75.87,40.08  75.87,80.02 
65.0,80.02 65.0,40.08 ");
    } //createTestDoc2()


AS> Thanks again for your time,

    Enjoy!

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

Reply via email to