Message:

  A new issue has been created in JIRA.

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/XERCESJ-953

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: XERCESJ-953
    Summary: context location bug
       Type: Bug

     Status: Unassigned
   Priority: Major

    Project: Xerces2-J
 Components: 
             XInclude 1.0
   Versions:
             2.6.1

   Assignee: 
   Reporter: Manos Batsis

    Created: Thu, 6 May 2004 1:15 AM
    Updated: Thu, 6 May 2004 1:15 AM
Environment: Tested and reproduced on Linux and Windows 2000. In both cases, i was 
actually using an Ant 1.6.1 installation.

Description:
The following description was posted in xerces-j-user and uses windows path 
conventions.

===========
Description 
===========

[[[
I'm trying to patch up an xinclude task to automate some stuff but have "context" 
problems. My project structure (fragment):

xclude
└───testfiles
    │   include1.xml
    │   init.xml


My initial document (init.xml) is just

<?xml version="1.0" ?>
<test xmlns:xi="http://www.w3.org/2003/XInclude";>
  <xi:include href="include1.xml" />
</test>

the include1.xml indeed exists in the same directory as the nitial document, however i 
get the following error:

 [Warning] :3:44: Include operation failed, reverting to fallback. Re
source error reading file as XML (href='include1.xml'). Reason: C:\tools
\eclipse\workspace\xclude\include1.xml (The system cannot find the path
specified)

So, although the init.xml was read from

C:\tools\eclipse\workspace\xclude\testfiles

the processor looks for the included file in

C:\tools\eclipse\workspace\xclude

]]]

=======================
Reproducing the problem
=======================
//Java code:

System.setProperty(                             
"org.apache.xerces.xni.parser.XMLParserConfiguration",          
"org.apache.xerces.parsers.XIncludeParserConfiguration");

SAXParser parser = new SAXParser();
XMLSerializer serializer = new XMLSerializer(
                new FileOutputStream(this.out),
                new OutputFormat("XML", this.encoding, this.indent));
parser.setDocumentHandler(serializer.asDocumentHandler());

// THIS IS WHERE THE BUG IS, SEE WORKAROUNDS
// this.in is a java.io.File object
parser.parse(new InputSource(new FileInputStream(this.in)));

=================
Workarounds (two)
=================

1) Modify the initial document (init.xml above) by adding an xml:base in it's 
documentElement, having the absolut path of the file as the value.

2) Change the problematic line:

parser.parse(new InputSource(new FileInputStream(this.in)));

to this (the following works fine): 

parser.parse(new InputSource(this.in.getAbsolutePath()));


=========
Diagnosis
=========

My guess is this has something to do with the implementation of xml:base and the 
initial value that gets in xinclude processing, or some Locator problem?


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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

Reply via email to