I have been contemplating writing a generic calculation engine for Tax Computations, and was wondering if it would be possible to write such a thing that required each years coputational calculations to be defined in XML and data then to also be held in XML. The generic calculation component then uses the instructions in XML to explain how to do the calculation so that the same component can be used for any years tax computation, and output numerous results to a separate XML file.
I would appreciate any advice any of you "experts" can give me on such a project. Would it be possible??
Sure. Your basically talking about a XML Processor much the same as XSLT or any other. You define a language and then develop the processor right? Not that it is a simple task to complete but the concept is simple.
"No matter where you go, there your are..." - Buckaoo Banzi
Hi, I am trying to create a generic xsl file to display query results. The column names depend upon the query, so I dont want to hardcode them. What I have is close to what I need, but I get one row of column headings for each row of data. (Just one would do!)
I can see that the for-each command in the table header is causing the problem, but I'm not sure how to select just one row. Any advise would be really helpfull. Thanks.
My data looks like this:
<?xml-stylesheet type="text/xsl" href="generic.xsl"?>
<?xml version="1.0" encoding="UTF-8"?>
I'm using MSXML to produce a XML Doc from a Tree Control in my VC++ program. I am getting an weird error while trying to create XMLNodes.
DOMNodePtr[i]=ptrDocIP->createElement(strRoot.AllocSysString()); //ptrDocIP is of type IXMLDOMDocumentPtr and sysRoot is CString
I'm using the above statement in a fuction and I call that fuction repeatedly to add new nodes. When I add the first nodes, I don't get any exception, but, second time I get an Exception and the program terminated.
I tried with createNode function and got the same error.
Can anybody help?
I have a problem with serializing a class, which has a variable with an abstract-class-type.
If I'm using the specific class Test2, everything works fine,
but when I use the abstract class Test, I get the following error-message:
An unhandled exception of type 'System.InvalidOperationException' occurred in system.xml.dll
Additional information: There was an error generating the XML document.
Does anybody know whats the matter here?
static void Main(string args)
myObject o = new myObject();
XmlSerializer mySerializer = new XmlSerializer(typeof(myObject));
StreamWriter myWriter = new StreamWriter("test.xml");
public class myObject
//public Test2 t = new Test2();
public Test t = new Test2();
public abstract class Test
public string s = "Test";
public class Test2:Test
new public string s="Test2";
As the documentation states, serializable classes must have a publicly accessible default constructor because they are instantiated. Abstract classes cannot be instantiated, however. That is the problem.
The solution is easy: don't hardcode the type (using typeof in your example) in your serializable code. For one, one of the benefits (one could say, the "point") of using abstract classes is that you can use a generic to refer to multiple types without caring about the specific Type of the object. Instead, use o.GetType().
Remember that in OO, even though a variable might be declared as Test or Object (pulling examples from your code), they will still be instances of myObject or Test2. So, using o.GetType() will still return the Type for myObject (even if it were declared as an Object).
If you use that in the constructor for the XmlSerializer, you shouldn't have any problems. This way, also, you don't hardcode that the serializer only accepts myObject. You will want to, however, use a condition or something before serializing to make sure that the object to be serialized is a Test derivative:
publicvoid SaveTest(Test t)
// In this case, the CLR verifies that the object is of type Test// (or a derivative) because the parameter above is a Test type.
XmlSerializer serializer = new XmlSerializer(t.GetType());
StreamWriter writer = new StreamWriter("test.xml");
publicvoid Save(object o)
// In this case, we should check to make sure that the object is// a Test type. For brevity, well check and pass to SaveTest.if (o is Test)
SaveTest(o as Test);
I started using SaveFileDialog in my application.
But the problem is that once I save anything to a directory different than the one that
the application is stored in, an error appears because the application can't get files in this way:
XmlTextReader reader = new XmlTextReader("loc.xml");
I can't store the absut path in my application (like that: schemaColl.Add(null, "d:\MyApp\\\XMLSchema.xsd");
Is there any simple method how to solve this problem?
I've also tried <xsl:strip-space> at the root, but no effect.
I'm translating null to 'x' for now so I know that I'm capturing the nulls correctly, but never get a match; my output always has <myEl> with nulls embedded in it. The output xml is otherwise well-formed.
I solved the problem, which had nothing to do with the XPath queries. My XSL stylesheet is a Content file in a VS.NET project. I forgot that VS DOESN'T copy content files to the output folder. Thus, all of my stylesheet edits were never used!
This is what I ultimately used to remove the nulls:
translate(/myEl, '�', '')
Does anyone know why VS doesn't copy content files to output folder?
In the app i am currently building, I need to display, and print, reports of data records (tables, images, etc). I want to offload the formatting work to someone else, and am currently attempting to give this reponsibility to the WebBrowser activeX control.
I pump out an XML file of the report, and have an XSLT file to format this to html. However, as pretty as this looks in the webbrowser control, it does not print well, as html is continuous.
I have looked into XSL-FO, but this seems too complex for my task. I would like to use print templates in IE, however when i attempt to work with print templates in an xsl file I encounter parsing errors. Any ideas?
Windows Form App contains a pulldown and a datagrid.
The pulldown contains the all the "attribA" values in "section2" of the XML file,
and the datagrid is 2 columns, containg the "param" elements (displays "paramX | 456" in the 2 columns) for the selected element in "section2".
Can this be done with datasets & data binding? Or must I reparse the entire XmlDoc with every change event on the pulldown?
Granted I am much the novice, when it comes to programming, but in my search for a QUALITY book that really allows someone to learn XML, one step at a time, appears NOT to exist!
I have reviewed just about all the books out there, and am a bit surprised that none of them really TEACH xml. Many discuss this and that, but none really set up the foundation and build from there.
If anyone has 'other' information or can give me some ISBN #'s that may be more in-line with my need, I'd SURE appreciate the info.
My primary focus with XML is implementing into ASP.NET at work. Unfortunately for me, my employer does not like to spend money on formal classroom training, so anything I need to learn, I must do by Self-Study.
For those who've been posting articles on "The Code Project", all I can say is THANKS! Without many of the ASP.NET and C# articles, I would be totally bald (Crew cut now).
I am creating my first web service using .net. Will clients using perl lite to access my service run into any problems? Is there anything I need to do to make the web service more friendly to non Microsoft users?
They exist? Ok, just joking. I assume you are talking about this[^]? If so, it looks like it supports both the SOAP 1.1 and 1.2 specs so you should be ok. Have you tried to create a quick example using it, there are plenty of examples listed.
Last Visit: 31-Dec-99 19:00 Last Update: 28-Nov-23 6:22