Re: Re: [xml] mobile links for XInclude?



FromDaniel Veillard <veillard redhat com>
DateSun, 22 Jun 2003 17:07:50 -0400
The problem here is that the startup XML file (with all the XIncludes)
isn't parsed from the current directory, 
but is located using a system variable read by my python script... the
releative URI uses the current *working* 
directory as the reference point, not the XML source directory from where
the first XML file was parsed.
 This assertion sounds completely wrong to me. If you target the parser
to target a file then relative URI references done from the XInclude will
be computed relative to that path and not relative to the working directory.

I found out something interesting. Watch:

Python 2.2.1 (#1, Jun 21 2003, 21:50:24)
PythonD [GCC 3.0.4] build 2.0 for DJGPP on ms-dos5
Type "help", "copyright", "credits" or "license" for more information.
import os
os.getenv("MYXML")
'D:\\D\\xml\\myxml.xml'
import libxml2
doc = libxml2.parseFile("D:\D\XML\MYXML.XML")
scontext = doc.xpathNewContext()
res = doc.xincludeProcess()
warning: failed to load external entity "program/python.xml"
doc = libxml2.parseFile("/dev/d/d/xml/myxml.xml")
res = doc.xincludeProcess()
del doc
doc = libxml2.parseFile("D:\\d\\xml\\myxml.xml")
res = doc.xincludeProcess()
warning: failed to load external entity "program/python.xml"
del doc

Notice the successful relative XInclude resolution when using DJGPP's psuedo-UNIX convention rather than 
standard DOS nomenclature (DJGPP's libc understands *both*, even concurrently in the same filename). I 
believe 
this may have to do perhaps with the comments I made about xmlIO.c on bugzilla.

What do you think?

Ben 

P.S.
I did *appear* that relative XIncludes were being resolved from the current working directory when I 
temporarily copied program/python.xml to where I was working, and seeing that it ran correctly afterward... 
hmmmm... backup policy??

This is your brain:
    bash-2.05$
This is your brain on drugs:
    Starting Windows XP...
Any questions?

250 business cards FREE! Create your own full-colour high-quality business cards easily online. Only at 
www.vistaprint.uk


--- Begin Message ---
On Sun, Jun 22, 2003 at 09:18:18PM +0100, Ben Decker wrote:
The problem here is that the startup XML file (with all the XIncludes)
isn't parsed from the current directory, 
but is located using a system variable read by my python script... the
releative URI uses the current *working* 
directory as the reference point, not the XML source directory from where
the first XML file was parsed.
  This assertion sounds completely wrong to me. If you target the parser
to target a file then relative URI references done from the XInclude will
be computed relative to that path and not relative to the working directory.
If you loaded the file in memory and parsed the memory string then the
initial path is lost but it's not libxml2 faults.
  Honnestly I still don't see a good reason to do what you suggest,

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



--- End Message ---


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]