|
Hi guys,
I have a xml document as below and in Xslt I need to get the person name on the basis of email id as in below xml file , contributor node contain email id and associated name is included in Epic node can any body help me to get the name for each contributor through xpath?
<ONIXMessage>
<Product>
<Contributor>
<Email>Rohit@gmail.com</Email>
</Contributor>
</Product>
<Product>
<Contributor>
<Email>Rohit@gmail.com</Email>
</Contributor>
</Product>
<Epic>
<Person>
<Name>Rohit</Name>
<Email>Rohit@gmail.com</Email>
</Person>
</Epic>
</ONIXMessage>
|
|
|
|
|
This XPath will get you the name of the first contributor:
I don't think you can get all the names in one go with XPath.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I really don`t understand schemas namespaces and reading books also not clear my mind. My questions are:
- what's the difference between xmlns and targetNamespace
- if I change the targetNamespace of the schema pointing to one urn of my own all schema, which before was working, start having errors, I thought that targetNamespace point to one opaque urn and taht you can change it?.
- also some books mention that if you are to validate a Xml file with a schema the elements of both files must belong to the sames namespace, but the only way I get validation working is if I don´t set any namespace in the Xml file.
Please could somebody explain me shortly the rules for this schema namespace or some link where it's clearly explained, no so ambiguous explanations as I found until now.
Best Regards
|
|
|
|
|
1. xmlns
xmlns is described here: http://www.w3schools.com/XML/xml_namespaces.asp[^]
We can read there:
When using prefixes in XML, a so-called namespace for the prefix must be defined.
And the example: <h:table xmlns:h="http://www.w3.org/TR/html4/">
The xmlns defines what h prefix means. It must be in the XML document.
2. targetNamespace
You can read about it here: http://www.w3schools.com/schema/el_schema.asp[^]
It's used in XML schemas. We can read there:
targetNamespace - Optional. A URI reference of the namespace of this schema
That's the defference between them.
PS. In the XML schamas there's a line:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
By this xmlns, you define what xs prefix means, so this means that you shouldn't change it.
|
|
|
|
|
Just a open question. I have seen the codes like asp/xml admin to add delete and modify data in an xml. from that I created milti xml files like in an MSaccess where one has multi tables linked by a keyID from table to table, the same way even excel can be linked from sheet to sheet but are still seperate sheets.
That has worked out really well. I have written my own multi-file menu navigation xml that spans over to a record xml to display data and images. that you can see how well over 10,000 images are displayed with around 1000 navigation links at www.wartimepress.com
The next thing I am working towards is making a multi user xml portal database and login. I have one done but took a moment to ponder upgrading my code to aspx. However I have not seen any samples or examples that show how to pass url values where aspx can get them and filter a xml to match and sort via a value.
So many so called examples have been removed from the web, or are becoming outdated. and if one does find a code it mostly is not secure in hidding your file location where a person can reverse hack locations and file structures. also 90% of code examples are sql DB not xml. the last 10% is add delete modify display xml in aspx, but I have not found anything but C or VB examples how to make a pull down or radio buttons and even those codes dont show how to select a value and reload a new xml and filter for say "navy" then display match records with the value passed to a xslt.
Well is apsx all that, or is it still going to take a few years for it to do what asp does already? is you take a look at wartimepress.com you can see where the navigation to the left selects a value from a xml file then via the url redisplay any match records from another file in the content center of the page via xslt.
Thanks if any one has seen aspx code that does the same. and a simple multiuser xml starter code in XML not sql.
--------
my code is in classic asp,
url xml navigation selects "name_value" into a url
that url select string passed to asp to xslt to display records.
---
I also have many other xml cods which randomly display banners and count impressions and clicks show from other site locations where the code has been placed. I have not expanded it to show unique visitor per click from sites yet.
----
I also have another site where I am working on my own genealogy xml standard to display records but the multi user and level access per user is my hold up at the moment.
modified on Friday, December 4, 2009 10:06 PM
|
|
|
|
|
I want create an application which collect Xml Files containig embedded images and create autmaticly a Html Page showing the contained images, I am thinking about XSL.
please any suggestion
|
|
|
|
|
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?
|
|
|
|