|
I have seen this done using xsl:param directly under the xsl:stylesheet declaration to pass in parameters, but I have only seen this work with command-line processors like Saxon, Xalan. Unfortunately, MSXML does not support top-level parameters.
The workaround would be to append the data you want to pass through a parameter in the XML to be transformed and read it into a top-level variable.
|
|
|
|
|
I use Embedded Visual C++ 3.0 (evc) to develop for PocketPC 2002 (PPC).
I plan to do XSLT on PPC.
My plan is to read an XML- and XSL-file and transform the XML-file to HTML with XSLT.
Does anybody know if that is possible on PPC?
Are there any SDKs, librarys, tools or samples?
thx, Daniel
|
|
|
|
|
Ok, I'll keep this as simple as possible. I need to Query an XML file and Return the "DataRow" Nodes that meet some criteria contained in more than one ChildNode of the Row. Keep in mind that I cannot simply make the ID's part of the "DataRow" node, because for every XML file, the IDs are totally different Columns (not by my design).
Here's an example XML data:
<DataTable>
<DataRow>
<DataColumn Name="DatabaseID" Value="1" />
<DataColumn Name="RowID" Value="1" />
</DataRow>
</DataTable>
Ok, what I need to do is Select all "DataRow" nodes where the "DataColumn" matches the following criteria:
@Name='DatabaseID' and @Value='1' and @Name='RowID' and @Value='1'
Here's what I have so far, but I can't seem to match a DataRow to multiple criteria in the DataColumns:
//DataRow/DataColumn[@Name='DatabaseID' and @Value='1']
|
|
|
|
|
//DataRow[ DataColumn/@Name='DatabaseID' and DataColumn/@Value='1' and DataColumn/@Name='RowID' and DataColumn/@Value='1']
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Thanks for the Reply, I ended up figuring it out this morning in 15min (after working on it for 10hrs yesterday)...
I ended up with this:
|
|
|
|
|
Hi all,
Do you know how to send XMLdata to exe file ?
This preposion is not to create XML data file.
This situation is the following.
The XML data is send from websever, the browser on client
receive it. This browser install a plugin that have a function
receiving and sending XML data.
When this browser receive it, send it to a exe file.
I think 2 pattern.
1. This browser send XML data at the same time, kick a exe file
by a plug in.
2. A exe file have already performed.
If you have some solutions, please advice me.
Best Regards,
yu-yu
|
|
|
|
|
You could register a specific MIME type in the PC (eg. .myFileExt) to be handled by your exe file,
then send the XML as filename.myFileExt, and when the user opens the file it will be processed by your exe
(The exe will receive the filename as the argument). At least that's what I did with my program.
However, I don't know how to register a MIME type programmatically, maybe someone else can help?
|
|
|
|
|
Hi
thank you for your advice.
About the following
"when the user opens the file it will be processed by your exe"
When XML is sent, have this situation already processed ?
or at the same time exe file received, do exe file process ?
thank you in advance for your kindness.
best Regards,
yu-yu
|
|
|
|
|
I'm not sure what you're asking, so I'll try to explain what I think you're asking .
If the MIME has been registered in the user's PC to be handled by your exe, whenever the user opens the xml file (in this case, filename.myExt) then the exe will be activated.
Therefore,
1. User downloads xmlData.myExt and saves it to the PC.
2. User opens xmlData.myExt (so it has to be opened by user, either by double-clicking on the file or select Open to activate MyProgram.exe)
3. MyProgram.exe runs, and accepts location of xmlData.myExt
4. MyProgram.exe does whatever it needs with xmlData.myExt
I hope that answers your question.
|
|
|
|
|
I'm sorry to luck my explaination, thank you.
Your precondition is to save xml to the PC.
I think about not to save it.
The client's browser( already installed plugin) catch it,
plugin kick exe file and send it to exe file.
To register MIME, in this case, is it possible ?
thank you in advance for your kindness
best regards,
yu-yu
|
|
|
|
|
I've spoken to my colleague, he said you can register the MIME to open the file automatically.
Under the File Types setting, there is an Advanced button where you can untick the "Confirm open after download".
If you want to do it from the registry, he said it corresponds to My Computer\HKEY_CLASSES_ROOT\.myExt and My Computer\HKEY_CLASSES\ROOT\MIME\Database\Content Type
|
|
|
|
|
thank you.
I try it.
Best Regards,
yu-yu
|
|
|
|
|
Hi All,
I have an existing XML file and i want to append that XMl file with the data from another XML file..I don't have any idea how to proceed with it..I have tried DomDocument create node and domelement cretenode or createElement but nothing seems to work..is there something i need to do..Please help me..I need it urgently..Any help or pointers are highly appreciated..
Thanks a lot in advance..
Regards,
Himanshu
|
|
|
|
|
i think you need XmlDocument.ImportNode
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
I'm writing out a dataset...
dsPrefs.WriteXml(ManagerPrefsFilename, XmlWriteMode.WriteSchema);
and, at other times reading it in...
dsPrefs.ReadXml(ManagerPrefsFilename,XmlReadMode.IgnoreSchema);
The problem is that one of the columns is of type Point. The XML written by .WriteXml seems to contain all the info needed to describe this. Yet when I read it back in with .ReadXml and check the type it is System.String. I've tried different XmlReadMode to no avail.
Any idea why these aren't being converted to the correct type when read in?
-- James --
|
|
|
|
|
Because you're ignoring the schema ?
Does the XML mark the variable as being of type point, with an attribute or something ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Here's a simplified example. It creates an Xml file named "XmlRoundTrip.xml" on the Desktop from a DataSet and then Reads it back in. Just add the code below to the constructor of a default Form template and run it.
The first Message box shows "Type written: System.Drawing.Point". The dataset is then cleared and the data is re-read. But the second Message box shows "Type read: System.String".
Any ideas? Am I expecting too much from the DS XML methods?
DataSet ds = new DataSet("MyDataSet");<br />
<br />
DataTable dt = ds.Tables.Add("MyDataTable");<br />
<br />
DataColumn dcA = new DataColumn("PointColumn", typeof(Point));<br />
dcA.DefaultValue = new Point(8, 13);<br />
<br />
DataColumn dcB = new DataColumn("SizeColumn", typeof(Size));<br />
dcB.DefaultValue = new Size(21, 34);<br />
<br />
dt.Columns.Add(dcA);<br />
dt.Columns.Add(dcB);<br />
<br />
DataRow dr = dt.NewRow();<br />
dt.Rows.Add(dr);<br />
<br />
string myTempFolder = System.Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);<br />
string myXmlFilename = myTempFolder + "\\XmlRoundTrip.xml";<br />
<br />
ds.WriteXml(myXmlFilename, XmlWriteMode.WriteSchema);<br />
<br />
MessageBox.Show("Type written: " + dt.Rows[0]["PointColumn"].GetType().ToString());<br />
<br />
dt.Clear();<br />
<br />
ds.ReadXml(myXmlFilename, XmlReadMode.ReadSchema);<br />
<br />
MessageBox.Show("Type read: " + dt.Rows[0]["PointColumn"].GetType().ToString());
-- James --
|
|
|
|
|
Good point - the XML generated is bursting with type information, so there's no reason I can see for this not to work, but it doesn't. How pathetic.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I have a sample coding using C#.NET in Compact Framework. This code is about adding rows and columns in DataTable. Now, I want to save the content of the Datagrid into my XML file. How can I do this?
Then, I would like to retrive the content from the XML file into my Datagrid. How can I load it?
=====Code Start=====
using System;
using System.Data;
using System.Windows.Forms;
using System.Drawing;
using System.XML;
using System.Windows.Forms.DataGrid;
class DataGridAdding : Form
{
private System.Data.DataTable dataTable;
private System.Windows.Forms.Button buttonAddColumn;
private System.Windows.Forms.Button buttonAddRow;
private System.Windows.Forms.Button buttonDeleteColumn;
private System.Windows.Forms.Button buttonDeleteRow;
private int maxColumnNumber;
private System.Windows.Forms.DataGrid dataGrid;
private int maxRowNumber;
public DataGridAdding()
{
maxColumnNumber = 0;
maxRowNumber = 0;
InitializeComponent();
// Create a DataTable of data to use.
InitializeTable();
// Bind the DataGrid to the DataTable.
dataGrid.DataSource = dataTable;
}
protected void InitializeComponent()
{
this.buttonAddColumn = new System.Windows.Forms.Button();
this.buttonAddRow = new System.Windows.Forms.Button();
this.buttonDeleteColumn = new System.Windows.Forms.Button();
this.buttonDeleteRow = new System.Windows.Forms.Button();
this.dataGrid = new System.Windows.Forms.DataGrid();
//
// buttonAddColumn
//
this.buttonAddColumn.Location = new System.Drawing.Point(5, 5);
this.buttonAddColumn.Size = new System.Drawing.Size(80, 20);
this.buttonAddColumn.Text = "Add Column";
this.buttonAddColumn.Click += new System.EventHandler(this.buttonAddColumn_Click);
//
// buttonAddRow
//
this.buttonAddRow.Location = new System.Drawing.Point(5, 30);
this.buttonAddRow.Size = new System.Drawing.Size(80, 20);
this.buttonAddRow.Text = "Add Row";
this.buttonAddRow.Click += new System.EventHandler(this.buttonAddRow_Click);
//
// buttonDeleteColumn
//
this.buttonDeleteColumn.Location = new System.Drawing.Point(90, 5);
this.buttonDeleteColumn.Size = new System.Drawing.Size(145, 20);
this.buttonDeleteColumn.Text = "Delete Current Column";
this.buttonDeleteColumn.Click += new System.EventHandler(this.buttonDeleteColumn_Click);
//
// buttonDeleteRow
//
this.buttonDeleteRow.Location = new System.Drawing.Point(90, 30);
this.buttonDeleteRow.Size = new System.Drawing.Size(145, 20);
this.buttonDeleteRow.Text = "Delete Current Row";
this.buttonDeleteRow.Click += new System.EventHandler(this.buttonDeleteRow_Click);
//
// dataGrid
//
this.dataGrid.Location = new System.Drawing.Point(0, 56);
this.dataGrid.Size = new System.Drawing.Size(240, 216);
this.dataGrid.Text = "dataGrid";
//
// DataGridAdding
//
this.Controls.Add(this.dataGrid);
this.Controls.Add(this.buttonAddColumn);
this.Controls.Add(this.buttonAddRow);
this.Controls.Add(this.buttonDeleteColumn);
this.Controls.Add(this.buttonDeleteRow);
this.Text = "DataGrid Sample";
}
private void InitializeTable()
{
int index;
// Create a DataTable named "Edit Table".
dataTable = new DataTable("Rows Cols Table");
// Create columns in the DataTable.
AddNewColumn();
AddNewColumn();
AddNewColumn();
// Add 20 rows of data to the DataTable.
for (index = 0; index < 20; index++)
{
AddNewRow();
}
}
private void AddNewColumn()
{
string newColumnName;
int index;
// Increment the max column number.
maxColumnNumber++;
// Construct name for new column.
newColumnName = "C " + maxColumnNumber.ToString();
// Create New Column.
dataTable.Columns.Add(newColumnName, Type.GetType("System.String"));
// Add data to each row in the table for the new column.
for (index = 0; index < dataTable.Rows.Count; index++)
{
dataTable.Rows[index][newColumnName] = "R " + index.ToString() + ", " + newColumnName;
}
}
private void AddNewRow()
{
DataRow dataRow;
int index;
string columnName;
// Increment the maximum row number.
maxRowNumber++;
// Create new row from DataTable.
dataRow = dataTable.NewRow();
// Add data to each column in the new row.
for (index = 0; index < dataTable.Columns.Count; index++)
{
columnName = dataTable.Columns[index].ColumnName;
dataRow[columnName] = "R " + maxRowNumber.ToString() + ", " + columnName;
}
dataTable.Rows.Add(dataRow);
}
private void buttonAddColumn_Click(object o, EventArgs e)
{
AddNewColumn();
}
private void buttonAddRow_Click(object o, EventArgs e)
{
AddNewRow();
}
private void buttonDeleteColumn_Click(object o, EventArgs e)
{
if (dataTable.Columns.Count > 0)
{
dataTable.Columns.RemoveAt(dataGrid.CurrentCell.ColumnNumber);
}
}
private void buttonDeleteRow_Click(object o, EventArgs e)
{
if (dataTable.Rows.Count > 0)
{
dataTable.Rows.RemoveAt(dataGrid.CurrentCell.RowNumber);
}
}
public static void Main(string [] args)
{
Application.Run(new DataGridAdding());
}
}
=====Code End=====
Please help~
1. Save content of Datagrid into XML file.
2. Load content from XML file into Datagrid.
|
|
|
|
|
Foll are the output of the Structure of DataSet after reading it from a Schema file, with the Relations.
Tables count=3
TableName='Calls'.
Columns count=1
ColumnName='Calls_Id', type = System.Int32
TableName='Call'.
Columns count=5
ColumnName='DateTime', type = System.String
ColumnName='TSR_ID', type = System.String
ColumnName='Comments', type = System.String
ColumnName='Call_Id', type = System.Int32
ColumnName='Calls_Id', type = System.Int32
TableName='Evaluation'.
Columns count=4
ColumnName='MonitorName', type = System.String
ColumnName='DateTime', type = System.String
ColumnName='Evaluation_Id', type = System.Int32
ColumnName='Call_Id', type = System.Int32
RelationName='Call_Evaluation
Parent Table= Call
Child Table=Evaluation
Cols=Call_Id, AND Call_Id,
RelationName='Calls_Call
Parent Table= Calls
Child Table=Call
Cols=Calls_Id, AND Calls_Id,
But the problem is in the nesting. Though the relations seem to exist, but I don't think they are actually being populated that way. Here is the output after putting values in the DataSet.
If you notice, the parent ID has not been populated on it's own since the relation has been defined.
TableName='Calls'.
Rows count=1
ColumnName='Calls_Id', value = 0
TableName='Call'.
Rows count=3
ColumnName='DateTime', value = 1
ColumnName='TSR_ID', value = 62137
ColumnName='Comments', value = 1
ColumnName='Call_Id', value = 0
ColumnName='Calls_Id', value =
ColumnName='DateTime', value = 1
ColumnName='TSR_ID', value = 1
ColumnName='Comments', value = 1
ColumnName='Call_Id', value = 1
ColumnName='Calls_Id', value =
ColumnName='DateTime', value = 1
ColumnName='TSR_ID', value = 1
ColumnName='Comments', value = 1
ColumnName='Call_Id', value = 2
ColumnName='Calls_Id', value =
TableName='Evaluation'.
Rows count=3
ColumnName='MonitorName', value = OP NMay
ColumnName='DateTime', value = 2003-09-10
ColumnName='Evaluation_Id', value = 0
ColumnName='Call_Id', value =
ColumnName='MonitorName', value =
ColumnName='DateTime', value =
ColumnName='Evaluation_Id', value = 1
ColumnName='Call_Id', value =
ColumnName='MonitorName', value =
ColumnName='DateTime', value =
ColumnName='Evaluation_Id', value = 2
ColumnName='Call_Id', value =
Am I missing something here ? I really need to solve this problem asap.
Thanks,
Paul
|
|
|
|
|
Hi,
I am populating DataSet from an XML Schema which has tables pointing to other tables.
All the Relations, column names, etc have been successfully retrieved in the DataSet.
But there is problem of nesting. Is there something I have to do to see that tables are nested properly. Like there is a column Call_Id that is added on it's own by the DataSet as it is a child table of Table Call.
Do I have to fill something in that for proper nesting of tables !?!
Any help would be highly appreciated !
Paul
|
|
|
|
|
Hi,
I am deriving a DataSet using ReadXMLSchema method from a XML Schema Definition file.
I want to fill values in the Tables of the Data Set. There are some Tables that are complex Types. How do I fill values in such columns.
For Ex:
Table A
-----Table B (Attributes: 1,2,3,4)
-----Table C (Attributes: Table D, complexType)
---------------Table D (Attributes: 1)
--------------------------Table E ((Attributes: 1,2)
B & C are child of A. D & E are child of C.
C only has one column which is a reference to Table D.
How do I fill the values for the column in Table C , which is Table D (complex type)?
Paul
|
|
|
|
|
Hi all,
Currently I am working on a template solution which transforms contents of a given section (which is in a xml format) with the help of preset XLST files assigned to those sections. The code goes something like this
/Default.aspx
<code>
.
.
.
.
// Get the sections data in XML format
string xmlData = DataLoader.GetSectionData(sectionName, sectionPath, articleId, pageNumber );
// Get that sections template file
string xslFile = Server.MapPath("/")+"Files\\Templates\\"+ templateFile +"\\Default.xsl";
System.IO.StringReader sr = new System.IO.StringReader(xmlData);
XPathDocument doc = new XPathDocument(sr);
XslTransform trans = new XslTransform();
trans.Load(xslFile);
//Transform it and output as HTML
XmlTextWriter writer = new XmlTextWriter(Response.Output);
writer.Formatting = Formatting.None;
trans.Transform(doc,null,writer);
/SectionData.xml
<Root>
<Article>
<Title>Wonders of life</Title>
<Content>
<!--
<u>Sometimes<u>, you wonder how a particular thing went wrong; < b>but most of the time</ b> you wonder how it worked at all
-->
</Content>
</Article></Root>
/SectionTemplate.xslt
.
.
.
<xsl:value-of select="/Root/Article/Title" />
<br />
<xsl:value-of select="/Root/Article/Content/comment()" disable-output-escaping="yes" />
.
.
.
What i expected of the tranformer was to spit the contents of the comment tag to the browser without any parsing/escaping so the html formatting of the given article can be maintained, but whatever is done (I even tried with copy-of xsl element to no effect) the output I get is like this in the article page (HTML VIEW of the generated code)
Wonders of life<br />
<u>Sometimes<u>, you wonder how a particular thing went wrong; <b>but most of the time</b> you wonder how it worked at all
I understand that we can accomplish this by embedding the html code inside CDATA section but that too didnt work out well. Any alternate suggestions are also welcome.
Thanking you
CreProDes
CreProDes
|
|
|
|
|
why are you putting your html in a comment
if you did not put it in a comment then you could use xsl:copy-of
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Hi,
thank you for the tip. actually previsouly i was having problems using the copy-of tag because the html generated by the client side editor was not perfectly xml compatible one, so i had to go to using the comment and stuff. but now iam making use of SgmlReader from gotdotnet.com and solved that issue as well. Thank you for posting.
Bye,
CreProDes
CreProDes
|
|
|
|
|