xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paulus Oliver" <oliver.pau...@siemens.com>
Subject RE: Xalan-J, Xerces-J XInclude question
Date Thu, 16 Feb 2006 06:40:27 GMT
Hello Peter,

thank you for your help (so far). I have seen in the Xalan java code
that there is no option to give him "passthrough" parameters for the XML
parser (Xerces in this case). I think it could be useful for the users -
what do you think?

Another problem I have struggled with was that with java 1.4.x a xalan
version was included in the java runtime. I have seen that I have to put
the new version into the endorsed dir or give the option
java.endorsed.dirs on commandline. With the new xalan version in place I
had some difference in the EXSLT usage and namespace behaviour. This is
now fixed - it was a failure in my XSL files.

I have made a test with some java code to call Xalan-J. Here is my code
snippet:

	
System.setProperty("javax.xml.parsers.DocumentBuilderFactory","org.apach
e.xerces.jaxp.DocumentBuilderFactoryImpl");
	
System.setProperty("javax.xml.parsers.SAXParserFactory","org.apache.xerc
es.jaxp.SAXParserFactoryImpl");
	
System.setProperty("org.apache.xerces.xni.parser.XMLParserConfiguration"
,"org.apache.xerces.parsers.XIncludeParserConfiguration");
	DocumentBuilderFactory dbfactory =
DocumentBuilderFactory.newInstance();
	dbfactory.setNamespaceAware(true);
	//dbfactory.setXIncludeAware(true);
	
//dbfactory.setFeature("http://apache.org/xml/features/xinclude", true);
	
dbfactory.setFeature("http://apache.org/xml/features/xinclude/fixup-base
-uris", false);
	
//dbfactory.setFeature("http://apache.org/xml/features/xinclude/fixup-la
nguage", false);
	DocumentBuilder parser = dbfactory.newDocumentBuilder();
	Document document = parser.parse(new File("input.xml"));
	DOMSource xmlSource = new DOMSource(document);
	TransformerFactory tFactory = TransformerFactory.newInstance();
	Transformer transformer = tFactory.newTransformer(new
StreamSource("index.xsl"));
	transformer.transform(xmlSource, new StreamResult(new
FileOutputStream("output.xml")));

This code transforms the xml with the xsl file but does not recognize
the fixup-base-uris option set. I get the xml:base attributes in the
output file. What is wrong with this code?

Is there any basic tutorial or wiki how to use xalan and xerces from
java code?

Regards
Oliver Paulus

-----Original Message-----
From: Peter McCracken [mailto:peterjm@ca.ibm.com] 
Sent: Mittwoch, 15. Februar 2006 22:14
To: general@xml.apache.org
Subject: RE: Xalan-J, Xerces-J XInclude question

"Paulus Oliver" <oliver.paulus@siemens.com> wrote on 02/14/2006 11:03:39

AM:

> Is there a possibility to set this feature in the commandline mode? I
do
> not use any java code (until now). My current call looks like this:
> 
> java -jar
>
-Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.
> parsers.XIncludeParserConfiguration
> parser\xalan-j_2_7_0-bin\xalan-j_2_7_0\xalan.jar -IN
source\source1.xml
> -XSL xsl\main.xsl -OUT target\result.xml 

Hi Oliver,

Unfortunately, there's no way to pass feature values to the XML parser 
using the command line of Xalan's Process program.  I think you'll need
to 
write a small Java program to get the functionality you want.

-- 
Peter McCracken
XML Parser Development
IBM Toronto Lab
Email: peterjm@ca.ibm.com

---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org


Mime
View raw message