Dear all,
I have a problem that has been annoying me for the last few days.
I am building a test framework. Our test cases are created in an
xml file which depicts the test case, since some settings are
common to all the test cases we have a dtd file with these
settings. My problem is that the xml and dtd files are correctly
parsed in Ubuntu 7.04 but aren't in MS Windows.
XML file:
<?xml version = "1.0" encoding = "UTF-8"?>
<!DOCTYPE execution [
<!-- settings -->
<!ENTITY % settings SYSTEM "settings.dtd">
%settings;
]>
<execution>
<outputfiles deleteprevious="true"></outputfiles>
<testmanager>
<outputter class="CAggregOutputter" create="true" level="20"
name="agregoutputter" >
<outputter class="CConsoleOutputter" create="true"
level="20" name="consoleoutputter" />
<outputter class="CBufferedFileOutputter"
create="true" level="20" name="bufferedfileoutputter" />
</outputter>
<!--&defaultuserinteraction;-->
<userinteraction waittoend="true" rank="0"
attachdebugger="false" />
<exception handlesystem="true" />
<resultmanager class="CMsgCreatorResultManager"
create="true" name="resultmanager">
<xmlfile>./result-test-msg-id.xml</xmlfile>
</resultmanager>
<thread name="default" create="true">
<scheduler class="CSchedulerStepInterleaving"
create="true" name="scheduler" />
<syncgroup class="CMsgCreatorSyncGroup" create="true"
name="test_msg_id">
<resourcepool class="CRCP_Integer" create="true"
name="msg-id">
<range begin="0" end="6" step="1" />
</resourcepool>
<resourcepool class="CRCP_Integer" create="true"
name="msg-destination">
<range begin="0" end="128" step="32" />
</resourcepool>
<resourcepool class="CRCP_String" create="true"
name="name_of_tester">
<resource class="CRSC_String" create="true"
name="user login"></resource>
</resourcepool>
<resourcepool class="CRCP_String" create="true"
name="name_of_tag">
<resource class="CRSC_String" create="true"
name="cvs tag"></resource>
</resourcepool>
<test class="CTestMsgID" create="true"
name="TestMsgID">
<skipto iteration="0"/>
</test>
</syncgroup>
</thread>
<run times="1" />
</testmanager>
</execution>
DTD file:
<!ENTITY outputLvl "20">
<!ENTITY name_of_tester "user login">
<!ENTITY name_of_tag "cvs tag">
<!ENTITY defaultuserinteraction '<userinteraction
waittoend="true" rank="0" attachdebugger="false" />'>
<!ENTITY defaultexception '<exception handlesystem="true" />'>
the parsing is done using the following code
The code where it the problem occurs is this section.
CODE:
XMLPlatformUtils::Initialize();
m_pcXMLParser = new XercesDOMParser ();
m_strURL = str_url;
m_pcXMLParser->setCreateEntityReferenceNodes(false);
// If we have an URL create an input source:
if (!m_strURL.empty ()) {
m_pcInputSource = new URLInputSource (XMLURL
(m_strURL.c_str ()));
m_pcXMLParser->parse (*m_pcInputSource);
if (m_pcXMLParser->getDocument () == NULL)
throw TESTEXCEPTION("Found empty xml document.
Possibly tried to open wrong document(see the next files:
setings.dtd,..).");
if (m_pcXMLParser->getDocument ()->getDocumentElement ()
== NULL)
throw TESTEXCEPTION("Found empty xml document.
Possibly tried to open wrong document(see the next files:
setings.dtd,..).");
} else
m_pcInputSource = NULL;
In Windows it always returns null in the
"m_pcXMLParser->getDocument ()->getDocumentElement ()" line. I
have noticed that if I remove the "%settings" line in the XML
file it does not return null but it also doesn't import the
settings, so no use for this solution.
I have been searching google and the user mailing list for
something similar but couldn't find anything. One more thing I'm
using the static version of Xerces-C 2.7 library.
Hope you can help me, any more info you need please ask.
Thanks in advance.
Kind Regards
--
José Rui Simões
Junior Engineer
Critical Software, SA
Parque Industrial de Taveiro, Lote 48
3045-504 Coimbra, Portugal
Tel:+351.239 989 100 Fax:+351.239 989 119
http://www.criticalsoftware.com <http://www.criticalsoftware.com/>
[EMAIL PROTECTED]
<mailto:jose-r-simoes%40criticalsoftware.com>