Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Accessing DOM elements in an embedded doc

Reply
Thread Tools

Accessing DOM elements in an embedded doc

 
 
Julius Mong
Guest
Posts: n/a
 
      04-05-2004
Dear all, I have something like this:

<html... >
<embed ...>
</html>

Am I out of luck if I wanted to access the embedded DOM and manipulate its
content?

Or if I have:

<svg ...>
<svg ...>
...
</svg ...>
</svg>

Is it possible to manipulate the inner svg elements from a script defined in
the outer? I tried

var SVGDoc = evt.getTarget().getOwnerDocument();
var SVGRoot = SVGDoc.getDocumentElement();
var SVGInner = SVGDoc.getElementsByTagName("svg");
SVGInner.currentTranslate.x += dx;

and it won't work, if I did:

var SVGDoc = evt.getTarget().getOwnerDocument();
var SVGRoot = SVGDoc.getDocumentElement();
SVGRoot.currentTranslate.x += dx;

then the entire outer document gets translated, I've also tried
SVGDoc.getElementByID and getfirstChild with no luck... can someone point me
in the right direction?

Thanks, Jules



 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      04-05-2004


Julius Mong wrote:

> Dear all, I have something like this:
>
> <html... >
> <embed ...>
> </html>
>
> Am I out of luck if I wanted to access the embedded DOM and manipulate its
> content?


As browsers offer an <embed> element to embed content rendered by
plugins I am not sure what your example is, an attempt to provide a HTML
snippet which you script inside of a browser and where you then usually
be able to script the <embed> element if the plugin exposes an API to
JavaScript, or an attempt to define your own new element <embed> that is
supposed to embed on HTML document into another. If the latter I am
wondering why you do not use <iframe> or <object> as that are the tools
HTML 4 (or XHTML 1) provides to embed another HTML page. As for
accessing them, yes, inside of a browser and with the HTML DOM there are
properties, see
http://www.w3.org/TR/DOM-Level-2-HTM...ml#ID-67133006
http://www.w3.org/TR/DOM-Level-2-HTM...ml#ID-38538621
for contentDocument of an <iframe> or <object> element.

Of course if it is not inside of a browser and you are just using the
W3C DOM Core then it is diffifult. So you need to tell us how you are
going to use the DOM, with which language, which level and which modules
you have available.

> Or if I have:
>
> <svg ...>
> <svg ...>
> ...
> </svg ...>


Does SVG allow to nest <svg> elements?
> </svg>
>
> Is it possible to manipulate the inner svg elements from a script defined in
> the outer? I tried
>
> var SVGDoc = evt.getTarget().getOwnerDocument();
> var SVGRoot = SVGDoc.getDocumentElement();
> var SVGInner = SVGDoc.getElementsByTagName("svg");
> SVGInner.currentTranslate.x += dx;
>
> and it won't work, if I did:
>
> var SVGDoc = evt.getTarget().getOwnerDocument();
> var SVGRoot = SVGDoc.getDocumentElement();
> SVGRoot.currentTranslate.x += dx;
>
> then the entire outer document gets translated, I've also tried
> SVGDoc.getElementByID and getfirstChild with no luck... can someone point me
> in the right direction?


Do you know about the Yahoo group for SVG developers? Maybe someone
there can answer your question
http://groups.yahoo.com/group/svg-developers/


--

Martin Honnen
http://JavaScript.FAQTs.com/

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How *build* new elements and *replace* elements with xml.dom.minidom? Chris Seberino Python 3 06-12-2009 05:08 AM
XSLT: iterating all child elements and accessing homonymous childrenin sibling elements Gerald Aichholzer XML 2 06-27-2006 03:46 PM
String[] files = {"a.doc, b.doc"}; VERSUS String[] files = new String[] {"a.doc, b.doc"}; Matt Java 3 09-17-2004 10:28 PM
Accessing DOM elements in an embedded doc Julius Mong Javascript 4 04-05-2004 10:50 PM
Parsing MS Word client doc into server-side doc... John Wallace ASP .Net 0 07-22-2003 06:49 PM



Advertisments