473,322 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Read SVG (using JavaScript) H - E- L - P ! ! !

How can I use EXTERNAL JavaScript code to read (and modify) an SVG
file/object? Can JavaScript do this or do I have to resort to Batik?

IMPORTANT NOTE:
The JavaScript code CANNOT be embedded in the SVG file, because it is
server-side generated.

Thank You
- Olumide

Jul 20 '05 #1
5 2211
Olumide wrote:
How can I use EXTERNAL JavaScript code to read (and modify) an SVG
file/object? Can JavaScript do this or do I have to resort to Batik?

IMPORTANT NOTE:
The JavaScript code CANNOT be embedded in the SVG file, because it is
server-side generated.

Thank You
- Olumide


Do you need to save the modifications? If not, just load it like any
other XML document (through XmlHttpRequest() or createDocument() and
document.load()), and use the DOM to manipulate it.

-Jason Davis

Jul 20 '05 #2
Olumide wrote:
How can I use EXTERNAL JavaScript code to read (and modify) an SVG
file/object? Can JavaScript do this or do I have to resort to Batik?


I have an example of reading and rendering VML using JavaScript, which you
may find helpful: http://www.stirbitch.com/steve/smml/index.html
Jul 20 '05 #3

... just load it like any
other XML document (through XmlHttpRequest() or createDocument() and
document.load()), and use the DOM to manipulate it.


Thanks Jason, I will look into this. The problem however is that I have
a multiframe document that looks like this:
|-----------------------------------------------|
| | |
| | |
| | |
| | |
| Left Frame | Right Frame |
| [SVG] | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
|-----------------------------------------------|

The Left Frame is an SVG object while the Right Frame is a an HTML
document with JavaScript code in its head section. My intention is to
have the SVG object (in the left frame) modified by the javascript code
in the right frame. (The HTML document in the right frame is server-side
generated.)
Er ... can document.load() still "load" the SVG document even though it
is already loaded in the left frame?

Thanks
- Olumide

Jul 20 '05 #4
Can't you just go:

top.leftframename.document

And reference the SVG document that way? With the Adobe SVG Viewer you
might have to rely on method calls (I don't have much experience with
the ASV DOM implementation), but in Mozilla you should be able to access
the SVG document like that, and use standardized DOM interfaces (DOM2
Core and the SVG DOM for example) to manipulate it on the fly.

-Jason Davis

Olumide wrote:

... just load it like any other XML document (through XmlHttpRequest()
or createDocument() and document.load()), and use the DOM to
manipulate it.



Thanks Jason, I will look into this. The problem however is that I have
a multiframe document that looks like this:
|-----------------------------------------------|
| | |
| | |
| | |
| | |
| Left Frame | Right Frame |
| [SVG] | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
|-----------------------------------------------|

The Left Frame is an SVG object while the Right Frame is a an HTML
document with JavaScript code in its head section. My intention is to
have the SVG object (in the left frame) modified by the javascript code
in the right frame. (The HTML document in the right frame is server-side
generated.)
Er ... can document.load() still "load" the SVG document even though it
is already loaded in the left frame?

Thanks
- Olumide


Jul 20 '05 #5

Jason Davis wrote:
Can't you just go:

top.leftframename.document

And reference the SVG document that way? With the Adobe SVG Viewer you
might have to rely on method calls (I don't have much experience with
the ASV DOM implementation), but in Mozilla you should be able to access
the SVG document like that, and use standardized DOM interfaces (DOM2
Core and the SVG DOM for example) to manipulate it on the fly.


Can anyone provide a hint or (web) link showing how this can be done?

Thanks

- Olumide

Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: sriram pasham | last post by:
Hi Could any one tell me how to access(read) a registry key using javascript from a webpage(ASP page). Thanks in advance. Sriram *** Sent via Developersdex http://www.developersdex.com ***...
3
by: Rick Edwards | last post by:
Can I do this? If I'm passing info in my HTTP headers, can I read this info via Javascript? I've seen some hope out there, but nothing definitive - I'm hoping to get that answer here.... TIA...
9
by: Randell D. | last post by:
Folks, I can program fairly comfortably in PHP and can, for the most part using these skills and others that I've picked up over the years manage to read/understand most code in Javascript... so...
5
by: Doug | last post by:
I would appreciate a response on this. I have clients who will be placing text files information about in a network directory for example: http://www.protegen.com/clients/ Is it possible to...
14
by: Randell D. | last post by:
Folks, Here's my problem: I am createing an array in a file using the reslut of some PHP and MySQL processing. An example of my array would be examlpe="example one"; examlpe="example...
4
by: Cloud Burst | last post by:
I'm writing a javascript for my own use. I'd like it to read my disk to get some information. In particular, I want to find out how much disk is being used by some directories. At present, I'm...
0
by: David Virgil Hobbs | last post by:
While studying the asp.net javascript problem I saw and used pages about asp.net basics at http://www.sitepoint.com/article/815/4 and...
17
by: chris.schwalm | last post by:
I would like to first state that I have searched through the archives and found a lot of related material, but am still new enough to javascript that I can't fit all the pieces together yet. So...
5
by: subbulakshmi | last post by:
hi how to read data from XMLDocument by using Javascript. i got coding from internet. but its not read data. help me its in JavaScript ----------------------- //server return XML...
1
by: bpejman | last post by:
Hi Everyone, I've been reading and searching the web for days trying to figure out how exactly you can access and read a Perl array or hash from within JavaScript. I've been reading that JSON is...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.