xml inline html

Michael Hill

Usenet Archive
Joined
Mar 4, 2003
Messages
141
Reaction score
0
I was wondering if it is possible to include a xml structure in your html document.

For example given the below snippet the function "dothis" will return 0 and "dothat" will return 1.

If I can use xml in html I should be returning 1 for both functions.

Thanks,

Mike

<script>
function dothis
{
var xxx = document.getElementById('xmlid');
alert(xxx.childNodes.length);
}
function dothat
{
var xxx = document.getElementById('tblid');
alert(xxx.childNodes.length);
}
</script>

<xml id="xmlid">
<data>
<first>abc</first>
</data>
</xml>

<table id="tblid">
<tr>
<td>abc</td>
</tr>
</table>
 

Tjerk Wolterink

Usenet Archive
Joined
Sep 18, 2004
Messages
218
Reaction score
0
Michael said:
I was wondering if it is possible to include a xml structure in your html document.

For example given the below snippet the function "dothis" will return 0 and "dothat" will return 1.

If I can use xml in html I should be returning 1 for both functions.

Thanks,

Mike

<script>
function dothis
{
var xxx = document.getElementById('xmlid');
alert(xxx.childNodes.length);
}
function dothat
{
var xxx = document.getElementById('tblid');
alert(xxx.childNodes.length);
}
</script>

<xml id="xmlid">
<data>
<first>abc</first>
</data>
</xml>

<table id="tblid">
<tr>
<td>abc</td>
</tr>
</table>

I think it is possible in xhtml 1.0 strict, but you should define an namespace for the non-xhtml elements. I do now know if document.getElementById is possible, i think the getElementById method in the DOM is html only. You should check W3C DOM if getElementId is also defined for plain xml
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,042
Messages
3,104,223
Members
248,131
Latest member
Tonypshaw1

Latest Threads

Top