jQuery in Action, 3rd edition
The moose likes XML and Related Technologies and the fly likes Simple XML, DTD, JavaScript probelems Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Simple XML, DTD, JavaScript probelems" Watch "Simple XML, DTD, JavaScript probelems" New topic

Simple XML, DTD, JavaScript probelems

Doshi Milan
Ranch Hand

Joined: May 29, 2001
Posts: 112
Hello Friends,
Please help me by answering any of these three small problems in XML\DTD:
1) How to write the escape sequence in XML.
for e.g: if I want to write
<Company> Shyam & sons</Company>
Naturally it is not accepting the '&' sign. '&' is the reserved symbol for Entities and hence the prob.What should I do?
2)I have an external parsed entity in my XML file, main.xml, as under:
<reply> &EP; </reply>
In my DTD the external parsed entity EP is referencing to another XML file , say demo.xml. This file which is referred to is having its own DTD structure.
Hence when I try to see main.xml it gives me the error that there cannot be two DOC structures and so on. This is because of the second DTD , i.e the DTD of demo.xml.
So what am I supposed to do ?
3) I am using JavaScript in my XML document called dailyRates.xml as follows:
var xmlDoc=new ActiveXObject("microsoft.xmldom");
which , ofcourse loads the dailyRates.XML and I can use the Document Object model as I want.
But the probelem is that now I will be generating the XML document dailyRates.xml on the fly ( using Java ).
Within the file which is to be generated how will I pass the reference of the XML document.
i.e : what should I write xmlDoc.load(...???..);
I also want advice if the way I am using to load the XML document for use in javaScript , i.e new ActiveXObject....etc, is Ok. I mean any other suggestions?
Please reply to any of the qtns at the earliest and oblige,
Thanks in advance,
Milan Doshi
Ambrose Tati
Ranch Hand

Joined: Oct 03, 2000
Posts: 55
Hi Milan,
There's an XML predifined entity for &
called amp. Make sure you use
the correct syntax for entities.
i.e: &<entity name>;
It should sort you out.
Ambrose Tati

[This message has been edited by Ambrose Tati (edited August 02, 2001).]
Ganesh Ram
Ranch Hand

Joined: Jul 20, 2001
Posts: 33
& is &
Ganesh Ram
Ranch Hand

Joined: Jul 20, 2001
Posts: 33
About Question 3. You could put your ActiveX code in a ASP and pass the url that produces the XML as the input to the ASP.
So the ASP would run the URL , get the XML and do whatever it has to do.
We have used some thing like this before but for a different purpose.
Doshi Milan
Ranch Hand

Joined: May 29, 2001
Posts: 112
Thanks Ambrose and Ganesh,
The first one I have sorted out but for the second and third, any help please.
Ganesh, I am using Java and hence can you explain me in detail how do I get the reference of the XML document generated on the fly, (i.e Qtn 3 in my first quote).
Thanks and regards,

Milan Doshii
Have you checked out Aspose?
subject: Simple XML, DTD, JavaScript probelems
It's not a secret anymore!