|
Hey,
I want to beable to generate an XML document describing my textbox's properties, button or any other control. Can anyone give me the code or help? I tried to use the System.Xml.Serialize but it says it does not support buttons.gettype method
-- modified at 2:20 Thursday 9th February, 2006
|
|
|
|
|
am using the current code to make my script compatible to firefox and netscape.....but its not workin...can som1 suggest an alternative
if (window.ActiveXObject)
{flag=0;
var xmlDoc=new ActiveXObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.load(cool)
if (xmlDoc.parseError.errorCode != 0)
{
var myError = xmlDoc.parseError;
}
else
{
parse1(xmlDoc.documentElement.childNodes(0).text,xmlDoc.documentElement.childNodes(1).text)
}
}
else if(document.implementation && document.implementation.createDocument)
{flag=1;
var xmlDoc=document.implementation.createDocument("","doc",null);
xmlDoc.async=false;
loaded=xmlDoc.load(cool);
if(!loaded)
{
alert("Error");
}
else
{//alert("success")
alert(xmlDoc.documentElement.childNodes.item(1).childNodes.item(0).nodeValue);
xmlDoc.onload=parse1(xmlDoc.documentElement.childNodes.item(1).childNodes.item(0).nodeValue,"http://www-scf.usc.edu/~csci571/2006Spring/hw4/hummer.xml");
}
}
}
function parse1(file1,file2)
{
if(flag==0)
{
var doc=new ActiveXObject("Microsoft.XMLDOM")
doc.async="false"
doc.load(file1)
var doc1=new ActiveXObject("Microsoft.XMLDOM")
doc1.async="false"
doc1.load(file2)
}
else
var xml=document.implementation.createDocument("","doc1",null);
//alert(xml)
xml.async=false;
loaded=xml.load(file1);
var xml1=document.implementation.createDocument("","doc2",null);
xml1.async=false;
loaded2=xml1.load(file2);
|
|
|
|
|
Hello all, i have a windows application which needs a small database (each
record has 7 items) and i am thinking as using xml as database. I will need to
add, delete, update the records (and show them ofcourse in a datagrid). Is there
any documentation (article or sample code) to look at?
Thanks a lot
Knowledge is a power.
|
|
|
|
|
Using xml as database in the simplest sense is basically storing data as text file in xml format (that is, unless you're using SQL Server 2005 to store your xml).
What you need to learn is XPath, and more specifically XQuery. These are comparable to understanding SQL syntax to manipulate database.
The XmlDocument class provides you several functions to load and save text files, and to manipulate xml nodes within.
I believe the ToDoList[^] application in CodeProject uses Xml to store data, if you want to look at a sample project.
Hope that helps
Edbert
Sydney, Australia
"A day without sunshine is like, you know, night."
-- modified at 0:39 Tuesday 7th February, 2006
|
|
|
|
|
|
Hello!!
I have created an XML document programmatically using DOM and MSXML4.
As one of the data items I have added byte data which is actually a processed guid.
Now combination of characters generated as GUID and stored as byte format in the xml document, is shown properly. But for some combination when I open the document it says "An invalid character was found in text content" and the document fails to display any data.
This happens in Windows 2000 and I have seen this once or twice in Windows 2003. The "corrupt" file opens without any problem in Windows XP.
I am using encoding UTF-16.
IE Versions I am using are:
In Windows 2000 6.0.2800.1106 – SP1
In WinXP 6.0.2900.2180 – SP2
Can someone help!!!
Sandeep
|
|
|
|
|
I am trying to figure out how to post a memory buffer which is composed of an XML document, to a ASP page and I am getting a specific error that I am not sure why its throwing. The error is "not all code paths return a value." Below is the code, Is there someone here that can point out my mistake?
Many thanks in advance.
--Derk
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
public class UTSPost
{
private const string BASE_URI = "http://Post/_Update.asp";
public string PostToWS(XmlDocument xmldoc)
{
string uriString = BASE_URI;
// Create a new WebClient instance.
WebClient myWebClient = new WebClient();
string postData = xmldoc.ToString();
// Apply ASCII Encoding to obtain the string as a byte array.
byte[] postArray = Encoding.ASCII.GetBytes(postData);
System.Windows.Forms.MessageBox.Show("Uploading data ...");
myWebClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
myWebClient.UseDefaultCredentials = true;
//UploadData implicitly sets HTTP POST as the request method.
byte[] responseArray = myWebClient.UploadData(uriString, postArray);
// Decode and display the response.
//System.Windows.Forms.MessageBox.Show("Response received was :{0}", Encoding.ASCII.GetString(responseArray));
}
}
|
|
|
|
|
From a brief glance your function (public string PostToWS) expects you to return a string, and it does not return anything at all.
At least that's what "not all code paths return a value." usually means.
Edbert
Sydney, Australia
"A day without sunshine is like, you know, night."
|
|
|
|
|
hi guyz,
I need to convert any of the following file formats such as pdf/doc/html to xml in my project using java.
Does anyone know how this can be achieved?
Is there any open source library that can help me?
I searched for FOP(Formatting Objects Processor) but it converts from XML to PDF and not vice versa...
Please help...This is urgent.
Regards,
|
|
|
|
|
Is there a way in an xpath to do a basic IF without using xsl...
This is the query to tell me if there is an update available:
//application[@name="OutlookView"]/version>1
This is the query to tell me the path to the update:
//application[@name="OutlookView"]/url
I would like to merge them if I can, is this possible?
Matthew Hazlett
Sometimes I miss the simpler DOS days of Borland Turbo Pascal (but not very often).
|
|
|
|
|
One way:
//application[@name="OutlookView"]/*[name()='version' or name()='url']
|
|
|
|
|
i have a transformer to convert xml to html.
i have created following xsl.
but when i get the output html the starting table tag (<table>) is missing. the end table tag however appears in the html. What coul be the problem?
<code><?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>
<xsl:template match="data_table">
<table> <xsl:apply-templates/>
</table>
</xsl:template>
<xsl:template match="body">
<tr >
<TH valign='top' colspan='3'>
<xsl:apply-templates select="heading"/>
</TH>
<TH valign='top' colspan='3' align='right'>
<xsl:if test = "./link/linkurl and ./link/linktext != ''">
<xsl:element name="A">
<xsl:attribute name="href">
<xsl:value-of select="./link/linkurl"/>
</xsl:attribute>
<xsl:value-of select="./link/linktext"/>
</xsl:element>
</xsl:if>
</TH>
</tr>
</xsl:template> </code>
-- modified at 6:55 Monday 30th January, 2006
|
|
|
|
|
HI
Need Java Code For Validating The XML agaianest XSD which includes other xsd's
|
|
|
|
|
hi guys:
i am using XmlDocument to save a xml file, but it always output something like this xmlns=""
how do i get rid of this?
thanks
|
|
|
|
|
I have a rss feed app that I would like to add the Newspaper View Style like the RSS Bandit. Can anyone help me to add this feature to my app.
Thanks
Thanks cPod....
|
|
|
|
|
Take a look at my article:
http://www.codeproject.com/soap/reallymostsimplesyndctn.asp
It includes newspaper-style XSLT stylesheets.
Don't worry, be happy )
|
|
|
|
|
I'm getting some problem to bind my DropDown control with an xml file...
I made an example using xmlTextReader displaying it in a table format. its working...
But i need to display data in my dropdown control using xmlTextReader....
please help
here is my example coding...
private void Page_Load(object sender, System.EventArgs e)
{
// Placer ici le code utilisateur pour initialiser la page
string strAtt,strType,strName,strValue,strTemp,strPath;
strPath=Server.MapPath("list.xml");
System.Xml.XmlTextReader xmlRdr;
xmlRdr=new
System.Xml.XmlTextReader(strPath);
strTemp="<table border=1 width=100%><tr><th width=150px>ISBN No.</th><th>Book Name</th></tr>";
Response.Write(strTemp);
while(xmlRdr.Read())
{strType=Convert.ToString(xmlRdr.NodeType);
strName=xmlRdr.Name;
if(strType=="Element")
{
if(strName=="subject")
{
strAtt=xmlRdr.GetAttribute("name");
strTemp="<tr><td colspan=2 align='left' bgcolor='pink'>"+strAtt+"</td></tr>";
Response.Write(strTemp);}
else if(strName=="book")
{
strAtt=xmlRdr.GetAttribute("isbn");
xmlRdr.Read();
strValue=xmlRdr.Value;
strTemp="<tr><td>"+strAtt+"</td><td>"+strValue+"</td></tr>";
Response.Write(strTemp);
}
}
}
Response.Write("</table>");
xmlRdr.Close();
}
and now how will i change this code to display in a dropdown control????
-- modified at 3:10 Friday 20th January, 2006
|
|
|
|
|
You can just set the DataSource property of the DropDownList control to be your xml reader. Then specifiy how you can display the data. Also, you can load your xml document into a DataSet (might be slow depending on size) and use that instead.
~Javier Lozano
|
|
|
|
|
thanks, but i managed to do it from the xml file.I've got restriction and must used an xml file to display.
I've got another problem.
suppose ive got a checkbox in my web, when i click on the first element in the dropdownlist it must be disable and when i click on the second it must be enabled.
Im trying to make a loop but its not working, do u have any tip????
public void Page_Load(object sender, System.EventArgs e)
{
// Placer ici le code utilisateur pour initialiser la page
//string strAtt,strType,strName,strValue,strTemp,strPath,strId;
strPath=Server.MapPath("list.xml");
System.Xml.XmlTextReader xmlRdr;
xmlRdr=new
System.Xml.XmlTextReader(strPath);
strTemp="<SELECT style='LEFT: 480px; POSITION: absolute; TOP: 104px' WIDTH='130px' HEIGHT='8px' >";
Response.Write(strTemp);
while(xmlRdr.Read())
{
strType=Convert.ToString(xmlRdr.NodeType);
strName=xmlRdr.Name;
if(strType=="Element")
{
if(strName=="subject")
{
strAtt=xmlRdr.GetAttribute("name");
strTemp="<DIV>Label"+strAtt+"</DIV>";
Response.Write(strTemp);}
else if(strName=="Action")
{
strAtt=xmlRdr.GetAttribute("id");
xmlRdr.Read();
strValue=xmlRdr.Value;
strTemp="<OPTION selected>"+strValue+"</OPTION>";
Response.Write(strTemp);
}
}
}
Response.Write("</SELECT>");
/*
if(strName=="Action")
{
strAtt=xmlRdr.GetAttribute("id=1");
xmlRdr.Read();
strValue=xmlRdr.Value;
CheckBox1.Visible=true;
}
else if(strName=="Action")
{
strAtt=xmlRdr.GetAttribute("id=2");
xmlRdr.Read();
strValue=xmlRdr.Value;
strTemp=
CheckBox1=false;
}
*/
xmlRdr.Close();
}
here is my xml file>>>
<?xml version="1.0" encoding="utf-8" ?>
<booklist>
<subject id="sub1" name="Traitement du rejet">
<Action id="1">Aucun</Action>
<Action id="2">En Attente</Action>
<Action id="3">Retour Afdas</Action>
<Action id="4">Commentaire</Action>
</subject>
</booklist>
|
|
|
|
|
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
|
|
|
|