|
Use the document() function - possibly something like the following might work?
<xsl:template match="info[@file]">
<xsl:apply-templates select="document(@file)"/>
</xsl:template>
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi Experts,
I am developing 3 Tier Architecture with Web Service.
Graphically as : (Overall Structure)
UI (C# Application) <----> BLL (Web Service) <----> DAL (C# Application) <----> Physical DB (SQL Server 2008)
My question is that, I need some professional coding tips from you guys.
Right now, System is ready with me.
Sample code would be greatly appreciated.
Note : I am using C#.Net (.Net FW 3.5) and SQL Server 2008.
Thanks.
Vijay Jadhav.
|
|
|
|
|
Hi,
I'm using an XmlSerializer and TextReader to read some XML:
XmlSerializer ser = new XmlSerializer(typeof(MyClass));
TextReader tr = new StreamReader(filename);
MyClass myClass = (MyClass)ser.Deserialize(tr);
With this I can read the XML and populate the myClass object with simple string values even when one of the myClass members is a class itself. It all works fine up to a point in my XML file which lists multiple messages so the XML is like this:
<MyClass>
<application>
<name>MyApp</name>
</application>
<messages>
<message>
<value>Error</value>
</message>
<messagegt;
<value>Warning</value>
</message>
</messages>
</MyClass>
I can deserialize the application part of the XML into a class member in my MyClass object but I need to deserialize the messages into a Messages class member which is some sort of collection of messages.
Can anyone help? Is there some collection class I can use that will work?
|
|
|
|
|
Hi
Can anyone tell me how to generate an XML file using a typed dataset?
I have a typed dataset called _WorkStationDataSet. But WriteXml() can not be called direclty from it, I have to create a new instance of it using:
_WorkStationDataSet ds = new _WorkStationDataSet(), but then calling WriteXml() on ds does not create a hierarchical xml file, instead it just puts two lines of xml at the top of the file showing the name of the dataset.
|
|
|
|
|
What I also want to know, is say for instance you have 2 tables; Categories and Products. And the relationship between them is one-to-many (A category can have many products). Is it possible to generate an XML file showing all the different categories as well as the products belonging to them hierarchically?
<Category id=1><br />
<Product id=1><br />
<name>milk</name><br />
<description>white</description><br />
<price>3.00</price><br />
<Product id=2><br />
<name>cola&/name><br />
<description>black&/description><br />
<price>3.00&/price><br />
<Category id=2><br />
<Category id=3>
|
|
|
|
|
Hi
I'm using a typed dataset which was generated for me by adding a new data source via the visual studio wizard. My problem is, when I call the WriteXml
method on my dataset (e.g. dsDemo.WriteXml) it creates an XML file yes, but the only thing in the XML file is the following:
<?xml version="1.0" standalone="yes" ?>
<_Workstation_aXYZDataSet xmlns="http://tempuri.org/_Workstation_aXYZDataSet.xsd" />
Why does it not show all my table data?
|
|
|
|
|
Did you add any data to the dataset?
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
I've been using this code to produce a string representation of some xml that I output to a webpage:
<br />
XslCompiledTransform transform = new XslCompiledTransform();<br />
transform.Load(XSL);<br />
StringWriter writer = new StringWriter();<br />
transform.Transform(EMailDocument, null, writer);<br />
return xml = writer.ToString();
Now I need to change the code so that instead of a string I get back the output XmlDocument. My first attempt just to get things moving was to pump the output of the above into the LoadXml() method of the XmlDocument but I get errors about matching tags, I suspect because of the whitespace (\r\n etc) that is in the text.
Does anyone have an easy way of transforming a document into another document?
Cheers
Russell
|
|
|
|
|
Russell Jones wrote: Does anyone have an easy way of transforming a document into another document?
It's been a few years but there were methods that returned XmlSource or maybe XmlNode or some such thing in early versions of the BCL. However even if you use something like that with XSLT that is producing illegal XML ( Not well formed ), it will produce a similar error that LoadXML() does.
Russell Jones wrote: but I get errors about matching tags
So I imagine you need to fix your XSLT either way. I've never tried it but if you set the XSLT output type to XML the XSLT processor might error and not even produce the string output.
|
|
|
|
|
i am using this code required result is not obtained
DECLARE @DataColumnListInXML XML
SELECT @DataColumnListInXML='
<columnfeature>
<feature>
<featureid>1
<columns>
<id>1<id>
<id>2
DECLARE @IColumnList int
--Create an internal representation of the XML document.
EXEC sp_xml_preparedocument @IColumnList OUTPUT, @DataColumnListInXML
SELECT featureID,ID FROM OPENXML (@IColumnList, '/ColumnFeature/Feature/Columns',3)
WITH (ID varchar(19),
featureID varchar(19)
)
hi
|
|
|
|
|
I am very new to xml...so please bear that in mind as I ask this question.
I worte a very simple tee menu in xml, and my goal is to transform this to HTML so that it can be viewed through the browser.
I have done some reading on this subject and know that I can use either XSLT or possibly parsing the XML with Windows...but I have not been successful on my own.
Below is a snippet of the xml menu:
<menu><br />
<style>left menu</style> <br />
<br />
<name>BIMI Menu</name> <br />
<br />
<entry><br />
<name>Home</name> <br />
<br />
<url>index.htm</url> <br />
<br />
</entry> <br />
<menu><br />
<name>HBCA</name><br />
<menu><br />
<name>Actuate</name><br />
<menu><br />
<name>Direct Weekly</name><br />
<entry><br />
<name>DR03w - Direct Weekly</name><br />
<url>#</url><br />
</entry><br />
</menu><br />
<menu>
This tree menu is to be 3 levels deep...and I when it is viewed in HTML I want the users to be able to click on the entries to view the next level.
I know I can add customization to this like gif images and expand/collapse, which I can code in javascript....but I can not seem to at least view this menu outside of default xml.
Please assist me...it would be greatly appreciated!
|
|
|
|
|
Salvatore Conti Jr wrote: I am very new to xml...so please bear that in mind as I ask this question.
OK
Salvatore Conti Jr wrote: I have done some reading on this subject and know that I can use either XSLT or possibly parsing the XML with Windows...but I have not been successful on my own.
That doesn't tell us what specific help you need.
Possibly you need to do more studying of the XML technology space. Try the tutorials at www.w3schools.com. Also remember that the XML technologies don't care that you want to produce valid HTML, that's up to you to understand what HTML you need your XML and XSLT to produce.
|
|
|
|
|
Hi...
when I apply xsl transformation, no output is obtained. Can anyone help me?
My xml file is
---------------------
<?xml version="1.0" encoding="utf-8"?>
<Data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MySpace>Testing</MySpace>
</Data>
---------------------
My xslt file is
-----------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" indent="yes"/>
<xsl:template match="/">
<value-of select="MySpace"/>
</xsl:template>
</xsl:stylesheet>
-----------------------
Thanks
Fadi
|
|
|
|
|
Fadi Yoosuf wrote: when I apply xsl transformation, no output is obtained.
When you apply it how? In what context?
|
|
|
|
|
|
Fadi, the bad news is you don't appear to have the requisite knowledge of the technologies you are working with to be attempting this task. A Web Browser is only going to display HTML.
|
|
|
|
|
Thanks alot for the effective criticism.
I overestimated (mistook) like the system had the facility to convert xml/text formats to html.
Anyway "alerted hereafter"
thanks
Fadi
|
|
|
|
|
Led,
You argued like "A Web Browser is only going to display HTML."
Was it a blind response?
When you get time, make an html file, open it in edit mode and paste plain text in that. Try viewing in a browser and you can still see the plain text (which was written without html markups).
Now try creating another .html file and paste some xml conent in that. Try viewing in a browser and you can still see the innertext of html nodes in a non formatted manner.
Can you pls. explain the reason for this w.r.t. your argument??
Also can you try the default xml given in http://www.w3schools.com/xsl/tryxslt.asp?xmlfile=cdcatalog&xsltfile=cdcatalog[^].
Just change the xslt content as follows
----------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy® -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:for-each select="catalog/cd">
<xsl:value-of select="title"/>
<xsl:value-of select="artist"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
----------------------------
Now can you pls explain why the output is displayed in the browser even if it is in text format??
If you find a solution, can you pls. explain what is wrong with my code in the first post??
Sorry for disturbing you again
It would be nice of you, if you can convince me with a good answer
Thanks
Fadi
|
|
|
|
|
Fadi Yoosuf wrote: Now can you pls explain why the output is displayed in the browser even if it is in text format??
It's not displayed in my browser. That is why I posted what I did and it's as far as I got in debugging your error. I was wrong. Thankfully George Jackson has backed me up and hopefully provided you with the solution.
[modified]
What is wrong with this post? You asked me to explain and I did?
|
|
|
|
|
The "MySpace" element is not the child of the root node as indicated in: <xsl:template match="/"> . Also, "value-of" needs to be "xsl:value-of".
"We make a living by what we get, we make a life by what we give." --Winston Churchill
modified on Monday, June 1, 2009 2:12 PM
|
|
|
|
|
thank you very much George.... it is really helpful @ this situation...
led, lemme thank u also for ur efforts.(but you should understand the seriousness of misguiding someone(and all who read the post) with respect to a temporary output. there were errors in my xslt. you didn't even point out that. What if I had blindly believed you!!!!!)
|
|
|
|
|
Hi Experts,
My Xml is :
<?xml version="1.0" encoding="utf-8"?>
<Sis xsi:noNamespaceSchemaLocation="Sis.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Student>
<StudentID>1</StudentID>
<AcademicDetails>2008-2009</AcademicDetails>
<PersonalDetails>
<FirstName>Vijay</FirstName>
<MiddleName>Laxmanrao</MiddleName>
<LastName>Jadhav</LastName>
</PersonalDetails>
</Student>
</Sis>
I need to extract the value of xsi:noNamespaceSchemaLocation (ie. Sis.xsd).
How to get it ?
I have try below snippet, but it will show sXSDFile always null. Why ?
public static bool ValidateXml(Stream oXmlStream)
{
string sXsdPath = "";
string sXSDFile = "";
try
{
XmlTextReader xmlTextReader = new XmlTextReader(oXmlStream);
sXSDFile = xmlTextReader.GetAttribute("xsi:noNamespaceSchemaLocation");
}
catch (Exception ex)
{
_isValied = false;
}
return _isValied;
}
Sample code would be greatly appreciated.
Thanks.
Vijay Jadhav.
|
|
|
|
|
Hi All,
I got it.
Code snippet :
XmlTextReader xmlTextReader = new XmlTextReader(oXmlStream);
xmlTextReader.MoveToContent();
sGetXsdFileName = xmlTextReader.GetAttribute("xsi:noNamespaceSchemaLocation");
Thanks.
Vijay Jadhav.
|
|
|
|
|
Hi
How can I render the custom server side control like user controls etc using XSLT on my webpage?
|
|
|
|
|
I want to print XSLT(HTML and PDF) file, in my file has many paragraph
and i dont know how many line in paragraph. My problem is i dont want
want to print any paragraph in split pages.
Thanks
|
|
|
|