|
Anonymous wrote:
unfortuntly I must use it.
That says everything!
David
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
I’ve got a problem, I’m hoping someone out there has the answer to. I am a .Net programmer working for a small educational software company. I need to add some simple reporting to the project I am working on. Basically, I need to take some data from my database and format a RTF document from it that can then be displayed in a rich text box or printed or saved or whatever. Unfortunately RTF code is not so easy to understand.
I was told by someone that I could use XSLT to do this. After some reading I found out that this is not exactly correct. You can use XSLT, however you still need to be able to write RTF code. I could use XSL-FO, but since .Net does not implement XSL-FO, I would need to use a third party tool in order to transform my XML data and XSLT stylesheet to RTF. My company doesn’t want to pay for one of these third party tools, nor do they want to deal with any complex licensing issues, that come along with them.
Does anyone have any suggestions on how I can accomplish this task? The reports are not complex, just some simple text formatting and tables.
Thanks for your help
|
|
|
|
|
Hi David. Would an HTML format be acceptable for your reports? I'm seeing more and more reporting modules producing HTML output that in the past would have been .rtf, and the code to launch an .html report in the default browser is simple.
|
|
|
|
|
HTML would be ok. If it could look the same on the screen as it would on printed paper. Also, I would have to learn HTML, which I thankfully have been able to avoid up to this point. Can HTML do tables and margins and such? Forgive my ignorance.
Also, the end users of the application's reporting feature will be school teachers, who aren’t known for being very computer savvy. If I use the default browser to open and view reports, I’ll get thousands of tech support calls because a teacher has lost the browser window behind the application window. It’s hard to explain the concept of “[Alt]+[Tab]” to school teachers. The application hides the task bar so that kids aren’t messing with it instead of using the application.
If I were to use HTML, I would have to use one of those browser window controls on a form in order to prevent the “[Alt]+[Tab]” problem.
Thanks
|
|
|
|
|
hi,
david@mindplay.com wrote:
Also, I would have to learn HTML, which I thankfully have been able to avoid up to this point.
thankfully? hmmm. HTML is nice. CSS is cool. XML is almost perfect.
(yes I am web developer )
david@mindplay.com wrote:
Can HTML do tables and margins and such? Forgive my ignorance.
Even more. With use of CSS, you have lot of freedom in appereance.
david@mindplay.com wrote:
If I use the default browser to open and view reports, I’ll get thousands of tech support calls because a teacher has lost the browser window behind the application window.
hmm. .NET can use Microsoft WebBrowser control - Using the WebBrowser control in .NET Article[^]
And .NET Framework 2.0 has native WebBrowser control for .NET
After quick search, there are some tutorial on HTML & related stuff:
HTML Guide article[^]
CSS For Beginners article[^]
W3C - My favourite Web standard organization[^]
And W3C Schools, great tutorials for web (recommended)[^]
best regards,
David 'DNH' Nohejl
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
I would need the end product to be one single file, so that it can be saved or emailed. If I use XSLT to transform my data into HTML then it would be one file. I don't know much about CSS. Can I use CSS to create an HTML file or would I essentially have two files my XML and my CSS?
Thanks
|
|
|
|
|
hi again
if you need one file, you can use inline CSS. CSS if for formatting HTML, you can write (generate with XSLT) it inside your html file.
Example:
(bold part is inline CSS)
HTML Source:
<code>
<h1 style="color:red">HTML heading 1, coloured to red using css</h1>
</code>
result:
HTML heading 1, coloured to red using css
Got the idea?
much cleaner way is to have css classes (you can define them in external .css file, bt you can do it in style element):
<style>
.red {color:red}
</style>
Use is similar:
<h1 class="red"></h1>
(it gives exctly same result as first example - benfit is that you can reuse defined class many times, and also that CSS effects may overlap - that's why they call it Cascading Style Sheet)
Hope I gave you some ideas. This is only tip of the iceberg! :->
one more note - with css you can nicely control printing
David
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
I see, thank you. I'm reading about CSS right now.
Dave
|
|
|
|
|
Hi,
I have a XML string. I want to load it to Multiple tables using visual basic. How do I do that?
Thanks
|
|
|
|
|
I have implemented WSE security on my .net web service and would like to know how to make a request to the service using perl-lite or Java. Can someone point me to an article that explains how this can be done? Thank you,
Jason W.
|
|
|
|
|
I have to develop a tool which will consist of questionnaires and the user has to rate every category. I have to use XML as data source and the changes made will be stored in the XML file.
I am using a tree view on the left side of the form to display the categories present in the XML file. I want to have details of that category and the questions to be displayed on the right side on clicking any of the node of the tree. Since, the questions will be different for each node present in the tree, can someone suggest me any way to achieve this. I think using a dataset for changing the questions on click of a tree view node will be an option.
can anyone help me with the code. I am struggling frm past 3 and half weeks.
Thanks again.
|
|
|
|
|
well, for some strange reason I do everything the hard way (not using dataset) so my idea doesn't have to be optimal solution. Since dataset si in-memory storage for data, it should be also possible to store data in treeView itself - now I mean Tag property of TreeNode . Let say you have class/structure (say Question )representing your question, than set Tag property to instance (created while reading XML file) of your class Question . When user click tree node, unbox myQuestion = (Question)myTreeNode.Tag and show question in controls of right side of the form...
ashushere wrote:
I am struggling frm past 3 and half weeks.
Did I miss something? (OTOH I am working on something what I expected to be finished before 20th of December )
best regards,
David 'DNH' Nohejl
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
Working with WSE 2.0 I would like to modify the UsernameToken to include an additional string value to be passed in along with the username and password by the client. Is this possible? Can someone point me to an example of it being done? Thank you,
Jason W.
|
|
|
|
|
Never mind, I figured out how to work around this which was an easier solution.
Jason W.
|
|
|
|
|
I can not read a XML file with or without a scheme using XMLDocument.LoadXML() without getting an exception.
Thanks for your suggestions.
Given this XML file name 'simple1.xml'
<?xml version="1.0" encoding="utf-8" ?>
<book>
<title> my books title</title>
</book>
I had hoped to read it in with this code.
string pathfilename = @"C:\XML_Class\Example\ReadWriteFamily\simple1.xml";
try
{
XmlNode currNode;
XmlDocument doc = new XmlDocument();
//The LoadXml statement throws this exception
//"System.Xml.XmlException: The data at the root level is invalid.
//Line 1, position 1.\r\n at System.Xml.XmlTextReader.ParseRoot()\r\n
//at System.Xml.XmlTextReader.Read()\r\n at System.Xml.XmlValidatingReader.ReadWithCollectTextToken()\r\n
//at System.Xml.XmlValidatingReader.Read()\r\n at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)\r\n
//at System.Xml.XmlDocument.Load(XmlReader reader)\r\n at System.Xml.XmlDocument.LoadXml(String xml)\r\n
//at ReadWriteFamily.Form1.ReadSimple1_Click(Object sender, EventArgs e)
//in c:\\xml_class\\example\\readwritefamily\\form1.cs:line 236" string
doc.LoadXml(pathfilename); //exception throw here
XmlDocumentFragment docFrag = doc.CreateDocumentFragment();
docFrag.InnerXml="<title>inserted title</title>" ;
// insert the availability node into the document
currNode = doc.DocumentElement.FirstChild;
currNode.InsertAfter(docFrag, currNode.LastChild);
//save the output to a file
//doc.Save(pathfilename2);
}
catch (Exception eException)
{
string s =eException.ToString();
Console.WriteLine ("Exception: {0}", s);
}
}
}
|
|
|
|
|
method LoadXml() method takes as parameter actual markup, not filename. That's why it throws exception, cuz "C:\XML_Class\Example\ReadWriteFamily\simple1.xml" is definitely not a valid well-formed XML markup Use Load() method instead.
best regards,
David 'DNH' Nohejl
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
|
I have a project that uses a style sheat to transform data. I want to save the result into DB to use at a later time. When I convert the stream to a string, or attempt to load it back into a dom doc, it fails.
Code: C# -- Out ms is memory stream
xslt.Transform(XmlDoc, null, OutMS, null);
returnXML = System.Text.Encoding.Default.GetString(OutMS.ToArray());
I have tried every type of encoding. utf 8, 16 etc...
Unprintable characters on the front of every one.
Thanks T. J.
|
|
|
|
|
well I don't have experiences with this, bt you could take a look at XmlResolver as I suspect you need to provide it in order to deal with entites - and I *think* (read I have no idea) XSLT could encode some unprintable characters - since whitespace is normaly not an issue as XML processors ignore it.
I also remeber guy who had problem with encoding (XML in string) and I think he solved it with String.Replace(). Try search forum...
I am not sure, I may say BS so plz correct me if I am wrong...
best regards,
David 'DNH' Nohejl
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
Found the solution Thanks anyway. Here it is if anyone wants to know.
There is a stringwriter object based on textwriter that will work. here is the code.
StringWriter writer = new StringWriter();
////////////////////////////////////////
// Load Template into Transformer and //
// Transform the XML that came in //
////////////////////////////////////////
xslt.Transform(XmlDoc.CreateNavigator(), null, writer, null);
returnXML = writer.ToString();
Thanks T. J.
|
|
|
|
|
I am trying to write a schema to validate an xml file. I can get it to validate everything correctly. I have one problem though. In the xml file, after a certain element, I am not going to know what will be there.
ex.
<Node1>
<Node2>
<Node3>
//After this point, the layout could change at any time (and without notice I might add)
//and I don't want to have to keep changing the schema everytime the layout changes.
</Node3>
</Node2>
</Node1>
Anyways, my question is, how would I write the schema to stop the validation at that point? Thanks.
|
|
|
|
|
hi,
<xs:any> should do the job.
W3C XML Schema spec.[^]
best regards,
David 'DNH' Nohejl
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
When I change it I get this exception "The 'http://www.w3.org/2001/XMLSchema:any' element is not supported in this context". Any advice.
|
|
|
|
|
Nevermind, I changed it to
<xs:complexType name="Node4">
<xs:sequence>
<xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="skip" />
<xs:sequence>
<xs:complexType>
<xs:element name="Node4" type="Node4" minOccurs="0" maxOccurs="1" />
Maybe not that exactly, but it worked. Thanks for the help
|
|
|
|
|
I have been teaching myself XML for a short time noe, and I want to move into using it with JavaScript for web sites. However, I would like to avoid using the typical "new ActiveXObject(Microsoft.XMLDOM)" line. Is there an alternative to ActiveX/Microsoft?
|
|
|
|