|
You the below javascipt to check/unchekc you check box.
check
uncheck
function enabledisable(dd)
{
if (dd.options[dd.selectedIndex].text=='check')
{
document.getElementById("Checkbox1").checked=true;
}
else
{
document.getElementById("Checkbox1").checked=false;
}
}
naveen
|
|
|
|
|
where can find the code of validating xml file using xsd file in C?
|
|
|
|
|
Hi,
I have an xml feed and I want to parse the data so I can get specific items and build a datatable with all the data in it so I can display it in a datagrid. Can someone help me?
Sample of XML
<stocklist recnumb="20" listname="all" sort="matchedShares" order="desc">
<stock rank="1" symbol="SIRI">
<market>NM
<booked marketsession="allday">
<bookedshares>134434586
<bookedorders>74013
<lastorder>
<ordertime>15:05:08.493-05:00
<open>
<openshares>125542614
<openorders>1159
<matched marketsession="allday">
<matchedshares>33219895
<lastmatch>
<matchprice>6.2200
<matchtime>15:05:03.775-05:00
I only want to show, symbol, match price, and match time, thanks for reading. Any help would be helpful.
Da Intern
|
|
|
|
|
Can you modify your post? I don't see XML Tags.
DevIntelligence.com - My blog for .Net Developers
|
|
|
|
|
I have been working with XML for a while however Microsoft's approach to XML in the dotNet framework has me a little confused. I am not understanding why the XmlNamespaceManager must be used in conjunction with SelectSingleNode or SelectNodes methods of the XmlDocument object when the namespaces have already been declared in the root element of the document. It seems to me that the XmlDocument object should already be "namespace aware", in this case, and resolve any XPath expression (that includes namespace prefixes) passed to aforementioned methods. Perhaps somebody can enlighten me. TIA
David Chappell (Not the MS Press author or comedian)
|
|
|
|
|
That's really a fair question and, unfortunately, I don't have a direct answer for you. However, I can tell you a couple of things about it....
Last year, I helped the Microsoft guys put together their Sarbanes-Oxley compliance solution. Internally, they had created the XnsDocument class, a namespace aware XmlDocument -like class that, when the document's content got loaded, parsed the namespaces and put them in the namespace manager.
On the other hand, having the Microsoft setup allows for you to hardcode your own prefixes so that you don't have to worry about the literal text in the document. Consider the following code. You have two XML packets whose namespace prefixes are different. However, the namespaces themselves are the same. So, you can define your own prefix and always make the call to SelectSingleNode /SelectNodes regardless of the namespace prefix.
string xml = @"<one xmlns:goo=""goo.com"" xmlns:foo=""foo.com""><foo:two /><goo:three /></one>";
XmlDocument doc = new XmlDocument();
doc.LoadXml( xml );
XmlNamespaceManager nm = new XmlNamespaceManager( doc.NameTable );
nm.AddNamespace( "floam", "goo.com" );
nm.AddNamespace( "bar", "foo.com" );
Console.WriteLine( doc.SelectSingleNode( "//bar:two", nm ).OuterXml );
xml = @"<one xmlns:mario=""goo.com"" xmlns:luigi=""foo.com""><mario:two /><luigi:three /></one>";
doc = new XmlDocument();
doc.LoadXml( xml );
nm = new XmlNamespaceManager( doc.NameTable );
nm.AddNamespace( "floam", "goo.com" );
nm.AddNamespace( "bar", "foo.com" );
Console.WriteLine( doc.SelectSingleNode( "//floam:two", nm ).OuterXml );
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Thank you for your response, Curtis.
After posting my question, I realized, "Duh ..the XmlNamespaceManager allows us to not worry about how a particular xml document's namespaces are prefixed." ..That makes sense! I guess what doesn't make sense to me is why the XmlDocument doesn't internally use the XmlNamespaceManager according to any declared namespaces and prefixes by default. That way the XmlDocument could resolve its XPath expressions without the extra steps. Then if we wanted to use our own prefixes in our XPath expressions, we can do so with our own instance of the XmlNamespaceManager.
Again, thanks for your answer. I'm a little slow, but eventually I come around
David Chappell (Not the MS Press author or comedian)
|
|
|
|
|
I am working at SQLXML Bulk load, and i got followinf error in the connection string
SQLXMLBULKLOADLib.ISQLXMLBulkLoad failed.
-- modified at 1:21 Wednesday 18th January, 2006
|
|
|
|
|
I would like to know how i can use XML/XSL to transform a XML file into C++/C#/... code (header) files. It should be possible for structures and enumerations.
I guess that has been done before so maybe someone can point me to some samples with a XSLT file.
Thanks
|
|
|
|
|
Well, what's the format of the source XML? If you write your own XML format then you should be able to write your own XSL transform to turn it into text.
I wrote an article[^] that used the XMI format which can be exported by a lot of UML diagramming tools. I then converted that into CodeDom, which I think is more useful than a stylesheet because I can convert to VB, C#, or JScript.
Another cool way to do it is to use CodeSmith[^]. It can read a database schema and create classes, stored procedures, etc. The templates used in CodeSmith work a lot like ASP pages and can also have code-behinds. So they're much easier to use than XSL.
|
|
|
|
|
I'm trying to add some XSL to my XML page. I have checked my CXSL code with XMLSpy and it's well formed. I insert the following line which works fine when I open up the XML file on it's own:
However, when I try openoing up my whole html document, it doesn't work. The table comes up, but there's no colour, border adjustments, nothing! Why is this? I've checked websites and even a book and they all say this code is correct. I want to get my XSL inside the HTML file but for some reason it isn't letting me. I have to hand this work in tomorrow morning so please help me quick!
|
|
|
|
|
The code didn't show up for some reason, i'll try again:
"?"
Please help me!
|
|
|
|
|
This is rediculous, how do I get the code to show up? It's the "xml stylesheet type=text/xsl href="CDCatalog.xsl". I'm hoping as i've written it normally this time without any brackets it'll show up?
|
|
|
|
|
Some expert must be there to help me surely? I'm really panicking over this. Even if you don't think you're right could someone please suggest something?
|
|
|
|
|
while posting click the ignore html tags check box at the bottom of the post
hope it works
|
|
|
|
|
When you post XML/(X)HTML documents, you need to change all the < to < and > to >. Or, you can just check the "Ignore HTML tags in this message (good for code snippets)" checkbox below the textarea. If you post it again, I can take a look at it and maybe help you.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
<?xml-stylesheet type="text/xsl" href="CDCatalog.xsl"?>
This code won't work for my XML file. i don't know why. The actual table is being displayed fine but it isn't aligned to the middle and the text and border should be in colour. Hope you can help!
|
|
|
|
|
Okay, lots of things.
First, using an XML datasource in IE to populate a table (as in your HTML file) will not apply the stylesheet to the XML data. Instead, you must put your styles in the TABLE with the DATASRC.
Second, using what you posted, your stylesheet has some incorrect values in it. Remember, XML is case-sensitive. Thus, "cd" and "CD" are different. Here's a stylesheet that will do what you want for the XML file.
XSL file
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th align="left">Title</th>
<th align="left">Artist</th>
</tr>
<xsl:for-each select="/CATALOG/CD">
<tr>
<td><xsl:value-of select="./TITLE"/></td>
<td><xsl:value-of select="./ARTIST"/></td>
<td><xsl:value-of select="./COUNTRY"/></td>
<td><xsl:value-of select="./COMPANY"/></td>
<td><xsl:value-of select="./PRICE"/></td>
<td><xsl:value-of select="./YEAR"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Thank you Curtis, the code works fine I should be alright now but i'll let you know if I have anymore problems. Thanks for your help!
|
|
|
|
|
'T was my pleasure. Happy coding!
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Curtis, in case you've gone out and i'm not here by the time you reply i'll post up my whole code. Maybe you could see what's wrong?
My html file is:
<title>Untitled Document
<xml src="A:\CDCatalog.xml" id="xmldso" async="false">
Title | Artist | Country | Company | Price | Year |
---|
| | | | | |
|
|
|
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body bgcolour="#FFFFFF" text="#000000">
<xml src="A:\CDCatalog.xml" id="xmldso" async="false">
</xml>
<table datasrc="#xmldso" width="100%" border="1">
<thead>
<th>Title</th>
<th>Artist</th>
<th>Country</th>
<th>Company</th>
<th>Price</th>
<th>Year</th>
</thead>
<tr align="left">
<td><span datafld="TITLE"></span></td>
<td><span datafld="ARTIST"></span></td>
<td><span datafld="COUNTRY"></span></td>
<td><span datafld="COMPANY"></span></td>
<td><span datafld="PRICE"></span></td>
<td><span datafld="YEAR"></span></td>
</tr></table>
</body>
</html>
|
|
|
|
|
</CD>
- <CD>
<TITLE>Voodoo Child</TITLE>
<ARTIST>Jimmy Hendrix</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>Columbia</COMPANY>
<PRICE>9.99</PRICE>
<YEAR>2000</YEAR>
</CD>
<CD>
<TITLE>The Wall</TITLE>
<ARTIST>Pink Floyd</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>A and M</COMPANY>
<PRICE>14.99</PRICE>
<YEAR>1986</YEAR>
</CD>
<CD>
<TITLE>London Calling</TITLE>
<ARTIST>Clash</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>Virgin</COMPANY>
<PRICE>13.99</PRICE>
<YEAR>1984</YEAR>
</CD>
<CD>
<TITLE>Hotel California</TITLE>
<ARTIST>The Eagles</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>Island</COMPANY>
<PRICE>9.99</PRICE>
<YEAR>1990</YEAR>
</CD>
<CD>
<TITLE>Shout</TITLE>
<ARTIST>Tears For Fears</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>Columbia</COMPANY>
<PRICE>12.99</PRICE>
<YEAR>1984</YEAR>
</CD>
<CD>
<TITLE>Blue Monday</TITLE>
<ARTIST>New Order</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>A and M</COMPANY>
<PRICE>10.99</PRICE>
<YEAR>1987</YEAR>
</CD>
<CD>
<TITLE>Singles</TITLE>
<ARTIST>The Smiths</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>Virgin</COMPANY>
<PRICE>12.99</PRICE>
<YEAR>1996</YEAR>
</CD>
<CD>
<TITLE>She Sells Sanctuary</TITLE>
<ARTIST>The Cult</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>Island</COMPANY>
<PRICE>14.99</PRICE>
<YEAR>1989</YEAR>
</CD>
</CATALOG>
|
|
|
|
|
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th align="left">Title</th>
<th align="left">Artist</th>
</tr>
<xsl:for-each select="catalog/cd">
<tr>
<td><xsl:value-of select="Title"/></td>
<td><xsl:value-of select="Artist"/></td>
<td><xsl:value-of select="Country"/></td>
<td><xsl:value-of select="Company"/></td>
<td><xsl:value-of select="Price"/></td>
<td><xsl:value-of select="Year"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
|
|
|
|
|
Hi,
When I try to open an xml with the following it fails if the xml file contains certain characters. At this point it is failing on on the "&" character.
Is there a way to have these characters ignored?
Dim xdoc As XPathDocument = New XPathDocument(filePath)
Thanks,
Zenu
|
|
|
|