473,804 Members | 4,005 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I make a mix of html/xml work?

I have an XML document that, in order to save b/w for both server and
users, uses a few emtpy tags a la "<add/>" and "<edit/>" in the source,
which [should] get javascript replaced once the document is done loading
into their full form (for <add/>, this would be something like <img
src="add.gif" border="0" onClick="javasc ript:handleEven t(this,'add')"> ).

In order to do this I figured the documented needed to use a few html
tags as well (mainly, it needed head, title, script and body), but I'm
not quite certain how to make this work. I've changed my dtd to read:

<!element html (head, body)>
<!element head (title, script)>
<!element title (#PCDATA*)>
<!element script (#PCDATA*)>
<!attlist script language CDATA #REQUIRED>
<!attlist script version CDATA #REQUIRED>
<!element body (list)>

where the[list] element is the root node of my own XML data. The xml
file itself looks like:

<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<?xml-stylesheet href="nr-kvis.css" type="text/css"?>
<!DOCTYPE html SYSTEM "NR-jouyou.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>???? level 1 (80 ??)</title>
<script language="JavaS cript" version="1.0">
<!-- commented off to prevent parse errors as usual -->
</script>
</head>
<body onLoad="javacsr ipt:addInteract ion()">
<list xmlns="http://www.nihongoreso urces.com/jouyou">
[...xml in the nihongoresource s namespace...]
</list>
</body
</html>

When I load this in firefox (quite a nice browser that's very xml
friendly) the javascript is never called.

A second issue is that if I include an html namespace element inside the
<list> content using for instance:

<html:img src="someimage. gif"/>

upon validation I get the error that "the html namespace is not bound". I
know that the xml I use changes the default namespace to list's namespace
while inside the list element, but I didn't know it voided html's as
well.. how do I bind and element to a namespace so I can use it anywhere
in my xml?

- Mike Kamermans
www.nihongoresources.com
Jul 20 '05 #1
4 5746


Mike Kamermans wrote:

<script language="JavaS cript" version="1.0">
<!-- commented off to prevent parse errors as usual -->
</script>
That should be
<script type="text/javascript">
//<![CDATA[

//]]>
</script>
don't use <!-- --> to comment out the script code as then it is
commented out and not passed to the script engine.
</head>
<body onLoad="javacsr ipt:addInteract ion()">


XHTML is case-sensitive:
<body onload="addInte rval();">
then I think it should work (if you serve up the XHTML with the proper
content type application/xhtml+xml).

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #2
implementing the xhtml changes has it loading, but now I'm facing another
problem... how to get the element node that called a javascript function.

In html context this could be done using 'this', and making the javascript
function have an event as argument, then calling event.target in body of
the function and working with that - in xhtml context this doesn't seem to
work... is there another keyword that can be used (or fetch instruction)
that allows me to figure out which element called a function that you know
of?

- Mike Kamermans
www.nihongoresources.com
Jul 20 '05 #3


Mike Kamermans wrote:

how to get the element node that called a javascript function.

In html context this could be done using 'this', and making the javascript
function have an event as argument, then calling event.target in body of
the function and working with that - in xhtml context this doesn't seem to
work...


It should work, the W3C DOM Events model applies to both HTML and XHTML
so scripting events shouldn't change with Mozilla whether you serve
text/html or application/xhtml.
If you have problems to get it to work then make a small test case and
post it here or better even post its URL.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #4
Martin,
It should work, the W3C DOM Events model applies to both HTML and
XHTML so scripting events shouldn't change with Mozilla whether you
serve text/html or application/xhtml.
If you have problems to get it to work then make a small test case and
post it here or better even post its URL.


I've posted a new message with a URL under the subject "using "this" in
javascript/XHTML". Maybe you can spot an obvious mistake in the file that
I'm overlooking...

Regards,

Mike

Jul 20 '05 #5

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

Similar topics

71
6513
by: tomy_baseo | last post by:
I'm new to HTML and want to learn the basics by learning to code by hand (with the assistance of an HTML editor to eliminate repetitive tasks). Can anyone recommend a good, basic HTML editor that's a step beyond Notepad (not a WYSIWYG tool). Thanks.
10
4604
by: VictorG | last post by:
Hello, I am new to JS and am trying to add some HTML into a JS function. So that when called the script as well as the HTML will be invoked. Is there some type of embed mechanism, sort of the reverse of embedding JS in an html page with the script tag. (which is what I am doing in this case) Is this even possible?
4
3434
by: frogman042 | last post by:
My daughter is playing around trying to learn JavaScript and she wrote a small program that prints out a message in increasing and decreasing font size and color changes. She is using document write and it works fine until she puts it into a function and then calls the function from a button with onClick. This also seems to work OK, with the exception that the page is cleared, and the curser changes (and stays) as an hourglass. In...
20
5661
by: Guadala Harry | last post by:
In an ASCX, I have a Literal control into which I inject a at runtime. litInjectedContent.Text = dataClass.GetHTMLSnippetFromDB(someID); This works great as long as the contains just client-side HTML, CSS, etc. What I want to do is somehow insert a *server control* into the , then set the server control's properties at runtime.
9
1556
by: Jason Gogela | last post by:
Does anyone out there know why I should care whether a <span> is nested in a <p> or vice versa? What is the bennafit of adhering to this standard? It seems to me that regardless of which way you write it, the page will render the same, sans errors, in any browser. All responces will be greatly appreciated. ~Jason Gogela
59
7050
by: Lennart Björk | last post by:
Hi All, I have a tiny program: <!doctype HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>MyTitle</title> <meta http-equiv="Content-Type" content="text/html;
7
3639
by: pamelafluente | last post by:
The precious input given by Laurent, Martin, Benjamin about XMLHttpRequest in Javascript, has made me think that perhaps I could improve what I am currently doing by using Ajax. Let's make it simple and schematic, to see if there is a simple Ajax answer to this. A. I have an HTML page which has some pure html/css code representing a GRID of cell. The page may also contain other objects (images, etc). B. On the server I have a windows...
2
2137
by: justplain.kzn | last post by:
Hi, I have a table with dynamic html that contains drop down select lists and readonly text boxes. Dynamic calculations are done on change of a value in one of the drop down select lists. Using Safari,my first iteration the script works fine ( indicating that there are 33 form variables ). When trying another dropdown select value, the
14
4266
by: jcage | last post by:
Is there any tutorials online for sending email through forms? I can send an email as well as write to my MySQL database from home with the following code but not at work. I think there might be something I'm missing header-wise that keeps me from making this work on my work system. I'm using Apache 1.3, PHP 4.1 (best the IT guys could do though I'm using 5.x at home), and MySQL as the database. Thanks VERY much for any help or...
0
9706
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
9579
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
10330
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...
1
10319
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10076
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7616
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5520
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...
2
3816
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2990
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.