|
am using the xml file to imoprt data to my Page but xsl style sheet is not applying to the WEb page my code is : (using ASP.NET)
Dim xmlPath As String = Server.MapPath("XMLFile.xml")
Dim xslPath As String = Server.MapPath("XSLTFile.xsl")
Dim fs As FileStream = New FileStream(xmlPath, FileMode.Open, FileAccess.Read)
Dim reader As StreamReader = New StreamReader(fs, Encoding.UTF8)
Dim xmlReader As XmlTextReader = New XmlTextReader(reader)
'Instantiate the XPathDocument Class
Dim doc As XPathDocument = New XPathDocument(xmlReader)
'//Instantiate the XslTransform Class
Dim xslDoc As XslCompiledTransform = New XslCompiledTransform()
xslDoc.Load(xslPath)
Dim sw As StringWriter = New StringWriter()
xslDoc.Transform(doc, Nothing, sw)
' //Close Readers
reader.Close()
xmlReader.Close()
Response.Write(sw.ToString())
Feroze
|
|
|
|
|
The code looks ok to me, so I guess the error is within the stylesheet. It would be helpful to see the XML and XSLT file (or at least some exemplary parts).
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
HI,
How can i transfer sql data to the xml file plsssss give me the solution
C.P.Desai
|
|
|
|
|
You can visit this web-page. I think this helpful.
http://www.15seconds.com/issue/001102.htm
SELECT store.stor_id as Id, stor_name as Name, sale.ord_num as OrderNo,
sale.qty as Qty
FROM stores store inner join sales sale on store.stor_id = sale.stor_id
ORDER BY stor_name
FOR XML <MODE>
* RAW Mode or AUTO Mode
|
|
|
|
|
i am using the xml file to imoprt data to my Page but xsl style sheet is not applying to the WEb page my code is : (using ASP.NET)
Dim xmlPath As String = Server.MapPath("XMLFile.xml")
Dim xslPath As String = Server.MapPath("XSLTFile.xsl")
Dim fs As FileStream = New FileStream(xmlPath, FileMode.Open, FileAccess.Read)
Dim reader As StreamReader = New StreamReader(fs, Encoding.UTF8)
Dim xmlReader As XmlTextReader = New XmlTextReader(reader)
'Instantiate the XPathDocument Class
Dim doc As XPathDocument = New XPathDocument(xmlReader)
'//Instantiate the XslTransform Class
Dim xslDoc As XslCompiledTransform = New XslCompiledTransform()
xslDoc.Load(xslPath)
Dim sw As StringWriter = New StringWriter()
xslDoc.Transform(doc, Nothing, sw)
' //Close Readers
reader.Close()
xmlReader.Close()
Response.Write(sw.ToString())
please tell me about the problem!
Feroze
|
|
|
|
|
Hi all,
How can I convert all the data that is present in SQL server in to XML format. If its big, then atleast provide me some link. Thank you.
Regards,
S/W Engineer
Akebono Soft Technologies
aleem_abdul@akebonosoft.com.
|
|
|
|
|
is there any easy way to get these RSS feeds on my website[which is collected from any feeder] and cutomizing them to blend in with my page without navigating to the providers page while clicking the link
A SIMILAR EXAMPLE CAN BE SEENED AT www.newkerala.com
how it works
can you plzzzz help me
RIYAM HUSSAIN
Sr.SOFTWARE DEVELOPER
INFORPARK, KOCHIN
|
|
|
|
|
Solution is to create XSLT sheets and transform RSS feeds with these stylesheets to fit your site's look'n'feel.
See:
http://www.codeproject.com/soap/reallymostsimplesyndctn.asp
-------------------------
Don't worry, be happy )
|
|
|
|
|
I want to send XML file as a DOM object from client to server.. server receive the DOM object..
plz tell how I can do that?? using VC++
|
|
|
|
|
hi,
iam trying to learn AJAX. i have a problem with xml file.the problem is i need to add some attributes to each tag in the xml file which i generate by writexml method of dataSet.
i tried to fill the dataSet with the adapter then i write it in an xml file but i need to re-format the xml file to add some attributes and change the order of tags.
all that because i wanna use CascadingDropDownList control from AJAXContoltoolKit. who use this control will understand my problem.thanks and i wish i explain my problem clearly.
thanks for any suggestions
|
|
|
|
|
Sounds like a job for XSLT. The .NET Framework provides classes for this in the System.Xml.Xsl namespace. If you want to get to know XSLT in general, take a look at this site: XSLT Tutorial[^]
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi all,
I need to be parse the XML file. So, please send any light weight XML parser library in Visual studio 2005.
Already I have been tried one XML parser. But there is some memory problem would arrive whenever run my application. The name of that one is "Apache's Xerces C++ Parser" by Fengjun Lv.
Thanks in advance
|
|
|
|
|
You could use XmlDocument or Xmlreader ; both contained in the System.Xml namespace of the .NET Framework Class Library.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
How I can send XML packet over network? and How I can received that packet on server..
|
|
|
|
|
The XmlDocument.Load and XmlDocument.Save methods have overloads that take a Stream object, so you should be able to pass in a NetworkStream. Alternatively, you could use the XmlTextReader and XmlTextWriter . Both have a constructor that also takes a Stream object.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
I have an xml document where certain elements have attributes with generic names and values. Like this:
Data.xml
<DATA sport="football">
<ROW firstname="John" lastname="Doe" s1="130" s2="3" s3="43.3" />
</DATA>
And I have metadata which describes the data. The metadata is not in XML format so if there is an alternative to what I'm attempting to do, please let me know. But what I am trying to do is put the metadata in the following format:
Meta.xml
<METADATA>
<FIELDS sport="football">
<FIELD field="s1" name="RushingYards" />
<FIELD field="s2" name="RushingAttempts" />
<FIELD field="s3" name="RushingYardsPerCarry" />
....... blah, blah, blah .....
</FIELDS>
</METADATA>
I want to create a stylesheet that can use "Meta.xml" to transform Data.xml into this:
<DATA sport="football">
<ROW firstname="John" lastname="Doe" RushingYards="130" RushingAttempts="3" RushingYardsPerCarry="43.3" />
</DATA>
The part I don't know how to do is to tell the XslTransform object to transform Data.xml and use Meta.xml as variable input. Can I simply pass Meta.xml in as a parameter to XslTransform?
|
|
|
|
|
I solved it myself - I ended up using an XmlReader to read Data.xml. Then instead of using Meta.xml I just used the metadata in it's original tabular format. As the process reads Data.xml it looks for ROW elements and checks the names of the attributes against the metadata. While reading Data.xml I create an XmlTextWriter to correspond to the XmlReader. If I need to change the attribute name or value I substitute, otherwise I just output the data from the XmlReader.
|
|
|
|
|
I've made a C# application which modifies XML files, but sometimes the resulting file contains the BOM header (EFBBBF hex as first three characters) which the systems which need to take the updated file as input do not accept.
I know I could probably open the file after modification and remove the characters, but that seems like a hack.
Is there a way to specify the encoding to be something different (or any other way) so that it doesn't create this? The code I'm currently using to open the file is:
try<br />
{<br />
xmlDoc = new XmlDocument();<br />
xmlDoc.Load(Filename);<br />
<br />
xpathNav = xmlDoc.CreateNavigator();<br />
return true;<br />
...
|
|
|
|
|
I think it is more interesting to see the code that saves the XML files.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
The code I use to save the file out is very simple, the iterator is an XPathNodeIterator and the doc is an XmlDocument
<br />
xpathIter.Current.SetValue(NewValue);<br />
xmlDoc.Save(Filename);<br />
|
|
|
|
|
I assumed that but just wanted to make sure. I never came across a property or similar that lets you adjust the usage of a BOM header and after a quick glance at MSDN I also did not find one. In your original post you said that the BOM header is only sometimes put in front of the XML markup. Are you able to narrow this down the some concrete conditions under which this happens?
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
The input XML files are configuration files from hardware units, but the format differs slightly depending on the version of hardware. I have only just come up against this BOM header insertion, but it seems like it could be a certain age (not sure whether it's newer or older at the moment) hardware gives an XML file which ends up being edited in my application and the BOM header added.
The file does have the UTF-8 ?xml tag at the top which I am assuming is causing the BOM header to be added by the .NET parser, but that's the bit that causes the hardware unit to not accept the new config file.
|
|
|
|
|
Ok, in case you're using Framework 2.0, there may be a way to get around your problem. The XmlDocument.Save method has an overload that takes an XmlWriter object. The XmlWriter class has a overload of the static Create method that takes a filename and a XmlWriterSettings instance (class is new in 2.0). This class exposes a Encoding property that allows to specify the text encoding to be used. Finally there is the UTF8Encoding class that has a constructor taking a boolean that specifies whether the byte order marked is provided or not.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Fantastic, that sounds like what I need. I'm using 2.0, so I'll take a look at writing out in that way.
Thanks a lot
|
|
|
|
|
That seemed to do the trick, but using this method the XML file is saved without line breaks at all. I've tried changing the various options of XmlWriterSettings but can't work out how to make sure the file is formatted properly. When I was just using xmlDoc.Save it was laying the file out correctly but adding the BOM, now it's saving the file in the right encoding (I chose ASCII rather than UTF-8 as that's what the files I'm editing are in) but without the formatting (which again is causing errors with the hardware units).
|
|
|
|