473,847 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

importNode and root node name

at the page :
<http://thoraval.yvon.f ree.fr/Fixed_layout/import_nodes.xh tml>
when importing an svg document i have to do :
document.import Node(
req.responseXML .getElementsByT agName(req.para meters.root)[0],true))

(lines 46/47)

in case of SVG : req.parameters. root = 'svg'
and 'math' in case of MathML
there is no DOM method for getting the root node, enabling not to
specify the root is svg|math ???

or could i do that using DOM/XPath ?

ie something like :
req.responseXML .evaluate('/',document, nsResolver, XPathResult.ANY _TYPE,
null);

???
--
Une Bévue
Jun 27 '08 #1
11 2575
Une Bévue <un************ @weltanschauung .com.invalidwro te:
>
there is no DOM method for getting the root node, enabling not to
specify the root is svg|math ???

req.responseXML .documentElemen t

response given over the french clj (fr.c.l.j)

--
Une Bévue
Jun 27 '08 #2
Une Bévue wrote:
at the page :
<http://thoraval.yvon.f ree.fr/Fixed_layout/import_nodes.xh tml>
when importing an svg document i have to do :
document.import Node(
req.responseXML .getElementsByT agName(req.para meters.root)[0],true))

(lines 46/47)

in case of SVG : req.parameters. root = 'svg'
and 'math' in case of MathML
there is no DOM method for getting the root node, enabling not to
specify the root is svg|math ???

or could i do that using DOM/XPath ?

ie something like :
req.responseXML .evaluate('/',document, nsResolver, XPathResult.ANY _TYPE,
null);

???
The root element is simply accessible as
req.responseXML .documentElemen t

The root node in the XPath data model is the document node in the DOM
model thus if you want to access the root node then you simply need
req.responseXML
However you can't import document nodes.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jun 27 '08 #3
Martin Honnen <ma*******@yaho o.dewrote:
>
The root element is simply accessible as
req.responseXML .documentElemen t

The root node in the XPath data model is the document node in the DOM
model thus if you want to access the root node then you simply need
req.responseXML
However you can't import document nodes.
OK, fine thanks !
--
Une Bévue
Jun 27 '08 #4
* Une Bévue wrote in comp.lang.javas cript:
>at the page :
<http://thoraval.yvon.f ree.fr/Fixed_layout/import_nodes.xh tml>
when importing an svg document i have to do :
document.impor tNode(
req.responseXM L.getElementsBy TagName(req.par ameters.root)[0],true))

(lines 46/47)

in case of SVG : req.parameters. root = 'svg'
and 'math' in case of MathML
When dealing with elements in a namespace you should instead use the
method getElementsByTa gNameNS() and properly specify the namespace in
addition to the local name, like

.getElementsByT agNameNS('http://www.w3.org/2000/svg', 'svg');
>or could i do that using DOM/XPath ?

ie something like :
req.responseXM L.evaluate('/',document, nsResolver, XPathResult.ANY _TYPE,
null);
You would select '/*' to get the root element as opposed to the root
node.
--
Björn Höhrmann · mailto:bj****@h oehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
Jun 27 '08 #5
Bjoern Hoehrmann <bj****@hoehrma nn.dewrote:
>
When dealing with elements in a namespace you should instead use the
method getElementsByTa gNameNS() and properly specify the namespace in
addition to the local name, like

.getElementsByT agNameNS('http://www.w3.org/2000/svg', 'svg');
OK, then, i do have to assume i was somehow "lucky" when not specifying
the ns ? (that works without it)
or could i do that using DOM/XPath ?

ie something like :
req.responseXML .evaluate('/',document, nsResolver, XPathResult.ANY _TYPE,
null);

You would select '/*' to get the root element as opposed to the root
node.
then a dom/xpath expression isn't equivalent to an xslt/xpath one ?

i understand '/*' takes the root + everything below it.

'/' takes the node only.

and again, i'd have to specify the ns :

'/xhtml|svg|math: *'

this is unclear to me because when i specify '//xhtml:body' (for example
in the dropdown at
<http://thoraval.yvon.f ree.fr/Fixed_layout/editable_dropdo wn.xhtmlonly
tested on Mac OS X : firefox ans safari)

i'm able to log the children and attributes.

i think i misunderstood the difference between node and element...
--
Une Bévue
Jun 27 '08 #6
* Une Bévue wrote in comp.lang.javas cript:
>then a dom/xpath expression isn't equivalent to an xslt/xpath one ?

i understand '/*' takes the root + everything below it.
No, this matches any element that is a child of the root node. There can
only be one element with the root node as parent, the root element. This
is the same wherever you use XPath. The root node and everything below
it would be //node(), for example.
>this is unclear to me because when i specify '//xhtml:body' (for example
in the dropdown at
<http://thoraval.yvon.f ree.fr/Fixed_layout/editable_dropdo wn.xhtmlonly
tested on Mac OS X : firefox ans safari)
But //* is very different from /*.
--
Björn Höhrmann · mailto:bj****@h oehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
Jun 27 '08 #7
Bjoern Hoehrmann <bj****@hoehrma nn.dewrote:
>
No, this matches any element that is a child of the root node. There can
only be one element with the root node as parent, the root element. This
is the same wherever you use XPath. The root node and everything below
it would be //node(), for example.
OK, clear enough, thanks !
>
this is unclear to me because when i specify '//xhtml:body' (for example
in the dropdown at
<http://thoraval.yvon.f ree.fr/Fixed_layout/editable_dropdo wn.xhtmlonly
tested on Mac OS X : firefox ans safari)

But //* is very different from /*.
yes clearly ))
--
Une Bévue
Jun 27 '08 #8
Une Bévue schrieb am 26.04.2008 19:02:
Bjoern Hoehrmann <bj****@hoehrma nn.dewrote:
this is unclear to me because when i specify '//xhtml:body' (for example
in the dropdown at
<http://thoraval.yvon.f ree.fr/Fixed_layout/editable_dropdo wn.xhtmlonly
tested on Mac OS X : firefox ans safari)
Just for your Information:

Internet Explorer gives a download Requester for each xhtml file (sent
by xhtml+xml)

http://blogs.msdn.com/ie/archive/2005/09/15/467901.aspx

--
Mit freundlichen Grüßen
Holger Jeromin
Jun 27 '08 #9
Holger Jeromin <ne*********@ka tur.dewrote:
>
Internet Explorer gives a download Requester for each xhtml file (sent
by xhtml+xml)
yes, i know even if i can't test over win* ...

but could i implement xhtml served as text/html with more than 4
namespaces ???

vielen dank ;-)
--
Une Bévue
Jun 27 '08 #10

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

Similar topics

0
1388
by: Andy Fish | last post by:
Hi, I have server-based Java application that maintains a fairly large XML structure as a DOM. In response to a user request I want to select various nodes (including sub-nodes) and jam them together to be returned as a new piece of XML. This is run through an XSLT transform to produce (typically) an HTML page. From what I can see, the obvious way to do it is to make a brand new XML document for each user response and then use...
12
7006
by: pillepop2003 | last post by:
Hey! Can anyone give me a hint, how this problem is best implemented: I have a table of users (see below), where every user has one "superior user" (= parent node), this should be a fully unambigous tree structure. The root node can have whatever value you prefer, I suppose NULL would be good for a start. What I want to do is finding the way from an arbitrary node in the tree. Example:
6
8351
by: David B. Bitton | last post by:
I am having a problem deserializing XML when the root node is missing a namespace declaration. My Type has an XmlTypeAttribute with a namespace defined. If I attempt to deserialize the XML, I get the dreaded <elementname xmlns=''> was not expected exception. If I comment out the XmlTypeAttribute, it works just fine. Just so you know, when I instantiate an instance of an XmlSerializer, I pass a default namespace to the ctor. ...
1
4340
by: Andrew Jacobs | last post by:
I am using C# to write an application that migrates documents from one version of an XML schema/DTD to later one. Much of the document has the same structure in the two versions and I use XMLDocument.ImportNode to copy unchanged sub-trees between the old and new document but this takes much longer than it should. I profiled the code and found that when ImportNode copies an element it initialises any default attributes defined for the...
1
9703
by: Peter Nofelt | last post by:
Hey All, I'm running into this issue with parsing through an xml document by tag name. Below is an example xml document: File Name: things.xml <things> <people> <name>Peter</name>
15
4176
by: Stig Brautaset | last post by:
Hi group, I'm playing with a little generic linked list/stack library, and have a little problem with the interface of the pop() function. If I used a struct like this it would be simple: struct node { struct node *next; void *data; };
5
3967
by: yawnmoth | last post by:
I wrote the following in an attempt ot better understand importNode: <script> f1=document.createElement("iframe"); f1.src=unescape("http://www.domain.tld/test.txt"); f2=document.importNode(f1,true); document.innerHTML=f2.innerHTML; </script> text.txt's contents are as follows:
3
3256
by: polism | last post by:
Hi, I have the following simple code, using xerces running on my windows. This demo compiles and runs normally, but when I open my Task Manager, I see a constant memory growth of my process, and I dont understand why. //*********************************************** XMLPlatformUtils::Initialize(); DOMImplementation impl = DOMImplementationRegistry::getDOMImplementation(...);
10
8820
by: Simon Brooke | last post by:
The DOM API has included public Node importNode(Node,boolean) as a method of the Document interface for a long time. Does anything actually implement it? Xerces 2 is giving me: org.w3c.dom.DOMException: NOT_SUPPORTED_ERR: The implementation does not support the requested type of object or operation. at org.apache.xerces.dom.CoreDocumentImpl.importNode(Unknown Source) at org.apache.xerces.dom.CoreDocumentImpl.importNode(Unknown Source)
0
9882
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9727
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10645
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9481
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7053
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5719
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4524
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4116
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3160
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.