Hello,

I use Xalan C++ 1.2 and i'm trying to implement a sequence of transformation with DOM intermediate result.
For this, i need to use XalanDocument as input of XalanTransfomer::transform method.
It seems to not work in my complete code then i create a basic sample which don't work too.

I got the following error :
    Fatal Error at (file , line 0, column 0): An exception occured! Type:RuntimeException, Message:The primary document entity could not be opened. Id={null}

Could someone help me to correct the following code ?

  XMLPlatformUtils::Initialize();
  XalanTransformer::initialize();

  XercesDOMSupport domSupport;
  XercesParserLiaison parserLiaison(domSupport);
  XalanTransformer xalanTransformer;

  XSLTInputSource input_source("test_in.xml");
  XSLTResultTarget output_result("test_out.xml");
  XSLTInputSource xslt_source("test.xslt");

  DOMParser  theParser;
  // You MUST instruct the Xerces DOMParser NOT to create a DOM_XMLDecNode
  // in the DOM to represent the XML declaration. See "Limitations" below.
  theParser.setToCreateXMLDeclTypeNode(false);
  theParser.parse("test_in.xml");
  const DOM_Document theDOM = theParser.getDocument();

  XalanDocument* theDoc = parserLiaison.createDocument(theDOM);

  XSLTInputSource input_dom_source(theDoc);

// WORK
   xalanTransformer.transform(input_source, xslt_source, output_result);

// Don't WORK
   xalanTransformer.transform(input_dom_source, xslt_source, output_result);

XalanTransformer::terminate();
XMLPlatformUtils::Terminate();

Thanks a lot.

Arnaud Malguy

Reply via email to