|
Nah, that would be too... logical!
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
Hi All
Is it possible to access xml with javascript.If Yes then someone would please help me with the code
Thanks
Karan
|
|
|
|
|
wrote: Is it possible to access xml with javascript.
What exactly do you mean with that? Do you want to read an XML file? AFAIK this is not posssible.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Yes, it is possible.
You can use AJAX to download/upload xml data from/to remote server.
If you want XML parsers, google for "Sarissa" and "XML for SCRIPT" Javascript libraries.
-------------------------
Don't worry, be happy )
|
|
|
|
|
XML FILE
--------
<company>
<employee id="001" sex="M" age="19">Premshree Pillai
<employee id="002" sex="M" age="24">Kumar Singh
<employee id="003" sex="M" age="21">Ranjit Kapoor
<turnover>
<year id="2000">100,000
<year id="2001">140,000
<year id="2002">200,000
In InLine Code:
--------------
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
function loadXML(xmlFile)
{
xmlDoc.async="false";
xmlDoc.onreadystatechange=verify;
xmlDoc.load(xmlFile);
xmlObj=xmlDoc.documentElement;
alert(xmlObj.xml);
}
function verify()
{
// 0 Object is not initialized
// 1 Loading object is loading data
// 2 Loaded object has loaded data
// 3 Data from object can be worked with
// 4 Object completely initialized
if (xmlDoc.readyState != 4)
{
return false;
}
}
In CodeBehind
--------------
create one Button then
In Page_Load write this
Button1.Attributes.Add("onclick", "return loadXML('Sample.xml')")
from my Knowledge i wrote this
regards
kamal
|
|
|
|
|
Hi, I'm creating wordml file with xsltransform. I need to get some images from my localhost. When I write http://localhost/images/...jpg in the wordml file there is no problem. But I wrote in the xsl like: <xsl:value-of select="string('http://localhost/images/....jpg')"> she says "Missing mandatory attribute 'select'. In the same way, I wrote <xsl:value-of select="url('http://localhost/images/....jpg')"> same thing happened. How can I get these images? Thanks...
Savas
|
|
|
|
|
savasorama wrote: When I write http://localhost/images/...jpg in the wordml file there is no problem.
So why don't you just write the url into the wordml file.?
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
because I'm generating xsl with code and then transforming to wordml. I wrote this url while debugging. So I need xsl:value-of
Savas
|
|
|
|
|
Ok, but do I understand right that finally at some place in the wordml document a URL should occur?
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Yes you're right. What should I write into the xsl to generate url in the wordml?
Savas
|
|
|
|
|
Simply writing the URL should be sufficient (will be copied as it is into the output).
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Writing only the URL is not sufficient. When I did this it said 'http://localhost.....' is not a valid XPath. So I tried string('http://....'). Finally I tried;
<xsl:variable name="value">
<xsl:value-of select="Attributes/RMFileTypeRel_FileTypeImage"/>
</xsl:variable>
<xsl:value-of select="concat('http://localhost/images/', $value)"/>
but still says mandatory attribute select is missing...
Savas
|
|
|
|
|
I did mean you should simply write it without the xsl:value-of. You already have the URL so what should be selected.
<xsl:variable name="value">
<xsl:value-of select="Attributes/RMFileTypeRel_FileTypeImage"/>
</xsl:variable>
concat('http://localhost/images/', $value)
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cookwww.troschuetz.de
|
|
|
|
|
Yeah I got it These two worked now. My last and yours. Actually the problem was silliness of ex-writers!! Variable names was like varValue1, varValue2, xslAtt1, xslAtt2-3..... I changed these silly names and problem appeared clearly Thank you so much for your help. I'll disturb you on another problem
Savas
|
|
|
|
|
i am trying to write around 70,000 sql table data to XML in ASP.Net, but i am not able to get more than 4500 record in XML. What could be the problem, is there any solution for this problem ???????
|
|
|
|
|
What are you using to create the XML? If you are using the XmlDocument type you probably run out of memory.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
I have some XML tags stored in a string. This data is obtained through remoting.
I want the same to be displayed on an HTML page by using a Respose.Write. When I do a Response.write of the string then it loses its XML format and just displays as string alone.
Could I know how to display the same in XML format itself.
I tried using REsponse.ContenType = "text/xml", But this is giving me an error
|
|
|
|
|
anufabian wrote: But this is giving me an error
What error?
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
It gives me the following error ::::
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------------------------------------------------------------
Cannot have a DOCTYPE declaration outside of a prolog. Error processing resource 'http://localhost/WebApplication10/WebForm...
----------^
|
|
|
|
|
Try calling the Clear method before writing the XML string to make sure the HTTP response contains nothing else.
Response.ContenType = "text/xml";
Response.Clear();
Response.Write(xmlString);
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
I am still getting the same error.
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------------------------------------------------------------
Cannot have a DOCTYPE declaration outside of a prolog. Error processing resource 'http://localhost/WebApplication10/WebForm...
----------^
I assume that the line DOCTYPE HTML... is the firsy line written on an aspx page . Is this causing the problem. I tried to save the xml in a file , it works fine. However my requirement is to display the XML on an aspx page , along with the look and feel of XML .
|
|
|
|
|
anufabian wrote: However my requirement is to display the XML on an aspx page
Ah, I thought you want to send back the pure XML. My fault.
Take a look at the System.Web.UI.WebControls.Xml control and the continuative links in its documentation. I think they should help you to achieve what you want.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
The above technique did not help me. However I was able to solve the issue by using something like this.
Response.Write("<xmp>" + outputstring + "/xmp>");
This i got it from some one else. However I still dont understand what is the use of <xmp> tag.
If possible could you throw some light on this.
|
|
|
|
|
"The XMP tag displays a sequence of literal characters in the browser's default fixed-width font. The XMP element displays all white space and line breaks exactly as they appear inside the <xmp> and tags." (HTML Tag Reference[^])
Another resource (SelfHTML[^]) said that the xmp tag is no longer a part of the HTML standard. Though they are still supported by current browsers, one should not count on this. The resource suggests of instead using the pre tag. Since the pre element interprets HTML tags, you must use special symbols for any character that has a meaning in HTML that you wish to be displayed rather than interpreted. For example, use &< for the < symbol, and use &> for the > symbol.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Please help me to write code to establish the connection to SQL Server 2005 database in C#.net(VS 2005) windows application. Also I need to write select statements to retrieve data from the databse which is XML type.
Sanjeewani
|
|
|
|