IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

Profile: rjswider
About
User Name: rjswider
Forum Rank: Member
Real Name: Robert Swider
Location US
Occupation:
Interests:
Gender: None Specified
Statistics
Joined: Friday, March 18, 2005
Last Visit: Tuesday, March 22, 2016 2:07:07 PM
Number of Posts: 6
[0.03% of all post / 0.00 posts per day]
Avatar
Last 10 Posts
Topic: C# XSLT Result
Posted: Tuesday, March 22, 2016 2:07:06 PM
It took a while, and several back-and-forth messages to Altova Support, but I have the fix, for anyone else who encounters it:

On the server, in the server_config.xml file, change the server.unrestricted-filesystem-access option to false.

It is set to true by default. Once you change the value, restart the RaptorXML service, and you should now get the correct result.

Altova support is still looking at whether this is intended behavior or a bug, so the underlying issue is still a mystery, but changing the config definitely fixed the problem.

Topic: C# XSLT Result
Posted: Friday, March 4, 2016 3:03:22 PM
As an update, I put the compiled project on the server where RaptorXML is installed and ran it from there with the same data and transform. The result I get back is "<root/>". I'm confused by this. It seems to be reading my data correctly, but still doesn't produce the expected output. I just thought it was odd that I get different (though not correct) result running it local on the server. Logged data appears to be the same.

Topic: C# XSLT Result
Posted: Friday, March 4, 2016 1:44:29 PM
I'm using RaptorXML 2016. I'm not sure of the build, but I just downloaded it yesterday, so I assume it's the most recent release. I've simplified my code a bit, and the data and xslt are just demo data, but I still get the same result from the server. Incidentally, I checked the server logs, and I see the call come in. No errors are logged:

10.0.1.99 - - [04/Mar/2016:09:13:45] "POST /v1/queue HTTP/1.1" 201 111 "" "RaptorXMLServer/1.1 (COM interface)"
10.0.1.99 - - [04/Mar/2016:09:13:45] "GET /v1/results/F29323A2-9189-44AF-8BFA-E24A1B40EA33 HTTP/1.1" 200 66 "" "RaptorXMLServer/1.1 (COM interface)"
10.0.1.99 - - [04/Mar/2016:09:13:46] "GET /v1/results/F29323A2-9189-44AF-8BFA-E24A1B40EA33 HTTP/1.1" 200 524 "" "RaptorXMLServer/1.1 (COM interface)"
10.0.1.99 - - [04/Mar/2016:09:13:46] "DELETE /v1/results/F29323A2-9189-44AF-8BFA-E24A1B40EA33 HTTP/1.1" 200 - "" "RaptorXMLServer/1.1 (COM interface)"


Code:
void PerformTransform()
        {
            string source = LoadDoc(@"D:\Temp\SourceData.xml");

            string transform = LoadDoc(@"D:\Temp\RaptorTest.xslt");

            string result = CallServer(transform, transform);
        }

        string LoadDoc(string path)
        {
            string docContent = string.Empty;

            using (StreamReader reader = new StreamReader(path))
            {
                docContent = reader.ReadToEnd();
            }

            return docContent;
        }

        string CallServer(string sourceDoc, string xsltDoc)
        {
            objRaptorXMLServer = new Server();
            objRaptorXMLServer.ServerName = "asrtransform";
            objRaptorXMLServer.ServerPort = 8087;
            objRaptorXMLServer.ReportOptionalWarnings = true;

            XSLT xslEngine = objRaptorXMLServer.GetXSLT();

            xslEngine.InputXMLFromText = sourceDoc;
            xslEngine.XSLFromText = xsltDoc;

            return xslEngine.ExecuteAndGetResultAsString();
        }


Source Doc:
Code:
<root>
    <thing>PMXP0048194932-1</thing>
    <thing>PMXP0048194932-2</thing>
    <thing>PMXP0048194932-3</thing>
    <thing>PMXP0048194932-4</thing>
    <thing>PMXP0048194932-5</thing>
    <thing>PMXP0048194932-6</thing>
    <thing>PMXP0048194932-7</thing>
    <thing>PMXP0048194932-8</thing>
    <thing>PMXP0048194932-9</thing>
    <thing>PMXP0048194932-10</thing>
    <thing>PMXP0048194932-11</thing>
    <thing>PMXP0048194932-12</thing>
    <thing>PMXP0048194932-13</thing>
    <thing>PMXP0048194932-14</thing>
    <thing>PMXP0048194932-15</thing>
    <thing>PMXP0048194932-16</thing>
    <thing>PMXP0048194932-17</thing>
    <thing>PMXP0048194932-18</thing>
    <thing>PMXP0048194932-19</thing>
    <thing>PMXP0048194932-20</thing>
    <thing>PMXP0048194932-21</thing>
</root>


XSLT:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
    <xsl:template match="/">
        <xsl:element name="root">
            <xsl:for-each select="//thing">
                <xsl:element name="thingContainer">
                    <xsl:value-of select="."/>
                </xsl:element>
            </xsl:for-each>
        </xsl:element>
    </xsl:template>
</xsl:stylesheet>


Topic: C# XSLT Result
Posted: Thursday, March 3, 2016 7:37:49 PM
I'm using the text-in/text-out methods from C# to run a simple xslt against an xml file. It works correctly in XMLSpy, but when I execute ExecuteAndGetResultAsString(), the result I get is "additional-files:///file1 - OK". The only reference I can find that deals with 'additional-files' has to do with zipped files or additional referenced files/resources. This is a simple xslt transform that should return a short chunk of xml. Am I using it incorrectly? The LastErrorMessage property is empty, so I think executed correctly.

Topic: Bug in generated c#?
Posted: Tuesday, May 13, 2008 2:44:35 PM
I've got a very simple Mapforce map that I'm using to generate c#. It's an xml-to-xml map. When I execute map.run() and save it to a file, it works fine. When I try using the OutputDocument object to return the document rather than saving it, it's empty. I stepped into the code, and the map works great, it just never sets the output document to the mapped result. I traced it to one of the included .cs files in the AltovaXML project included in the generated code. This copied straight out of the xmloperations.cs file in c:\program files\Altova\Mapforce2008\spl\cs\AltovaXML.


Code:
public static void SaveDocument(XmlDocument doc, Altova.IO.Output output, System.Text.Encoding encoding, bool prettyPrint)
        {
            switch (output.Type)
            {
                case Altova.IO.Output.OutputType.Stream:
                    SaveDocument(doc, output.Stream, encoding, prettyPrint);
                    break;

                case Altova.IO.Output.OutputType.Writer:
                    SaveDocument(doc, output.Writer, prettyPrint);
                    break;

                case Altova.IO.Output.OutputType.XmlDocument:
                    break; ;

                default:
                    throw new System.Exception("Unknown output type");
            }
        }


Notice the double semi-colon in the Altova.IO.Output.OutputType.XmlDocument case. Should that include a statement that assigns the value of doc to output.document? Or am I missing something else?

Rob

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.