Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5060549

Xinclude ShortHand pointer not working

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 5.0
    • Fix Version/s: 5.0
    • Component/s: xml
    • Subcomponent:
    • Resolved In Build:
      b56
    • CPU:
      generic
    • OS:
      solaris_9

      Backports

        Description

        mport javax.xml.parsers.DocumentBuilder;
        import javax.xml.parsers.DocumentBuilderFactory;
            
        import javax.xml.parsers.SAXParser;
        import javax.xml.parsers.SAXParserFactory;
        import javax.xml.parsers.DocumentBuilderFactory;
        import javax.xml.parsers.DocumentBuilder;
        import javax.xml.parsers.ParserConfigurationException;
        import javax.xml.parsers.FactoryConfigurationError;
        import org.xml.sax.*;
        import org.xml.sax.SAXParseException;
        import org.xml.sax.SAXNotSupportedException;
        import org.xml.sax.SAXNotRecognizedException;
        import org.xml.sax.ErrorHandler;
        import org.w3c.dom.DOMException;
        import org.xml.sax.helpers.DefaultHandler;
        import java.io.*;
        import java.lang.*;
        import javax.xml.transform.Transformer;
                    
                    
        public class XI extends DefaultHandler {
                    
            public static void main(String[] args) throws Exception {
                boolean status = false;
                SAXParserFactory spf = null;
                SAXParser sp = null;
                XInclHandler xh = null;
                File file= null;
                DocumentTracer dt = null;
                try {
                    xh = new XInclHandler();
                    FileOutputStream fos = new FileOutputStream("./a.xml");
                    xh.setOutput(fos,null);
        // dt = new DocumentTracer();
         // dt.setOutput(fos,null);
                    spf = SAXParserFactory.newInstance();
                    spf.setNamespaceAware(true);
                    spf.setValidating(true);
                    spf.setXIncludeAware(true);
                    spf.setFeature("http://apache.org/xml/features/validation/dynamic",true);
                    //spf.setFeature("http://apache.org/xml/features/validation/schema-full-checking",true);
                    
                    sp = spf.newSAXParser();
            FileOutputStream fos = new FileOutputStream("./a.xml");
                    xh.setOutput(fos,null);
        // dt = new DocumentTracer();
         // dt.setOutput(fos,null);
                    spf = SAXParserFactory.newInstance();
                    spf.setNamespaceAware(true);
                    spf.setValidating(true);
                    spf.setXIncludeAware(true);
                    spf.setFeature("http://apache.org/xml/features/validation/dynamic",true);
                    //spf.setFeature("http://apache.org/xml/features/validation/schema-full-checking",true);
                    
                    sp = spf.newSAXParser();
                    sp.setProperty( "http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XM
        LSchema");
                    sp.setProperty("http://xml.org/sax/properties/lexical-handler",xh);
                    sp.setProperty("http://xml.org/sax/features/namespace-prefixes",Boolean.TRUE);
                    file = new File("test34.xml");
                // file = new File("/space/work/xinclude/nist-include-34.xml");
                
                    //file = new File("/space/work/xinclude/nist-include-28.xml");
                    //file = new File("/space/work/xinclude/document_xpointer.xml");
                    // file = new File("/space/work/bugs/bug4943030/test.xml");
                    //file = new File("/space/work/xinclude/document_xinclude.xml");
                    // file = new File("/space/work/bugs/bug4943030/document_xpointer1.xml");
                    // file = new File("/space/work/bugs/bug4943030/catalog.xml");
                    //new XI());
                    //parser.setEntityResolver(new MyResolver());
                   
                    sp.parse(file,xh);
                    System.out.println("Done");
                } catch(SAXNotRecognizedException sne) {
                    sne.printStackTrace();
                }catch(ParserConfigurationException pce){
                    pce.printStackTrace();
                }catch(SAXParseException spe){
                    spe.printStackTrace();
                }catch(SAXException se){
                    se.printStackTrace();
                }catch(IOException ioe){
                    ioe.printStackTrace();
                }catch(Exception e){
                    e.printStackTrace();
                }
            }
        }





        <x xmlns:xinclude="http://www.w3.org/2001/XInclude">
        <xinclude:include xmlns:xinclude="http://www.w3.org/2001/XInclude" href="/space/work/xinclude/personal-schema.xm
        l" xpointer="element(five.worker/2)"/>
           <!-- Including another XML document with ids using XPointer element schema. -->
           <!--xinclude:include href="./idtst.xml#element(f1)"/-->
           <!--xinclude:include href="./idtst.xml#element(f1)"/-->
           <!--xinclude:include href="/space/work/xinclude/idtst.xml" xpointer="f1"/-->
           <!--xinclude:include href="/space/work/xinclude/personal-schema.xml" parse="text"/-->
           <!--xinclude:include href="/space/work/xinclude/personal-schema.xml" xpointer="element(five.worker)"/-->
           <!--xinclude:include href="/space/work/xinclude/personal-schema.xml" xpointer="element(1/2)"/-->
           <!--xinclude:include href="/space/work/xinclude/personal-schema.xml" xpointer="element(1/2/2)"/-->
           <!--xinclude:include href="/space/work/xinclude/personal-schema.xml" xpointer="element(1/2/1/2)"/-->
           <!--xinclude:include href="/space/work/xinclude/personal-schema.xml" xpointer="element(five.worker/2)"/-->
        </x>
        ~

        ###@###.### 2004-06-09
        ###@###.### 2004-06-09

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  vkorcl Venugopal K (Inactive)
                  Reporter:
                  vkorcl Venugopal K (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: