473,405 Members | 2,379 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,405 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 1940
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.