|
Is there any algorithms or sample code for finding the difference between two xml files.
Aswathi
|
|
|
|
|
Hi there
am having an application which takes data in XML format from webserver (SQL) and imports to offline software. the second part of the same is taking XML file data and copy it to SQL database in webserver, here am able to upload the XML file to webserver, do anyone knows how to write this XML data to SQL Server using classic ASP, due to certain issues i cudn't use ASP.NET.
regards
rowdykuttan
|
|
|
|
|
we are have to upload xml file(given by client:which consists of tally data) into sqlserver.there we are facing a problem with MasterXmlfile that has structre::
UNIT NAME="Mth" RESERVEDNAME="Mth"
NAME Mth NAME
ORIGINALSYMBOL Months ORIGINALSYMBOL
ISSIMPLEUNIT Yes ISSIMPLEUNIT
FORPAYROLL Yes FORPAYROLL
UNIT(Table)
unit is a Table and Name is attribute.... now problem is we are having to two name attribute In Unit Table...and it showing error like this "A column named 'NAME already belongs to this DataTable cannot set a nested table name to the same name" hoe to over come this "with out changing xml file"
by using C#
My code as fallows:
public partial class Testxml : System.Web.UI.Page
{
protected string table_name;
protected string column_name;
protected string cmd_string;
protected string AccessConnect;
protected string query_str;
protected int field_count;
protected DataSet data_set;
protected DataSet data_setxml;
protected DataTable data_table;
protected DataRow data_row;
protected DataRow data_row1;
protected DataColumn data_column;
protected SqlConnection Conn_one;
protected SqlCommand cmd_one;
protected SqlDataReader my_red;
protected SqlCommandBuilder data_cmb;
protected SqlDataAdapter data_adp;
protected int st_int;
protected int col_int;
protected void Page_Load(object sender, EventArgs e)
{
data_table = new DataTable();
}
protected void Button1_Click(object sender, EventArgs e)
{
if (AccessConnect != "")
{
AccessConnect = "Persist Security Info=False;User ID=sa;Password=nunetme;Initial Catalog=sat;Data Source=NUNETSERVER3";
}
Conn_one =new SqlConnection();
cmd_one = new SqlCommand();
data_set = new DataSet();
data_setxml = new DataSet();
//data_table = new DataTable();
Conn_one.ConnectionString=AccessConnect;
string strFileName="";
//strFileName =FileUpload1.FileName + ".xml";
strFileName = FileUpload1.FileName;
//strFileName = (DateTime.Now.ToShortDateString() + DateTime.Now.ToShortTimeString()).Replace("/", "").Replace(":", "").Replace(" ", "") + ".xml";
System.Object objvalue;
//Prepare file name with full path using upload directory
objvalue = System.Configuration.ConfigurationSettings.AppSettings["uploadpath"].ToString() + strFileName;
try
{
Conn_one.Open();
cmd_one.Connection = Conn_one;
data_setxml.ReadXml(objvalue.ToString());
//data_setxml.ReadXml(HttpContext.Current.Server.MapPath(objvalue.ToString()));
//data_setxml.ReadXml(HttpContext.Current.Server.MapPath(TextBox1.Text.Trim()));
foreach(System.Data.DataTable data_table in data_setxml.Tables)
{
switch (data_table.TableName.ToString())
{
case "HEADER":case "BODY":case "IMPORTDATA": case "REQUESTDESC": case "STATICVARIABLES":case "REQUESTDATA" :case "TALLYMESSAGE":
{
break;
}
//break;
case "CATEGORYALLOCATIONS.LIST":case "COSTCENTREALLOCATIONS.LIST":case "CATEGORY":case "DETAILGST.LIST":case "DETAILGST":case "HEADERGST.LIST": case "HEADERGST":case "TAXCLASSIFICATION":
{
break;
}
default:
{
//Case "CATEGORYALLOCATIONS.LIST", "COSTCENTREALLOCATIONS.LIST", "CATEGORY", "DETAILGST.LIST", "DETAILGST", "HEADERGST.LIST", "HEADERGST"
System.Text.StringBuilder dest;
dest = new StringBuilder(data_table.TableName);
dest = dest.Replace(".", "_");
table_name = dest.ToString();
// Deleting the old record updated in Temp. Tables
query_str = "Delete From " + table_name;
cmd_one = new SqlCommand(query_str);
cmd_one.Connection = Conn_one;
cmd_one.ExecuteNonQuery();
query_str = "Select * From " + table_name;
data_adp = new SqlDataAdapter(query_str, Conn_one);
data_cmb = new SqlCommandBuilder(data_adp);
data_adp.Fill(data_set, table_name);
foreach (DataRow data_row1 in data_table.Rows)
{
data_row = data_set.Tables[table_name].NewRow();
foreach (DataColumn data_column in data_table.Columns)
{
//If Column Name has "." character changed to "_" since Column name can't have "."
//and DESC reserved word the changes to be done
column_name = data_column.ColumnName;
if (data_column.ColumnName == "DESC")
{
column_name = "DESC1";
}
else
{
System.Text.StringBuilder dest1;
dest1 = new StringBuilder(data_column.ColumnName);
dest1.Replace(".", "_");
column_name = dest1.ToString();
//column_name=Replace(data_column.ColumnName,".","_");
data_row[column_name] = data_row1[data_column];
}
}
// data_set.Tables(table_name).Rows.Add(data_row)
//data_adp.Update(data_set, table_name)
data_set.Tables[table_name].Rows.Add(data_row);
data_adp.Update(data_set, table_name);
}
//Response.Write("Xml File Has Inserted Successfully");
break;
}
}
}
}
catch(Exception ex)
{
Response.Write("There is some exception please help me::" + ex.Message);
Response.Write(data_table.TableName);
Response.Write(column_name);
}
finally
{
Conn_one.Close();
}
}
}
Kindly help in this situation ....Thanks in advance.....
G.V.KISHORE
SOFTWARE ENGINEER
NUNET TECHNOLOGIES
-- modified at 10:05 Tuesday 13th June, 2006
|
|
|
|
|
Please tell me ways to program application on Pocket PC by .NET Compact Framework, I can navigate XML Data by clicking buttons First, Previous, Next, Last to view XML record.
Thanks for your help
|
|
|
|
|
Hi
I'm develloping a b2b solution and i need to exchange soap messages with a business partner.
I am now able to post xml with a webservice to their webserver, using httpwebrequest and i also can receive their response.
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://www.someurl.com/receive");
I now need the inverse operation. I need to suply them a url so they can post/get their xml messages to me. How do i do that? I've been reading a lot, but i'm confused! i guess i don't need a webservice, i just want them to post their requests like i do, and send them a response like the one i'm getting...
HttpWebResponse wr = (HttpWebResponse)req.GetResponse();
Any help will be highly apreciated..... i'm getting a little desperate here!
TIA
Joana
|
|
|
|
|
I am writing an ASP.NET app that reads data from an XML file into an XML control that uses a XSL file to format the XML.
Tags inside the XSL file become HTML on the main page as they should ...but tags that are read from the XML file inside of are output as thier text equivelent (so < becomes <, > becomes >) and so on.
Is there som way of setting the XSL file to output these as tags??
Cheers.
-- modified at 8:51 Friday 9th June, 2006
|
|
|
|
|
Guyz out there, I think I did something silly wrong thing. I was playing around with the list that comes up if you open Windows Explorer --> Tools --> Folder Options... --> File Types. This list is a list of which executables to associate with which file extensions, so that when we double click a file, the OS knows which EXE to call. By the way, I have XP Professional SP2.
I deleted a few extensions from that list. One of the things I deleted was XML, and it was associated with Altova XML Spy. I always hated that when I double click an XML file, Altova would open up, blatantly advertising what its paid version offers before I can see my XML file. I had in the past tried to re-associate the XML extension with IE, but somehow Altova always regains it back. So among others, I went ahead and deleted the XML extension too. I have also deleted tons of other extensions.
Result: After that if I open an XML file with IE, IE does not "parse" it. It shows just as Notepad would
Can you please help me to regain my IE-XML tie up back?
Thanks a lot for your time and patience!
Koushik Biswas
|
|
|
|
|
to get the value by xml tag in java script (asp.net)
md hashmathullah khan
|
|
|
|
|
You need to create ActiveXObject.
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");<br />
xmlDoc.async="false";<br />
xmlDoc.onreadystatechange=verify;<br />
xmlDoc.load(xmlFile);<br />
xmlObj=xmlDoc.documentElement;
To get a value of a tag:
xmlObj.childNodes(3).childNodes(1).firstChild.text
Check here ^
or here
^
To learn more on how to work with DOM model
Sincerely,
Elina
Life is great!!!
Enjoy every moment of it!
|
|
|
|
|
Hello Sir,
Thanks For Reply.......
Here iam having....
name.list (element)
name(attribute)
name (attribute)
Two Attributes as Same ....I have to read this in Data set and send to SQLSERVER2005....
G.V.KISHORE
SOFTWARE ENGINEER
NUNET TECHNOLOGIES
-- modified at 1:42 Monday 19th June, 2006
|
|
|
|
|
Hi Kishore,
Small note (I am not Sir, but lady ).
Sorry, but I didn' t understood the question.
Can you explain it differently, or provide some more details
Sincerely,
Elina
Life is great!!!
Enjoy every moment of it!
|
|
|
|
|
Hi
I am using NDOC to create documentation on my project. I have added XML comments to my C# classes.
for a code sample as given below I am getting XML documetation warning:
/// if (parents != null && parents.Count > 0)
/// {
/// }
For line 1, I get warning "warning cs1570: badly formatted XML, a name was started with invalid character". When I click on the warning it takes me to '&&'.
Can anyone please tell me what is the syntax for && in XML?
Thanks for your help.
|
|
|
|
|
|
I need in my application to check if the data structure is correct in XML file which I read. How can I do that?
Only message if it`s correct or not I need.
Thanks
|
|
|
|
|
Every DOM object I've ever used has a parse function that will throw an exception or spit out an error if your XML is malformed. Unfortunately, determining well-formedness through exceptions is poor programming form.
The only better way I know to do this is with a full parser. As the parser is parsing, it should be able to tell you as soon as it finds a problem without throwing an exception, at which point you know your file failed. A complete run with no exceptions means your XML is good and adheres to any schema you've specified.
|
|
|
|
|
Write a schema for your structure that you can validate against.
Visit BoneSoft.com
|
|
|
|
|
I have tried DOCTYPE declaration internally and externally but it did not work in InternetExplorer6.(Its not showing an error eventhough the document is not according the DOCTYPE declaration.
Please tell me how to declare DOCTYPE and check the xml file according to DOCTYPE declaration.
ThankYou
KIRAN
|
|
|
|
|
hi
i am developing the web application in which i have to update the xml
Again and agian . What should i use tp update the xml here the code
try
{
XmlDocument xdoc=new XmlDocument();
xdoc.Load(Server.MapPath("MyFile.xml"));
XmlDocumentFragment docFrag=xdoc.CreateDocumentFragment();
XmlNode xmlnode = xdoc.DocumentElement.FirstChild;
XmlNode Query,MappingNode;
xmlnode.RemoveAll();
// if(xdoc.DocumentElement.Name.ToString().Equals("Query"))
{
for(int index=0;index<lstbxmap.items.count;index++)
{
="" values="" to="" be="" insert="" in="" xml="" at="" specific="" position=""
="" string[]="" temp="LstBxMap.Items[index].Text.Split('-','-','">','#');
string TemplateCol=temp[0].ToString();
string TableName=temp[4].ToString();
docFrag.InnerXml="<"+TemplateCol+"/>" ;
XmlNode CuurentNode=xdoc.CreateNode("element",TemplateCol,"");
xdoc.CreateElement(TemplateCol);
XmlAttribute AttributNode=xdoc.CreateAttribute("attribute","Address","");
AttributNode.Value=LstBxMap.Items[index].Value;
xmlnode.AppendChild(CuurentNode);
xmlnode[TemplateCol].SetAttributeNode(AttributNode);
xdoc.Save(Server.MapPath("MyFile.xml"));
}
}
}
catch(Exception ex)
{
ex.ToString();
}
PLease help me for updating the xml file using this code
|
|
|
|
|
try
{
xdoc=new XmlDocument();
xdoc.Load(Server.MapPath("MyFile.xml"));
CreateXmlTableElement();
string LastStoredProcName="";
for(int index=0;index<lstbxmap.items.count;index++)
{
=""
="" string[]="" temp="LstBxMap.Items[index].Text.Split('-','-','">','#');
string TemplateCol=temp[0].ToString();
string MapValueLOC=temp[1].ToString();
string StoredProcName=temp[5].ToString();
int flag=0;
CharEnumerator Characters= StoredProcName.GetEnumerator();
while(Characters.MoveNext())
{
if(Characters.Current.Equals('$'))
{
flag=1;
break;
}
flag=0;
}
if(flag==0)
{
if(!StoredProcName.Equals(LastStoredProcName))
{
CreateXmlTableElement();
}
LastStoredProcName=StoredProcName;
// create a attribute to add in table tag having value as a Stored procedure as name
XmlAttribute QueryAttribute=xdoc.CreateAttribute("attribute","Storedprocedure","");
QueryAttribute.Value=StoredProcName;
xdoc.DocumentElement.AppendChild(xmlElement);
// add attribute to the table tag
xmlElement.SetAttributeNode(QueryAttribute);
// create element MappedField showing the mapped field of Template column with
// Attributes of location
XmlElement mapField=xdoc.CreateElement("MappedField");
// Append to root node
// xdoc.AppendChild(mapField);
// create a attribute to add in MappedField element having value as location
XmlAttribute AddressLoc=xdoc.CreateAttribute("attribute","Address","");
AddressLoc.Value=MapValueLOC;
XmlAttribute Value=xdoc.CreateAttribute("attribute","Value","");
Value.Value=TemplateCol;
xmlElement.AppendChild(mapField);
// add Attribute to the element
mapField.SetAttributeNode(Value);
mapField.SetAttributeNode(AddressLoc);
xdoc.Save(Server.MapPath("MyFile.xml"));
|
|
|
|
|
Hi ,
Is there any way to export the .aspx file as XML file or vice varsa?
|
|
|
|
|
What are you trying to export? The source code or listing in the aspx? Are you trying to write XML output from an aspx? Do you want the code-behind embedded in XML? Please be more specific.
|
|
|
|
|
can anyone sujest me a method or show a sample code in whatever technology wich would help me load c++ objects from XML
like i would have
class A
{
int a;
int b;
A(int c, int d} {a=c; b=d;}
}
and xml <A a='2', b='3'></A>
and in result i would get A a = new A(2,3).
and also i would later on want to save my objects to xml again
-- modified at 13:48 Saturday 3rd June, 2006
|
|
|
|
|
If all your class variables are structures and not classes ( I mean int, double, float unlike CString, CList ) you can save the size of each variable in the XML file and then when you read it then just go over all elements and copy them to the class at the write position.
You should also save the type of the variables.
Something like this:
<A>
<a Size="4" Type="Int32">2</a>
<b Size="4" Type="Int32">3</b>
</A>
When you want to copy the objects from the XML you'll have to convert the string to the desired type and then copy the object to the write position in the class.
something like this:
int offset= 0;
int XMLValue;
int XMLVarSize;
A obj = new A();
Foreach Node In Nodes
{
memcpy( (LPBYTE)obj + offset, &XMLValue, XMLVarSize);
offset += XMLVarSize;
}
Good luck
Eran Aharonovich (eran.aharonovich@gmail.com )
Noviway
|
|
|
|
|
I have a web spider once it finds a page I need to convert that page into XML, it can be any page with many different formats. Is there a component I can use for that?
Does anyone know a really nice and fast way to do it?
Greetings
|
|
|
|
|
Um... HTML is a subset of XML. Just by the mere fact that you're getting HTML from the site, you already have XML. Are you trying to use a certain portion of it? Are you worried about the well-formedness of the HTML? Where are you having the problem?
|
|
|
|