|
Hi,
I am a bit confused. I believe XmlReader is very fast if you want to "pull" elements/nodes etc out of the file and do something with it as this is forward-read-only stream. But according to the original question, how do you "add" a node in such a scenario?
Never mind - I looked at the article: Efficient Techniques for Modifying Large XML Files.
One other way to go would be using XPathDocument - There is a nice sample here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnxml/html/sysxmlVS05.asp
|
|
|
|
|
hi,
i am having word data of whis is list style type having bullet, numbering and symbol formatting in different hierarchy.how could i capture that from word ml.
in wordml every data information is treated and present in <w:p>
wht is the soln to this.
RAM waiting for reply.
|
|
|
|
|
I have a chatting software in ASP and XML but my system is not configured to run it because The code is using DOM component object programming and i have to install this component to run it.I want to know from where i can install this component.
waiting...
EsHbAn BaHaDuR
|
|
|
|
|
It comes with the latest version of IE.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Well I have IE 6 version which is i think latest version of IE upto now.But it doesnot works.If u think that u have latest version of IE then i would send it to u to check that is it working properly.
waiting for ur courtesy.
EsHbAn BaHaDuR
|
|
|
|
|
u actaully need to download MSXML v4.0 SP2 from the Microsoft website or just google around for MSXML v4.0 SP2 and ur done with it.
Your dom application should work fine.
Regards
Wilbur J. Pereira
http://groups-beta.google.com/group/DotNetStarters
"If they love me let them, for the heck of it.If they don't, who da heck cares about it"
|
|
|
|
|
hi
This code is working fine given below
private void button31_Click(object sender, System.EventArgs e)
{
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load("c:/farm-config.xml");
XmlElement databaseElement = xmldoc.CreateElement("database1000");
xmldoc.DocumentElement["farm-config"].PrependChild(databaseElement);
FileStream fsxml = new FileStream("c:/farm-config.xml",FileMode.Truncate,FileAccess.Write,FileShare.ReadWrite);
// XML Document Saved
xmldoc.Save(fsxml);
fsxml.Close();
}
Above code enters <database1000 /> into ram.xml file after farm-config element
I want to enter after farm name=dev1
I get error in this line given below
xmldoc.DocumentElement["//farm[@name='dev1']"].PrependChild(databaseElement);
Rest of the code is same as given above code
my xml file stiructure is given below
-----------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<root>
<farm-config>
<farm name="dev1">
<connection address="192.168.1.13" user="root" selectedConnection="1" password="">
<lastJob>Copy-All</lastJob>
<lastConnection startdate="2005-05-10" starttime="12:43:23" enddate="2005-05-10" endtime="12:58:32" />
<state>1</state>
</connection>
//here i wantto insert database element
</farm>
</farm-config>
<root>
regards
sanjeev
|
|
|
|
|
This is my xslt file
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:asp="http://schemas.microsoft.com/intellisense/ie5"
xmlns:state="http://www.vbxml.com/state"
xmlns:str="http://www.vbxml.com/string"
xmlns:msxsl="urn:schemas-microsoft-com:xslt">
</msxsl:script>
<xsl:param name="calories">1500</xsl:param>
<xsl:template match="/">
<HTML>
<BODY STYLE="font-family:Arial, helvetica, sans-serif; font-size:10pt;
background-color:#EEEEEE">
</BODY>
</HTML>
<table align="center" width="100%" border = "1">
<tr>
<td width="30%" align= "center" bordercolor="#3366ff" bgcolor="#ccccff">activity</td>
<td width="20%" align= "center" bordercolor="#3366ff" bgcolor="#ccccff">score</td>
<td width="50%" align= "center" bordercolor="#3366ff" bgcolor="#ccccff">comment</td>
</tr>
<xsl:for-each select="//form_name[@name=$calories]//*">
<tr style="FONT-SIZE: 16px; Z-INDEX: 103;COLOR: blue; FONT-FAMILY: Arial;FONT-WEIGHT: bold ">
<td colspan = "3" bordercolor="#3366ff" bgcolor="#ccccff"><xsl:value-of select="@sub_group"/></td>
</tr>
<tr style="LIST-STYLE-POSITION: outside; BORDER-BOTTOM-COLOR: #999999; LIST-STYLE-TYPE: disc; BORDER-BOTTOM-STYLE: groove" >
<td style="FONT-SIZE: 14px; Z-INDEX: 103;COLOR: blue; FONT-FAMILY: Arial"><xsl:apply-templates/></td>
<xsl:if test = "name() = 'activity'">
<td align="center"><input type = "textbox" id = "score" Width="500px"></input></td>
<td><textarea id = "comment" size = "20"/></td>
</xsl:if>
</tr>
</xsl:for-each>
</table>
<button id = "btn_score">summary score</button>
</xsl:template>
<xsl:template match="activity">
<xsl:value-of select="activity"/>
</xsl:template>
</xsl:stylesheet>
QUESTION
I add textbox (id = "score) for user and add button (id = "sum_score") I want to get data in all textbox to calculate the summary of score and calculate percent when the user click button (id = "btn_score")
can someone have a suggestion for me, please
thank you
|
|
|
|
|
You need to add an onclick to the button, which calls a javascript function that you'll also need to insert into your XSLT.
You mentioned you're using ASP.NET. You're not really, if you are, then this is all a real waste of time, unless you have a specific reason to want to avoid posting back in this instance.
By the way, it's possible to respond on the same thread, and it's also possible to edit and delete your posts.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Sorry, I'm not well to write english, may be it make a mistake about the communication
I'll try again
I mentioned using asp.net , that right, I use asp.net to make a user interface and send data form page to be a condition send to xslt file to retrieve data from xml file
and I add textbox to receive score form user and add textarea to receive comment from user
and the last when user click button I want to show summary of score
You suggest me to add javascript to xslt, I never use javascript and I think my computer not support , can I use vbscript?
Could you tell me an example or website that can solve my problem, please
Thank you so much
|
|
|
|
|
mathuros_paiboon wrote:
Sorry, I'm not well to write english
That's fine, I don't hold that against you. Hell, I ONLY speak English, so you're ahead of me in the long run.
mathuros_paiboon wrote:
I mentioned using asp.net , that right, I use asp.net to make a user interface and send data form page to be a condition send to xslt file to retrieve data from xml file
and I add textbox to receive score form user and add textarea to receive comment from user
and the last when user click button I want to show summary of score
Yes, my point is that so long as you're using ASP.NET, you should abandon the XSLT idea and instead do everything in ASP.NET, where it will be a lot easier.
mathuros_paiboon wrote:
You suggest me to add javascript to xslt, I never use javascript and I think my computer not support , can I use vbscript?
ASP.NET is a complex library that exists solely to generate web pages. From the browsers point of view, it recieves a text file and has no real idea where it comes from. All web browsers support javascript, in fact ASP.NET works much of it's magic by custom generated javascript that goes into every ASP.NET page. I believe you can use VBScript if all you want to support is IE, but every other browser will reject it. They are not that different, except that javascript looks like Java, and VBScript looks like VB.
mathuros_paiboon wrote:
Could you tell me an example or website that can solve my problem, please
There are plenty of javascript tutorial sites, they are only a google away, but I say again - you're doing things the hard way. If you just generate your page using ASP.NET, there's a ton of info on this site and heaps of people who will be able to help you with what will then become a very easy task. Otherwise, I'm sure there are plenty of javascript sites out there as well, but I don't know of any ( I avoid javascript where-ever possible because jscript is supported by all browsers, but not always in the same way ).
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
<xsl:stylesheet version="1.0"
="" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:asp="http://schemas.microsoft.com/intellisense/ie5" xmlns:state="http://www.vbxml.com/state" xmlns:str="http://www.vbxml.com/string" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<xsl:param name="calories">1500
<xsl:template match="/">
<xsl:for-each select="//form_name[@name=$calories]//*">
<xsl:if test="name() = 'activity'">
activiry | score | comment | <xsl:value-of select="@sub_group"> | <xsl:apply-templates> | | </td>
</xsl:if>
</tr>
</xsl:for-each>
</table>
<button id = "btn_score">summary score</button>
</xsl:template>
<xsl:template match="activity">
<xsl:value-of select="activity"/>
</xsl:template>
</xsl:stylesheet>
My problem
I add textbox (id = "score") and textarea (id = "comment") I want to get data form all textbox to calculate (make summary score) and to calculate percent
How I write command, can someone help me, please |
|
|
|
|
|
This is my xslt file
<xsl:stylesheet version="1.0"
="" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:asp="http://schemas.microsoft.com/intellisense/ie5" xmlns:state="http://www.vbxml.com/state" xmlns:str="http://www.vbxml.com/string" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<xsl:param name="calories">1500
<xsl:template match="/">
<xsl:for-each select="//form_name[@name=$calories]//*">
<xsl:if test="name() = 'activity'">
activity | score | comment | <xsl:value-of select="@sub_group"> | <xsl:apply-templates> | | </td> </xsl:if>
</tr>
</xsl:for-each>
</table>
<button id = "sum_score">summary score</button>
</xsl:template>
<xsl:template match="activity">
<xsl:value-of select="activity"/>
</xsl:template>
</xsl:stylesheet>
QUESTION
I add textbox (id = "score) for user and add button (id = "sum_score") I want to get data in all textbox to calculate the summary of score and calculate percent
can someone have a suggestion for me, please |
|
|
|
|
|
Did you check Do not treat <'s as HTML tags ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thank you for your suggestion, and I post the question again and check "do not treat"
please review my xslt file
Thank you
|
|
|
|
|
I have problem about xslt command
I retreive data form xml with xslt and add textbox/checkbox/textarea for receive data form user, and I want to use this data to calculate and save in another xml file , how I write the xslt command
I use asp.net with vbscript
Thank for help
|
|
|
|
|
XSLT accepts parameters, and passing them in via VB.NET is very easy. Here's an example from my code:
XsltArgumentList xsltArgs = new XsltArgumentList();
xsltArgs.AddParam("id", "", this.ClientID);
xsltArgs.AddParam("seldata", "", this.SelectedNodeData);
xsltTree.Transform(xData, xsltArgs, output, null);
If you look up the AddParam command in MSDN, you'll see the XSLT examples you need.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I have an application which ran fine under windows 2000. It is browser based and uses XMLTransform. The Authentication requirment is that the user must be either integrated or Digest (anonyomous is not allowed).
When I try to run the browser pages I get an error from xmltransform indicating that the rights are not correct. The probelm is even though I enter my user name and password to be authenticated, the program reports that I am accessing as :Authentication anonymous. A request.ServerVariables("AUTH_USER") reports blank (anonymous).
I have everything configured the same as on the windows 2000 machine as far as IIS only allowing integrated access yet I is not happening and the application control pages all .asp do not come up. Anonymous access is not allowed anywhere on the server yet this is continual.
Any Ideas?
Jan Michael
|
|
|
|
|
hi,
These contents i want to insert after farm elements where farm is equal to dev2
here is syntax of node element which i want to insert
<database state="0" name="one" sourceType="amacs">
<database>
I want Xml(database) to be inserted after farm where farm is equal to "dev2"
I am giving you the structure of XML file
<?xml version="1.0" encoding="UTF-8"?>
<root>
<farm-config>
<farm name="dev1">
<connection address="localhost" user="root" selectedConnection="1" password="ram">
<lastJob>Copy-All</lastJob>
<lastConnection startdate="2005-05-10" starttime="12:43:23" enddate="2005-05-10" endtime="12:58:32" />
<state>1</state>
</connection>
<database state="0" name="bd_plc1_house1_14022005" sourceType="amacs">
<tables state="0" name="feed_delivery">
</table>
</database>
</farm>
<farm name="dev2">
<connection address="localhost" user="root" selectedConnection="1" password="ram">
<lastJob>Copy-All</lastJob>
<lastConnection startdate="2005-05-10" starttime="12:43:23" enddate="2005-05-10" endtime="12:58:32" />
<state>1</state>
</connection>
</farm>
</farm-config>
</root>
i have the code pls anybody can modify it
This code is giving an syntax error
xmldoc.DocumentElement["farm name='dev2'"].PrependChild(databaseElement);
regards
sanjeev
|
|
|
|
|
Most likely cause of an error is that
ksanju1000 wrote:
xmldoc.DocumentElement["farm name='dev2'"].
is returning null. Given that you don't tell us the error ( despite asking this several times), I have to guess.
Assuming that farm name='dev2' is an XPath, you need //farm in order to find the node, unless you're at the level directly above it. Also, I believe that @ is required to show that you're matching a property in the node, but I am both rusty on XML, and quite sick at the moment, so I could be having a bad hair moment there.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian's 99% of the way there (if you *are* using XPath...)
The syntax you want is:
xmldoc.DocumentElement["//farm[@name='dev2']"].PrependChild(databaseElement);
HTH!
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
Hi
This path gives syntax error(Object reference not found)
can you again try
xmldoc.DocumentElement["//farm[@name='dev2']"].PrependChild(databaseElement);
This does not work
|
|
|
|
|
Hello all,
I'm trying to take an XMLnode (found with .SelectSingleNode()) from one document and copy it into another document. I keep gettting an error message that they are not the correct type. Anyone have some examples of the .clone function in VB.net 2005??
Thanks, Jeff
|
|
|
|
|
jeffb_ wrote:
VB.net 2005
I don't know how in 2k5, let be alone in VB... In good ol' .NET1.1 XML elements art in "document context" so elements can be used only within XmlDocument which created them.
(Just checked, work same way in .NET 2.0)
Well XmlNode ( so XmlElement too ) implements ICloneable . Should not be a problem.
David
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
Hi
I am trying to generate a XSD schema from a xml file by using a stream writer.
I created a dataset and read XML into that dataset.
Now I am trying the ds.WriteXmlSchema();
Actually it works correctly...but my issue is I want to send the written schema into a textbox on button click.
How would I do that?
This is the code I wrote for writing the schema:
System.IO.StreamWriter swXML= new System.IO.StreamWriter();
ds.WriteXmlSchema(swXML);
textBox1.Text =swXML.ToString();
|
|
|
|