|
|
Hi,
How can i remove a table if the date it contains is older than 30 days from an xml file using xsl?
This is how the xml file looks like:
<root>
<table>
<id> 0 </id>
<date> 20060404 </date>
</table>
<table>
<id> 1 </id>
<date> 20060822 </date>
</table>
<table>
<id> 2 </id>
<date> 20060904 </date>
</table>
</root>
Thanks in advance!
|
|
|
|
|
If you are using xsl to construct a new xml file, you can chewck in the xsl value of the field
(date), and if it is less than the special one (declare that as a const), move to the next one.
Sorry, I do not remember the exact syntax, but you do have conditions and loops available in xsl
Sincerely,
Elina
Life is great!!!
Enjoy every moment of it!
|
|
|
|
|
The xsl file i wanna make should be a stand alone one.
The other xml file is made by another program.
I never worked with xsl. Do you know where i can find some samples codes bout this?
|
|
|
|
|
Read here [^].
I am sure, there are a lot of others as well, but I w3schools are great for beginners (to my mind)
Sincerely,
Elina
Life is great!!!
Enjoy every moment of it!
|
|
|
|
|
Hello all.
Im trying to validate a single XML file using two schemas in .NET. I cannot change the format of the XML file, which looks something like this:
<br />
<?xml version="1.0" encoding="ISO-8859-1"?><br />
<aaa><br />
<bbb>some text</bbb><br />
<ccc>more elements....</ccc><br />
<InterChangeHead xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="ich.xsd"><br />
<Version>1</Version><br />
<SenderID>xxx</SenderID><br />
<ddd>and so on..</ddd><br />
</InterChangeHead><br />
</aaa>
As you see the <InterChangeHead> refears to 'ich.xsd', this file contains the schema to validate <InterChangeHead> and its children. But i need to control the entire file. I've made a schema file that controls <aaa> and its child elements, but should this file contain a check for InterChangeHead?
In .NET i use the XMLSchemaSet, should i Add the two schemas here? Or will 'ich.xsd' automagically be loaded for me?
I've also tried to make one big schema file which controls everything, but then i get an error on the <InterChangeHead> element, because of the xmlns thingy...
Hope this makes sense to somebody
Thanks
Arve.
|
|
|
|
|
Through trial and error i think i've almost solved this problem. But i still need some help.
This is my example xml file, which cannot be edited:
<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<aaa><br />
<bbb>Text</bbb><br />
<ccc>123</ccc><br />
<ddd xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="xyz"><br />
<eee>text2</eee><br />
<ccc>text3</ccc><br />
</ddd><br />
</aaa><br />
I've made two schemas, first 'aaa_schema.xsd':
<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" attributeFormDefault="unqualified"><br />
<xs:element name="aaa"><br />
<xs:complexType><br />
<xs:sequence><br />
<xs:element name="bbb" type="xs:string" /><br />
<xs:element name="ccc" type="xs:int" /><br />
<xs:any/><br />
</xs:sequence><br />
</xs:complexType><br />
</xs:element><br />
</xs:schema><br />
and 'ddd_schema.xsd':
<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" attributeFormDefault="unqualified" xmlns="xyz" targetNamespace="xyz"><br />
<xs:element name="ddd" ><br />
<xs:complexType ><br />
<xs:sequence ><br />
<xs:element name="eee" type="xs:string" /><br />
<xs:element name="ccc" type="xs:string" /><br />
</xs:sequence><br />
</xs:complexType><br />
</xs:element><br />
</xs:schema><br />
What i've done is add a xs:any to the aaa_schema where the ddd element should be.
In the .NET code i've added this:
<br />
Dim arrSchema As XmlSchemaSet = New XmlSchemaSet()<br />
arrSchema.Add(Nothing, New XmlTextReader("C:\temp\aaa_schema.xsd"))<br />
arrSchema.Add("xyz", New XmlTextReader("C:\temp\ddd_schema.xsd"))<br />
But when i try to validate the file i get this message:
"The element 'ddd' in namespace 'xyz' has invalid child element 'eee' in namespace 'xyz'. List of possible elements expected: 'eee'."
What does this mean? I thought the scope of the xyz namespace in the ddd_schema file covered all the child elements, not just the ddd element?
If i edit eee and ccc in the XML file like this:
<br />
<eee xmlns="" >text2</eee><br />
<ccc xmlns="" >text3</ccc><br />
Then everything work, but in the real scenario can't change the XML file.
Anyone?
-- modified at 2:46 Friday 16th June, 2006
|
|
|
|
|
Hi All,
I am working on VC++ (exe dialog application).. I have loaded the xml file using DOM i;e using a pointer of IXMLDOMDocument and calling the load function of it. Can I know if there are any built-in function or any other alternatives to find the size of the DOM ,before and after loading the xml file??
|
|
|
|
|
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
|
|
|
|