• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XML Scripting is not working

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,
My problem is that when i am writing a XML code ...it is running quite easyly.
But...when i am Scripting it ...it is not working in my browser
(IE 5.5).It is giving no OUTPUT.
But..I am sure that my Scripting code is right.
I don't know what 2 do ...pls..help me.
<marquee> Ratul Banerjee </marquee>
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why don't you give us your XML and XSL data?? That might help us figureout what is happening.
------------------
Ajith Kallambella M.
Sun Certified Programmer for the Java2 Platform.
 
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You might be doing stuff that is not supported yet by any browser. Best way to tell is to post the code.
------------------
I wish there was a button on my monitor to turn up the intellegince.
Theres a button called 'brightness' but it doesn't work
 
Ajith Kallambella
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, IE is not 100% XSL/XSLT compliant. ie., it doesn't show any output if your XSL uses some complicated constructs..
------------------
Ajith Kallambella M.
Sun Certified Programmer for the Java�2 Platform.
 
Rat Ban
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The original xml code is:
code:
____________________________________________________________________
<?xml version="1.0" standalone="yes"?>
<!DOCTYPE CATALOGS [
<!ELEMENT CATALOGS (BOOK)*>
<!ELEMENT BOOK (BOOKNAME,AUTHORNAME,ISBN,PUBLISHER,PAGES?,PRICE)>
<!ELEMENT BOOKNAME (#PCDATA)>
<!ELEMENT ATHORNAME (#PCDATA)>
<!ELEMENT ISBN (#PCDATA)>
<!ELEMENT PUBLISHER (#PCDATA)>
<!ELEMENT PAGES (#PCDATA)>
<!ELEMENT PRICE (#PCDATA)>
<!ATTLIST PRICE CURRENCY CDATA #REQUIRED>
]>
<CATALOGS>
<BOOK>
<BOOKNAME>clouds</BOOKNAME>
<AUTHORNAME>jees auth</AUTHORNAME>
<ISBN>1-1200-098-78</ISBN>
<PUBS>work press</PUBS>
<PAGES>393</PAGES>
<PRICE>
<ATTLISTPRICECUURENCY>46.98</ATTLISTPRICECUURENCY>
</PRICE>
</BOOK>
<BOOK>
<BOOKNAME>ASP</BOOKNAME>
<AUTHORNAME>RAT</AUTHORNAME>
<ISBN>2-23-78-98-9000</ISBN>
<PUBS>work press</PUBS>
<PAGES>390</PAGES>
<PRICE>
<ATTLISTPRICECUURENCY>789.00</ATTLISTPRICECUURENCY>
</PRICE>
</BOOK>
</CATALOGS>
_________________________________________________________________
and the scripting code is:
______________________________________________________________________
<html>
<head>
<SCRIPT LANGUAGE="JAVASCRIPT" FOR="window" EVENT="onload" >
function loadxmldata()
{
var xmlDoc=new ActiveXObject("microsoft.xmldom")
doc.load("catalogs.xml")
var root=xmlDoc.documentElement
var book1=root.childNodes.item(0)
var book2=root.ChildNodes.item(1)
alert("BOOK1:" +book1.ChildNodes.item(0).text)
alert("BOOK2:" +book2.ChildNodes .item(0).text)
}
</SCRIPT>
<BODY bgcolor="red">
<TITLE>BOOK NAMES ALERT AND PRINT</TITLE>
</head>
<DIV ID="d" STYLE="font-weight:bold; color:white; font-size:16">
B O O K 1 NAME:
<SPAN ID="book1" STYLE="color ink"></SPAN>
</DIV>
</BODY>
</html>

_______________________________________________________________
Now...can u pls. explain me ...why this scripting is not working at all??

<marquee> Ratul Banerjee </marquee>
*************THANKS IN ADVANCE********************************

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
hope this works.
i have removed the dtd.
your xml document
<?xml version="1.0" standalone="yes"?>
<CATALOGS>
<BOOK>
<BOOKNAME>clouds</BOOKNAME>
<AUTHORNAME>jees auth</AUTHORNAME>
<ISBN>1-1200-098-78</ISBN>
<PUBS>work press</PUBS>
<PAGES>393</PAGES>
<PRICE>
<ATTLISTPRICECUURENCY>46.98</ATTLISTPRICECUURENCY>
</PRICE>
</BOOK>
<BOOK>
<BOOKNAME>ASP</BOOKNAME>
<AUTHORNAME>RAT</AUTHORNAME>
<ISBN>2-23-78-98-9000</ISBN>
<PUBS>work press</PUBS>
<PAGES>390</PAGES>
<PRICE>
<ATTLISTPRICECUURENCY>789.00</ATTLISTPRICECUURENCY>
</PRICE>
</BOOK>
</CATALOGS>
and the html file is

<html>
<head>
<SCRIPT LANGUAGE="JAVASCRIPT">
function loadxmldata()
{
var xmlDoc=new ActiveXObject("Microsoft.XMLDOM")
xmlDoc.async=false;
xmlDoc.load("catalogs.xml");
alert("hi");
alert("root node name :"+xmlDoc.documentElement.nodeName);
alert("BOOK1:" +xmlDoc.documentElement.firstChild.nodeName);
alert("book1: another form "+xmlDoc.documentElement.childNodes(0).nodeName);
alert("BOOK2:" +xmlDoc.documentElement.childNodes(0).nodeName);
alert("child node length :"+xmlDoc.childNodes.length);
alert("book1 xml :"+xmlDoc.documentElement.childNodes(0).xml);
alert("length of book node :"+xmlDoc.documentElement.childNodes(1).xml);
alert("length of book1 "+xmlDoc.documentElement.childNodes(0).childNodes.length);
alert("length of book2 "+xmlDoc.documentElement.childNodes(1).childNodes.length);
for(i=0;i<xmlDoc.documentElement.childNodes.length;i++)
{
for(j=0;j<xmlDoc.documentElement.childNodes(i).childNodes.length;j++)
{
alert("book name :"+i+" "+xmlDoc.documentElement.childNodes(i).childNodes(j).nodeName+" nodevalue : "+xmlDoc.documentElement.childNodes(i).childNodes(j).text);
}
}
}
</SCRIPT>
<TITLE>BOOK NAMES ALERT AND PRINT</TITLE>
</head>
<BODY bgcolor="red" onload=loadxmldata();>

<DIV ID="d" STYLE="font-weight:bold; color:white; font-size:16">
B O O K 1 NAME:
<SPAN ID="book1" STYLE="color ink"></SPAN>
</DIV>
</BODY>
</html>
bye
prabhu
 
Rat Ban
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi prabhu palanisamy,
Thank u very much.
It's working now.I don't understand the logic ..why ur prog. is running fine,not mine !!!
U cut off the DTD 4rm the XML code.Is DTD not required?
Any way..If u explain me why and how this is heppening ..that will be so nice of u.
one more time,,,THANKS.
Ratul Banerjee.
 
There will be plenty of time to discuss your objections when and if you return. The cargo is this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic