Hi, i'm a newbie on xerces, but very interested in the com wrapper. i
made some experiments with it and found out that it is problematic to
use with vbscript in that away, that it rejects byref parameters.
for instance:

dim strXML
strXML = "test.xml"

dim xmlDoc
set xmlDoc = CreateObject( "Xerces.DOMDocument" )

if xmlDoc.load( strXML ) then
...
end if

This fails for Xerces because strXML is passed as VT_VARIANT|VT_BYREF
and not as VT_BSTR. To make it running it must be ensured to pass the
parameters ByValue, for instance:

if xmlDoc( ( strXML ) ) then ...
or
if xmlDoc( CStr( strXML ) ) then ...

This behaviour makes it impossible to simply replace MSXML by Xerces. So
my question is: Shouldn't we enhance the com wrapper to accept
VT_VARIANT|BYREF arguments ? to the load function, for instance, could
be added something like:

  if( V_VT( &xmlSource ) == ( VT_VARIANT | VT_BYREF ) )
  {
    variant_t vtString( &xmlSource );
    m_FileName = vtString.operator _bstr_t();

    if( 0 == m_FileName.length() )
      return E_INVALIDARG;

    // see if the file is relative path
                if (!PathIsURL(m_FileName) &&
PathIsRelative(m_FileName)) {
                        // try appending baseurl if exists
                        _bstr_t baseURL;
                        if (S_OK == GetBaseURL(baseURL)) {
                                // change any backslashes to slashes
                                LPTSTR loc =
_tcschr(m_FileName,_T('\\'));
                                while (loc != NULL) {
                                        *loc = _T('/');
                                        loc =
_tcschr(m_FileName,_T('\\'));
                                }
                                m_FileName = baseURL + _T("/") +
m_FileName;
                        }
                }

  }

Another question i have is why the resolveExternals property is
disabled. As far as i can see in the DOMCount project, Xerces should
support this feature.

Regards,

Dr. Olaf Groeger


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to