[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xalan-dev
Subject:    Re: xi:include awareness from xalan-comandline
From:       Brian Minchau <minchau () ca ! ibm ! com>
Date:       2006-01-22 20:11:16
Message-ID: OFCC4599F7.2D30C46B-ON852570FE.006A8430-852570FE.006EE52C () ca ! ibm ! com
[Download RAW message or body]

Rudolf,


The DocumentBuilderFactory method setXIncludeAware() has existed since JAXP
1.3, which is what Xalan-J supports, so all in all I'm in favour of your
patch, and with the new functionality, it just needs a little polishing.

Your  request looks perfectly reasonable to me. I had a look at the class
javax.xml.parsers.DocumentBuilderFactory. Amoung its methods is this one:
    public void setXIncludeAware(boolean b);

Already in use by Xalan code, in various places are these methods on the
same class:
    public abstract void setAttribute(String s, Object o);
    public abstract void setFeature(String s, boolean b);
    public void setNamespaceAware(boolean b);
    public void setValidating(boolean b);

It looks to me like having a command line option to call
setXIncludeAware(boolean b) as you suggest is reasonable. However the
current behavior is that the factory is not XInclude aware. So I don't
agree that the default value should be true your variable
    boolean isXIncludeAware = true;

Your patch has some messages in German (sehr interresant, aber es gibt
viele andere Sprachen). Excuse my rusty German, but there are other
languages so we would might use the English messages but leave the
translation to the usual processes.  However, the one area in you patch
which really needs a message is this one:


                   try
                   {
                           dfactory.setXIncludeAware(isXIncludeAware);
                   }
                   catch(UnsupportedOperationException uoe)
                   {

                   }

If a DocumentBuilderFactory doesn't support this API it will throw the
UnsupportedOperationException, yet your patch would silently absorb the
exception. An informational message that the API is not supported would be
useful when someone wants to use the new options but they don't seem to
work. Class path issues can be tricky and they might not be using the
factory they expect, so a message here would be very useful.

Please open a JIRA issue ( go to https://issues.apache.org/jira ). The JIRA
project in which to open the issue is XalanJ2. You will need an account to
create a new issue. If you don't have one click the "SignUp" button and
create one.  Please create a new issue of type "New Feature". Also please
attach your file ( patch file), granting Apache the licensing rights.

FYI there is a JIRA meeting open to all Xalan-J contributors on Tuesday
February 7 at 2 pm EST. It is a telephone conference. I'll make sure your
issue is on the agenda. Your note to xalan-dev makes you a contributor too
(the XalanJ2 issue would be even better).

You'd be welcome to attend, however I have the feeling that you are in a
far different time zone. The conference number has a global toll-free
number, but my experience is that it isn't free in all countries.




- Brian
- - - - - - - - - - - - - - - - - - - -
Brian Minchau
XSLT Development, IBM Toronto
e-mail:        minchau@ca.ibm.com



                                                                           
             Rudolf Weber                                                  
             <rfweber@tesionma                                             
             il.de>                                                     To 
                                       xalan-dev@xml.apache.org            
             01/20/2006 01:14                                           cc 
             PM                                                            
                                                                   Subject 
                                       xi:include awareness from           
             Please respond to         xalan-comandline                    
                 xalan-dev                                                 
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




Hello,

this little patch enable the the xi:include on the command-line.
The default is on, since I think in the normal case it is useful.
In the special case, the default has to be swiched off with -NIA.

In our project we want to include declarations in a programming language
in the xslt-file, so the option -XSLIA.

It would be great to include this patch in the next release - my boss
don't
believe that it is possible :-)

Greetings from Ravensburg, Germany

Rudolf Weber
http://www.infnet.verein.de


---
./src/org/apache/xalan/res/XSLTErrorResources.java.unvollstaendig
2005-08-07 01:37:11.000000000 +0200
+++ ./src/org/apache/xalan/res/XSLTErrorResources.java
2005-11-08
08:45:52.000000000 +0100
@@ -1363,6 +1363,9 @@
   {  "optionCR", "   [-CR (Use carriage returns only on output {default
is CR/LF})]"},
   { "optionESCAPE", "   [-ESCAPE (Which characters to escape {default
is <>&\"\'\\r\\n}]"},
   { "optionINDENT", "   [-INDENT (Control how many spaces to indent
{default is 0})]"},
+  { "optionIA", "   [-IA (be aware of xinclude -default )]"},
+  { "optionNIA", "  [-NIA (don't be aware of xinclude )]"},
+  { "optionXSLIA","  [-XSLIA (handle xinclude in XSLT-Stylesheets)]"},
   { "optionTT", "   [-TT (Trace the templates as they are being
called.)]"},
   { "optionTG", "   [-TG (Trace each generation event.)]"},
   { "optionTS", "   [-TS (Trace each selection event.)]"},
---
./src/org/apache/xalan/res/XSLTErrorResources_de.java.unvollstaendig
 2005-08-07 01:37:11.000000000 +0200
+++ ./src/org/apache/xalan/res/XSLTErrorResources_de.java
2005-11-08
08:47:59.000000000 +0100
@@ -2328,6 +2328,9 @@
   {  "optionCR", "[-CR (Nur Zeilenschaltung bei Ausgabe verwenden
{Standardeinstellung ist CR/LF})]"},
   { "optionESCAPE", "[-ESCAPE (Zeichen, die mit einem Escapezeichen
angegeben werden m\u00fcssen {Standardeinstellung ist <>&\"\'\\r\\n}]"},
   { "optionINDENT", "[-INDENT (Steuerung, um wie viele Leerzeichen
einger\u00fcckt werden soll {Standardeinstellung ist 0})]"},
+  { "optionIA", "   [-IA ( Ber\u00fccksichtigung von xinclude -
Voreinstellung )]"},
+  { "optionNIA", "  [-NIA ( keine Ber\u00fccksichtigung von xinclude
)]"},
+  { "optionXSLIA","  [-XSLIA (Ber\u00fccksichtigung von xinclude in
XSLT-Stylesheets)]"},
   { "optionTT", "[-TT (Trace f\u00fcr Vorlagen ausf\u00fchren, wenn sie
aufgerufen werden.)]"},
   { "optionTG", "[-TG (Trace f\u00fcr jedes Generierungsereignis
durchf\u00fchren.)]"},
   { "optionTS", "[-TS (Trace f\u00fcr jedes Auswahlereignis
durchf\u00fchren.)]"},
---
./src/org/apache/xalan/res/XSLTErrorResources_pl.java.unvollstaendig
 2005-08-07 01:37:11.000000000 +0200
+++ ./src/org/apache/xalan/res/XSLTErrorResources_pl.java
2005-10-13
17:16:05.000000000 +0200
@@ -2328,6 +2328,8 @@
   {  "optionCR", "   [-LF (u\u017cycie tylko znak\u00f3w powrotu
karetki na wyj\u015bciu {domy\u015blnie CR/LF})]"},
   { "optionESCAPE", "   [-ESCAPE (znaki o zmienionym znaczeniu
{domy\u015blne <>&\"\'\\r\\n}]"},
   { "optionINDENT", "   [-INDENT (liczba znak\u00f3w wci\u0119cia
{domy\u015blnie 0})]"},
+  { "optionIA", "   [-IA ( Ber\u00fccksichtigung von xinclude -
Voreinstellung )]"},
+  { "optionNIA", "  [-NIA ( keine Ber\u00fccksichtigung von xinclude
)]"},
   { "optionTT", "   [-TT (\u015bledzenie szablon\u00f3w podczas ich
wywo\u0142ywania)]"},
   { "optionTG", "   [-TG (\u015bledzenie ka\u017cdego zdarzenia
generowania)]"},
   { "optionTS", "   [-TS (\u015bledzenie ka\u017cdego zdarzenia
wyboru)]"},
--- ./src/org/apache/xalan/xslt/Process.java.unvollstaendig
2005-08-07
01:37:11.000000000 +0200
+++ ./src/org/apache/xalan/xslt/Process.java           2005-10-19
12:13:53.000000000 +0200
@@ -94,7 +94,9 @@
     System.out.println(resbundle.getString("optionTEXT"));  //"
[-TEXT (Use simple Text formatter.)]");
     System.out.println(resbundle.getString("optionHTML"));  //"
[-HTML (Use HTML formatter.)]");
     System.out.println(resbundle.getString("optionPARAM"));  //"
[-PARAM name expression (Set a stylesheet parameter)]");
-
+    System.out.println(resbundle.getString("optionIA"));  //"   [-IA
(XIncludeAware- default]");
+    System.out.println(resbundle.getString("optionNIA"));  //"   [-NIA
(XIncludeAware]");
+    System.out.println(resbundle.getString("optionXSLIA"));  //"
[-XSLIA (XSL XIncludeAware]");
     System.out.println(resbundle.getString("optionMEDIA"));
     System.out.println(resbundle.getString("optionFLAVOR"));
     System.out.println(resbundle.getString("optionDIAG"));
@@ -154,6 +156,8 @@
     boolean doDiag = false;
     String msg = null;
     boolean isSecureProcessing = false;
+    boolean isXIncludeAware = true;
+    boolean isXSLXIncludeAware=false;

     // Runtime.getRuntime().traceMethodCalls(false);
     // Runtime.getRuntime().traceInstructions(false);
@@ -382,9 +386,21 @@
           // TBD:
           // xmlProcessorLiaison.setShouldExpandEntityRefs(false);
         }
+            else if ("-IA".equalsIgnoreCase(argv[i]))
+            {
+                isXIncludeAware = true;
+            }
+            else if ("-NIA".equalsIgnoreCase(argv[i]))
+            {
+                isXIncludeAware = false;
+            }
+            else if ("-XSLIA".equalsIgnoreCase(argv[i]))
+            {
+                        isXSLXIncludeAware=true;
+            }
         else if ("-V".equalsIgnoreCase(argv[i]))
         {
-          diagnosticsWriter.println(resbundle.getString("version")
//">>>>>>> Xalan Version "
+
diagnosticsWriter.println(resbundle.getString("version")+"-rw"
//">>>>>>> Xalan Version "
                                     + Version.getVersion() + ", " +

           /* xmlProcessorLiaison.getParserDescription()+ */
@@ -705,6 +721,7 @@
         doExit(msg);
       }

+
       // Note that there are usage cases for calling us without a -IN
arg
       // The main XSL transformation occurs here!
       try
@@ -728,7 +745,7 @@
               DocumentBuilderFactory.newInstance();

             dfactory.setNamespaceAware(true);
-
+            dfactory.setXIncludeAware(isXSLXIncludeAware);
             if (isSecureProcessing)
             {
               try
@@ -746,6 +763,7 @@
           }
           else
           {
+                  //??? in the case of isXSLXIncludeAware - parsing und
via
SAXSource
             // System.out.println("Calling newTemplates:
"+xslFileName);
             stylesheet = tfactory.newTemplates(new
StreamSource(xslFileName));
             // System.out.println("Done calling newTemplates:
"+xslFileName);
@@ -855,7 +873,13 @@

               dfactory.setCoalescing(true);
               dfactory.setNamespaceAware(true);
-
+                  try
+                  {
+                          dfactory.setXIncludeAware(isXIncludeAware);
+                  }
+                  catch(UnsupportedOperationException uoe)
+                  {
+                  }
               if (isSecureProcessing)
               {
                 try
@@ -973,9 +997,7 @@
               reader.parse(new InputSource(inFileName));
               }
             }
-            else
-            {
-              if (entityResolver != null)
+            else // default i.e. flavor=="s2s"
               {
                 XMLReader reader = null;

@@ -986,6 +1008,7 @@
                     javax.xml.parsers.SAXParserFactory.newInstance();

                   factory.setNamespaceAware(true);
+                  factory.setXIncludeAware(isXIncludeAware);

                   if (isSecureProcessing)
                   {
@@ -1011,6 +1034,8 @@
                 }
                 catch (NoSuchMethodError ex2){}
                 catch (AbstractMethodError ame){}
+              if (entityResolver != null)
+              {

                 if (null == reader)
                 {
@@ -1043,7 +1068,7 @@
               else
               {
                 // System.out.println("Starting transform");
-                transformer.transform(new StreamSource(inFileName),
+                transformer.transform(new SAXSource(reader,new
InputSource(inFileName)),
                                       strResult);
                 // System.out.println("Done with transform");
               }



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




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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic