473,218 Members | 1,808 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,218 software developers and data experts.

xinclude and pathnames

I'm using ElementTree to access some xml configuration files, and using the
module's xinclude capability. I've got lines like this in the parent xml
file (which lives in the same directory as the included xml file):
<xi:include href="/dept/app/doc/current/en/xml/asdf/asdf_syntaxterms.xml"/>

When I started the project it was Unix-only; this worked fine. Now I have
users who want to use the system on Windows and of course that directory
path doesn't exist on Windows, but it is available on the network using a
name like \\ladida\current\en\xml\asdf\asdf_syntaxterms.xml

if relative paths worked, I could imagine
<xi:include href="asdf_syntaxterms.xml" /would work.
Also,the file can be read via an http server.

My question: is there a way to make xinclude work with relative paths or
perhaps urls?
Any ideas welcome--to me it looks like I'll have to restructure this part of
the system since I've basically programmed myself into a corner.

thanks,
--Tim Arnold
Sep 13 '06 #1
4 3347
"Tim Arnold" <ti****@sas.comwrote in message
news:ee**********@foggy.unx.sas.com...
I'm using ElementTree to access some xml configuration files, and using
the module's xinclude capability. I've got lines like this in the parent
xml file (which lives in the same directory as the included xml file):
<xi:include
href="/dept/app/doc/current/en/xml/asdf/asdf_syntaxterms.xml"/>

When I started the project it was Unix-only; this worked fine. Now I have
users who want to use the system on Windows and of course that directory
path doesn't exist on Windows, but it is available on the network using a
name like \\ladida\current\en\xml\asdf\asdf_syntaxterms.xml

if relative paths worked, I could imagine
<xi:include href="asdf_syntaxterms.xml" /would work.
Also,the file can be read via an http server.

My question: is there a way to make xinclude work with relative paths or
perhaps urls?
Any ideas welcome--to me it looks like I'll have to restructure this part
of the system since I've basically programmed myself into a corner.
Replying to my own post. With no replies I assume that means either (a) I
didn't explain the problem very well, or (b) I really have programmed myself
into a corner and there's no other way to happiness except to rethink the
problem.

That is, is there really no way to share xinclude'd files between *nix and
Windows platforms.

Anyone been down this road before?
thanks,
--Tim Arnold
Sep 14 '06 #2
Tim Arnold wrote in news:ee**********@foggy.unx.sas.com in
comp.lang.python:
"Tim Arnold" <ti****@sas.comwrote in message
news:ee**********@foggy.unx.sas.com...
>I'm using ElementTree to access some xml configuration files, and
using the module's xinclude capability. I've got lines like this in
the parent xml file (which lives in the same directory as the
included xml file): <xi:include
href="/dept/app/doc/current/en/xml/asdf/asdf_syntaxterms.xml"/>

When I started the project it was Unix-only; this worked fine. Now I
have users who want to use the system on Windows and of course that
directory path doesn't exist on Windows, but it is available on the
network using a name like
\\ladida\current\en\xml\asdf\asdf_syntaxterms.x ml

if relative paths worked, I could imagine
<xi:include href="asdf_syntaxterms.xml" /would work.
Also,the file can be read via an http server.

My question: is there a way to make xinclude work with relative paths
or perhaps urls?
Any ideas welcome--to me it looks like I'll have to restructure this
part of the system since I've basically programmed myself into a
corner.
According to the docs: http://effbot.org/zone/element-xinclude.htm

The default handler just sees the href value as a filename, so you
should be able to use a relative path if you os.chdir() to the working
directory before processing you xml file.

I just ran a 3 line sample to make sure os.chdir() works with network
paths, which it did.

Rob.
Sep 14 '06 #3
Rob Williscroft wrote:
The default handler just sees the href value as a filename, so you
should be able to use a relative path if you os.chdir() to the working
directory before processing you xml file.
and if that's not good enough, writing a custom loader is trivial (see
the default_loader implementation in ElementInclude.py for details).

</F>

Sep 14 '06 #4
"Fredrik Lundh" <fr*****@pythonware.comwrote in message
news:ma*************************************@pytho n.org...
Rob Williscroft wrote:
>The default handler just sees the href value as a filename, so you
should be able to use a relative path if you os.chdir() to the working
directory before processing you xml file.

and if that's not good enough, writing a custom loader is trivial (see the
default_loader implementation in ElementInclude.py for details).

</F>
Thanks for the information--I just tested Rob's idea, which works fine for
my case. You guys saved me a bunch of hair-pulling. I'm going to check out
the default_loader implementation too.

--Tim Arnold
Sep 14 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Erdem Guven | last post by:
I try to include some xml documents to another one and validate them. I get 'invalid content starting with element "xi:include".' error message at pointsample.xml line 6 from xml plugin of jedit...
1
by: CB | last post by:
I am using xerces 2.5.0 and xalan 2.6.0, and am following the xinclude instructions on the xerces faq at http://xml.apache.org/xerces2-j/faq-xinclude.html, and I am having no luck. I imagine I...
3
by: rene | last post by:
Hello everybody, i have these 2 xml files ------1.xml------ <?xml version="1.0" encoding="UTF-8"?> <root> <element>1</element> <element>2</element> </root>
1
by: Larry | last post by:
Given the "includer" xml file: <?xml version="1.0"?> <test-includer xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:testns="http://www.w3.org/TR/REC-xml-names"...
9
by: Tjerk Wolterink | last post by:
I have an xml document that conforms to my xschema document. Now i wanted to use xinclude in my xml document. But when i want to validate the xml document to the xschema i get the following...
11
by: john fra | last post by:
Hi, I want to include a part of many XML files into an unique XML file with XInclude. Example! File1.xml, File2.xml, File3.xml... seems to that : <?xml version="1.0" encoding="UTF-8"?>
22
by: Sven-Thorsten Fahrbach | last post by:
Hi Does anybody know of a library that offers a function to split pathnames. It should work somewhat like the following code snippet: ----------------- char *path =...
7
by: shaun roe | last post by:
I should like to use xslt to produce a document like the following: <crate xmlns:xi="http://www.w3.org/2001/XInclude"> <rod id="0"> <slot>1</slot> <xi:include...
2
by: McSwell | last post by:
I have an XML file that looks something like this: ------------------------ <?xml ...?> <!DOCTYPE ...> <src:fragment id="foo" ...> <Ph:Itemsome stuff </Ph:Item> <Ph:Itemsome more stuff...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.