xalan-c 1.10 problem with XalanTransformer.transform

Discussion in 'C++' started by rjuszkiewicz@gmail.com, Dec 4, 2012.

  1. Guest

    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::eek:ut);
    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::eek:ut);
    std::stringstream tempstream(std::stringstream::in |
    std::stringstream::eek:ut);

    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();
    }
    , Dec 4, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tobias Schierge

    Xalan document() memory problem

    Tobias Schierge, Feb 3, 2004, in forum: Java
    Replies:
    1
    Views:
    483
    Christian
    Feb 9, 2004
  2. Brian Dobby
    Replies:
    0
    Views:
    406
    Brian Dobby
    Nov 28, 2003
  3. cvissy
    Replies:
    0
    Views:
    603
    cvissy
    Nov 16, 2004
  4. Rene van Hoek

    Xalan transform output to string

    Rene van Hoek, Nov 22, 2004, in forum: XML
    Replies:
    1
    Views:
    830
    Rene van Hoek
    Nov 23, 2004
  5. Replies:
    3
    Views:
    504
    Joe Kesselman
    Aug 11, 2007
Loading...

Share This Page