|
You can use xsl to render your xml in html format very easily.
I didn't understand what do you mean by embedded images.I think xml file would e conaining some relative path of the images and images are in a specified folder on a specific location.
Cheers!!
Brij
|
|
|
|
|
I've followed a simple example to load an xml file into a table using 'httprequest'. I know my way around code, but this is my first time coding a webpage in 6 years, a 'quicky temp replacement' for a small business website catalog. I'm a hapless newbie once again.
The below code worked fine with a sample xml file I made (one with only two records), but when I exported the full file from a database it only returned one line in the table (the xml files have the exact same structure, only more entries).
Also, when using this in Firefox it never stops loading. And eventhough there is a clause to make it work with IE, it doesn't.
Any help is appreciated, even if it is a complete alternative way of tackling this ... rather basic thing ...
The code:
<html>
<head>
<script type="text/javascript">
var xmlDoc;
if (window.XMLHttpRequest)
{
xhttp=new XMLHttpRequest();
}
else
{
xhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xhttp.open("GET","Cat2.xml",false);
xhttp.send("");
xmlDoc=xhttp.responseXML;
var x=xmlDoc.getElementsByTagName("FMPDSORESULT");
function display()
{
document.write("<table border='0'>");
var x=xmlDoc.getElementsByTagName("ROW");
for (i=0;i<x.length;i++)
{
document.write("<tr><td>");
document.write("<a href=");
document.write(x[i].getElementsByTagName("IMG")[0].childNodes[0].nodeValue);
document.write(">");
document.write("<img src=");
document.write(x[i].getElementsByTagName("THUMB")[0].childNodes[0].nodeValue);
document.write("/></a>");
document.write("</td><td>");
document.write(x[i].getElementsByTagName("DESCRNL")[0].childNodes[0].nodeValue);
document.write("</td><td>");
document.write(x[i].getElementsByTagName("DESCRFR")[0].childNodes[0].nodeValue);
document.write("</td></tr>");
}
document.write("</table>");
}
</script>
</head>
<body>
<button onClick="display()">VINDICATION</button>
</body>
</html>
The xml file (one entry)
<?xml version="1.0" ?>
<FMPDSORESULT>
<ROW MODID="15" RECORDID="27599">
<DESCRFR></DESCRFR>
<DESCRNL>
Een polychrome art deco vaas van zachte pasta. Onderaan gemerkt.
</DESCRNL>
<DIM>
(11 cm)
</DIM>
<EST>
€ 25/30
</EST>
<THUMB>
"
Images/pics/Thumb/008_thumb.jpg
"
</THUMB>
<IMG>
"
Images/pics/008.jpg
"
</IMG>
<AUTEUR>
A. Dubois
</AUTEUR>
</ROW>
|
|
|
|
|
Your problem is the empty DESCRFR node - the line
document.write(x[i].getElementsByTagName("DESCRFR")[0].childNodes[0].nodeValue);
is throwing an exception.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi Greth,
Try it.
<html>
<head>
<script type="text/javascript">
var xmlDoc;
if (window.XMLHttpRequest)
{
xhttp=new XMLHttpRequest();
}else
// Internet Explorer 5/6
{
xhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xhttp.open("GET","Cat2.xml",false);
xhttp.send("");
xmlDoc=xhttp.responseXML;
var x=xmlDoc.getElementsByTagName("FMPDSORESULT");
function display()
{
if(xhttp.readyState==4 && xhttp.status == 200)
{
var xmlDoc=xhttp.responseXML;
var x=xmlDoc.documentElement.getElementsByTagName("FMPDSORESULT");
try
{
var _txt="<table border='0'>";
var x=xmlDoc.documentElement.getElementsByTagName("ROW");
for (i=0;i<x.length;i++)
{
_txt+="<tr><td>";
_txt+="<a href=";
try{_txt+=x[i].getElementsByTagName("IMG")[0].childNodes[0].nodeValue;}catch(exp0){};
_txt+=">";
_txt+="<img src=";
try{_txt+=x[i].getElementsByTagName("THUMB")[0].childNodes[0].nodeValue;}catch(exp0){};
_txt+="/></a>";
_txt+="</td><td>";
try{_txt+=x[i].getElementsByTagName("DESCRNL")[0].childNodes[0].nodeValue;}catch(exp0){};
_txt+="</td><td>";
try{_txt+=x[i].getElementsByTagName("DESCRFR")[0].childNodes[0].nodeValue;}catch(exp0){};
_txt+="</td></tr>";
}_txt+="</table>";
document.getElementById('_DIV').innerHTML=_txt;
}catch(exp){alert(exp.message);}
}
}
</script>
</head>
<body>
<button onclick="display()">VINDICATION</button>
<div id="_DIV"></div>
</body>
</html>
|
|
|
|
|
Hello Dear Members,
I was wondering if there is some standards regarding the data transfers in xml format to be followed by Business-to-Business applications?
By Business-to-Business I mean, the process of consuming one web-service by any other business application.
My actual requirement is to host a webservice which will provide the data available in a .net DataSet variable in XML format, so we were looking for some industry standard specifications regarding the data in xml format?
Regards,
Anuj Chauhan
0091 9313499294
anuj.mca@gmail.com
http://in.linkedin.com/in/anujchauhan
|
|
|
|
|
anuj_mca wrote: Anuj Chauhan
0091 9313499294
anuj.mca@gmail.com
http://in.linkedin.com/in/anujchauhan
Wow! a treat for spammers.
Yes there are XML standards which are followed when you are sending/recieving XML data. Although they depend on the kind of industry you are working on. I would suggest to search "[your indusrty domain] xml standards". I am sure it would give you a lot of useful results.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Hi
I am trying to store the xml data into the SQL database. The xml data that is am getting is through the xml file. I upload the xml file. When i click update, it should get updated into the database. Can anyone give me some ideas on how to do this.
Thanks
KSR
|
|
|
|
|
Use an xml datatype for the column and just do an insert, the same as any other data.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Hi, I have recently been using XSL and need to integrate the modal popup control inside. Can anybody provide an example of this please?
I'm not sure if it's possible of whether or not I can reference the AJAX toolkit from XSL.
Thanks
|
|
|
|
|
Please lwt me know if is there any way for sending and collecting Xml files between computers in order to be inmediately processed by the receptor at the arrival.
Best Regards
|
|
|
|
|
FJJCENTU wrote: Please lwt me know if is there any way for sending and collecting Xml files between computers in order to be inmediately processed by the receptor at the arrival.
The most basic communication method is direct TCP or UDP using sockets. If this is between Windows systems you should be able to use WCF.
|
|
|
|
|
Hi friends,
I am newbie to xml, i am writing xml file using xmlTextWriter Class of System.Xml namespace. i am able to write the contents in to an xml file but the problem here is that i want to embed images in to xml file. right now i am using
<img src="path"/>
but this will give u the link but i want to embed images directly in to xml file
Please share ur ideas
Thanks in advance
|
|
|
|
|
You can Base64 encode the image and put the encoded string between the tags:
<img encoding="base64">Encoded string</img> Be aware that Base64 encoding causes an increment of the file size of about 33%, so you should only embed small images inside the XML.
|
|
|
|
|
hi me too having the same problem and tried converting the image to base64. But still the image didn't displayed in the final Output.
I want display an image in xml Spreadsheet.any suggestions?
Thanks in advance.
|
|
|
|
|
What is your problem? What language are you using?
In C# it's simple to convert a byte[] to a base64 string:
string result = System.Convert.ToBase64String(source); Then you can assign the string to the InnerText property of your XmlElement .
|
|
|
|
|
Actually i want to display an image in XML spreadsheet. Will this work in XML spreadsheet?
|
|
|
|
|
Are you trying to insert images into an Excel (XML Spreadsheet) file?
I don't know how to do it, try to look at the documentation[^].
|
|
|
|
|
Good Day
I have an XML attached in the following zipped file
and i read it like this in C#
http://www.vbforums.com/attachment.php?attachmentid=74357&d=1258368852[^]
and i read it like this in C#
DataSet ds1 = new DataSet();
StringReader rdr = new StringReader(xmlstr.ToString());
ds1.ReadXml(rdr);
and i get the Following Error
'_Chairs' is an unexpected token. The expected token is '='. Line 1, position 545.
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Vuyiswa Maseko wrote: and i get the Following Error
'_Chairs' is an unexpected token. The expected token is '='. Line 1, position 545.
Well it took me less than twenty seconds to find this token, plainly showing the syntax error. Did you try the same?
|
|
|
|
|
i found the Problem. The name of the Attribute was Desks_&_Chairs
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
I,
I am trying to use XQuery on XML data and elaborated samples are few on the web. I only find small tutorials for beginners.
Here is the query specification :
> it's a list of "vehicle";
> each "vehicle" has "flags" nodes;
> each "vehicle" is identified by a unique numeric "id" attribute;
> I want to find the lowest id verifying a list of flags ;
Here is a sample of data :
?xml version="1.0" encoding="UTF-8"?
vehicles
vehicle id="1"
flags
flag1/
flag2/
/flags
/vehicle
vehicle id="5"
flags
flag1/
flag2/
/flags
/vehicle
/vehicles
Here a sample of query on one flag :
(: smallest index index
let $d := doc( $inputDocument)//vehicle
let $e := $d/flags/flag1
return
min( $e/../../fn:number( @id))
How to process for several flags, with "and" and "or"....
Best regards
|
|
|
|
|
Hi ,
In my web application(devloped using spring framework and purely java) i have to tranform the xml data (I am getting xml from 3rd party) into the RDBMS table records of my application. Structure of both XML and table is different so its not one to one mapping. Can anybody please tell me what's the best way to do that?
Regards
Rishi Saraf
|
|
|
|
|
Hello,
I want to know what is the xpath expression when there is a space in attribute name.
e.g. /Employee/*[@Employee Name='name']
"Employee Name" is attribute name.
Thanks,
Aniruddha
|
|
|
|
|
If you have spaces in element names or in attribute names, then what you have **IS NOT XML**. XML doesn't allow spaces in element or attribute names. See the specification for names[^] (which is used for element and attribute names) in the XML spec.
So therefore, your question can only be answered logically with this statement: get rid of the spaces form your attribute names.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Aniruddha,
Just check the spec, there is no such thing as attribute names with spaces. Validation of a corresponding document should fail.
Best regrads,
Stefan
|
|
|
|