You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Vahe Amirbekyan <av...@techone.com> on 2000/08/04 01:31:42 UTC

XercesLiaison - how parsing properties are set?

Hi all,

I have encountered the following prolem using the Xalan 1.2. and Xerces
1.1.2

I am trying to produce DOM tree having as an input another one. For that
purpose I have to initialize the XSLT processor by reference to
XMLParserLiaison which wrapps the XML parser. This "liaison" is used by
the XSLT processor to process XML/generate DOM:

XercesLiaison xl = new org.apache.xalan.xpath.xdom.XercesLiaison();
xsltProcessor = XSLTProcessorFactory.getProcessor(xl);

But the problem is - the namespaces of the input XML are not processed,
and the reslting DOM tree does not contain them, which results in eror
in my application. 

Indeed, the default settings for Xerces parser is 'false' for namespace
processing. Surprisingly, the XercesLiaison interface does not seem to
support get/setParser() nor get/setFearture() operations, so that I
could somehow change the default settings for XML parsing.

Trying using other liaisons - like the one used in IBM SOAP - didn't
bring any positive results: although both
com.ibm.cs.xml.XercesParserLiaison and
org.apache.xalan.xpath.xdom.XercesLiaison implement XMLParserLiaison
interface, it is (completely) different for each package (!), so the
following doesn't work as well:

XMLParserLiaison xl = new com.ibm.cs.xml.XercesParserLiaison(); //
wrong!
      
Forcing parser to process the namespaces:

xl.setProcessNamespaces(true); // deprecated!

doesn't work - this method is now deprecated. Moreover,
org.apache.xalan.xpath.xdom.XercesLiaison inherits now deprecated
org.xml.sax.Parser interface which is currently replaced by XMLReader
which in turn supports setFeature operation, using which I _could_ do:

xl.setFeature("http://xml.org/sax/features/namespaces", true); // not
implemented yet!

So - what to do? Wait until Xalan's XercesLiaison will implement
XMLReader instead of obsolete Parser interface? That can take too
long... Subclass the XalanLiaison and provide XML parsing myself? But
the interface's design doesn't seem to be created for easy
subclassing... Maybe there is a different way? It should be - after all
- setting parsing properties is a common task and any wrapper should
provide some means to do that, IMHO.

Thanks for your help, Vahe Amirbekyan

PS. Please, send the replies to avahe@techone.com too since I am not on
the mailing list.

-- 
       (\______________________________________________________/)
     __|_|        Vahe AMIRBEKYAN, Senior Consultant          |_|__
    (___o)            tel: (510) 729 6750 ext.375             (o___)
     (__o)              mailto:vahe@techone.com               (o__)
     (__o)              http://www.techone.com                (o__)
      (_o)____________________________________________________(o_)