Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   xalan-c 1.10 problem with XalanTransformer.transform (http://www.velocityreviews.com/forums/t955106-xalan-c-1-10-problem-with-xalantransformer-transform.html)

rjuszkiewicz@gmail.com 12-04-2012 12:18 PM

xalan-c 1.10 problem with XalanTransformer.transform
 
Hello,
I have a problem with transforming a few streams. First stream always goes
correctly, while second is transforming, I receive:

XSLT Warning: Fatal Error.Occurred at unknown file, line 1, column 1. Invalid
document structure (line 1, column 1.)
SAXParseException: Invalid document structure (, line 1, column 1)

Why ? What's wrong with my code ?

void generate_traces(
const std::string targetIP,
unsigned iterationsNumber,
unsigned connectionsNumber,
unsigned instancesNumber,
const std::string traceType,
const std::string dir,
unsigned sleepTime,
const std::string traceMode,
unsigned isBinary = 0
)
{
XmlPlatformJanitor xercesJanitor;
xalanc::XalanTransformer::initialize();
xalanc::XalanTransformer theXalanTransformer;


std::list<std::string> contentList;
if (fs::is_directory(dir))
{
std::string tempString;
for (fs::directory_iterator itr(dir); itr!=fs::directory_iterator();
++itr)
{
if (fs::is_regular_file(itr->status()) && strcmp(itr-
>path().extension().c_str(),".xml")==0)

{
std::cout << itr->path().filename() << ' ' << itr-
>path().extension() << '\n'; // display filename only


std::ifstream ifs(itr->path().string().c_str());
contentList.push_front(tempString.assign(
(std::istreambuf_iterator<char>(ifs)), (std::istreambuf_iterator<char>()) ));
}
}
}


// stream xsl
std::stringstream xsl_stream(std::stringstream::in | std::stringstream::out);
xsl_stream << pmtrace::generateXsl<pmtrace::MsgReport>();

xalanc::XSLTInputSource xslIn(xsl_stream);
std::list< std::list<std::string> > streamsList;
std::list<std::string> streamList;


//generating data streams
for (int i=0; i<instancesNumber; i++)
{
std::string uniqueMccMncId = get_number_full_string();
std::string uniqueTraceId = get_number_full_string();
for (std::list<std::string>::const_iterator it = contentList.begin(); it
!= contentList.end(); ++it)
{
std::stringstream result_stream(std::stringstream::in |
std::stringstream::out);
std::stringstream tempstream(std::stringstream::in |
std::stringstream::out);

std::string s = *it;

tempstream << s;

xalanc::XSLTInputSource xmlIn(tempstream);

xalanc::XSLTResultTarget xmlOut(result_stream);

int theResult = theXalanTransformer.transform(xmlIn, xslIn, xmlOut);
if(theResult != 0)
{
std::cout << theXalanTransformer.getLastError() << std::endl;
}

streamList.push_back(result_stream.str());
}
streamsList.push_back(streamList);
streamList.clear();
}

//print_list_of_list_of_string(streamsList);
std::cout << "Size: " << streamsList.size() << "\n";

xalanc::XalanTransformer::terminate();
xalanc::XalanTransformer::ICUCleanUp();
}


All times are GMT. The time now is 07:34 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57