xinclude

Include one XML within another XML and parse it with python

混江龙づ霸主 提交于 2021-01-29 13:23:34
问题 I wanted to include an XML file in another XML file and parse it with python. I am trying to achieve it through Xinclude. There is a file1.xml which looks like <?xml version="1.0"?> <root> <document xmlns:xi="http://www.w3.org/2001/XInclude"> <xi:include href="file2.xml" parse="xml" /> </document> <test>some text</test> </root> and file2.xml which looks like <para>This is a paragraph.</para> Now in my python code i tried to access it like: from xml.etree import ElementTree, ElementInclude

Adding xml prefix declaration with lxml in python

最后都变了- 提交于 2020-02-05 03:44:05
问题 Short version : How to add the xmlns:xi="http://www.w3.org/2001/XInclude" prefix decleration to my root element in python with lxml ? Context : I have some XML files that include IDs to other files. These IDs represent the referenced file names. Using lxml I managed to replace these with the appropriate XInclude statement, but if I do not have the prefix decleration my my XML parser won't add the includes, which is normal. Edit : I won't include my code because it won't help at understanding

Trying to use XInclude with Java and resolving the fragment with xml:id

a 夏天 提交于 2020-01-24 20:00:12
问题 I've been trying to get XInclude working in my XML document and finally have it working in Oxygen XML, which I'm using to author the XML documents. I then went to my app, written in Java, but it doesn't seem to support any form of XPointer resolution except using something like: element(/1/2). This is, obviously, an awful scheme to have to use since every time the document is edited the XPointer needs changing to reflect the new position of the node in the XML! The scheme I had working simply

Copy xml document's images in different source locations into single output directory

╄→гoц情女王★ 提交于 2019-12-30 11:14:20
问题 I am having a xml document with uses xinclude for access several other xml files. <chapter xml:id="chapter1"> <title>Chapter in Main Doc</title> <section xml:id="section"> <title>Section in Main Doc 1</title> <mediaobject> <imageobject> <imagedata fileref="images/car.jpg"/> </imageobject> </mediaobject> </section> <xi:include href="../some-doc/section1.xml"/> <xi:include href="../some-doc/section2.xml"/> These other section1 and section2 xml files uses different images in different source

XML XInclude and two elements with the same name

独自空忆成欢 提交于 2019-12-25 11:49:21
问题 I have two different XML files (IzPack installation to be exact) which a common part. Naturally, I would like to keep this common part in one (external) file and to include it into two XML installation files. I cannot make it work as it appears that XInclude can only include files with XML elements. To illustrate the example, here is some code: File 1: <packs> <pack name="1"> ... </pack> <pack name="2"> ... </pack> <packs> File 2: <packs> <pack name="1"> ... </pack> <pack name="2"> ... </pack

XML XInclude and two elements with the same name

不羁的心 提交于 2019-12-25 11:49:07
问题 I have two different XML files (IzPack installation to be exact) which a common part. Naturally, I would like to keep this common part in one (external) file and to include it into two XML installation files. I cannot make it work as it appears that XInclude can only include files with XML elements. To illustrate the example, here is some code: File 1: <packs> <pack name="1"> ... </pack> <pack name="2"> ... </pack> <packs> File 2: <packs> <pack name="1"> ... </pack> <pack name="2"> ... </pack

Alternative to XInclude

只愿长相守 提交于 2019-12-24 02:43:44
问题 As far as I know there is no support for XInclude in .net. I'd like to leverage the same kind of mechanism for hierarchically organized XML configuration files. I mean I have a top-level XML config file referencing specific Xml files. My configuration is a cluster of configurations dedicated to one particular module. How should I do it ? (Or maybe why I shouldn't do it..) 回答1: First of all, there is some 3rd party support for XInclude in .NET XInclude.NET on Codeplex. If you are asking

How to use multiple configuration files for log4j2

一个人想着一个人 提交于 2019-12-22 08:14:11
问题 I am writing Java code that tests a Java library. The library includes its own log4j2 configuration as part of the distribution. I would like to use log4j2 in my test code without modifying the library's configuration. Is there a way to have a separate log4j2 configuration for my test code? This is all running as command-line Java, no servers or web involvement at all. EDIT to try to be more clear: What I want is to be able to configure loggers, appenders, etc for the test code to use , and

XMLStarlet + XInclude + XSLT

此生再无相见时 提交于 2019-12-12 09:47:06
问题 I'd like to include contents of an XML document into another XML document and transform it via xmlstarlet+XSLT. I'm trying to use XInclude. (A newbie to both XInclude and XSLT, I am.) The xmlstarlet, though, won't process the included XML doc, it just leaves the inclusion node there untouched. File a.xml : <?xml version="1.0" ?> <doc xmlns:xi="http://www.w3.org/2001/XInclude"> a <xi:include href="b.xml" /> b </doc> File b.xml : <?xml version="1.0" ?> <snippet> c </snippet> The x.xsl "pass

Is it possible to use wildcards with XInclude tags?

 ̄綄美尐妖づ 提交于 2019-12-11 11:25:05
问题 I'm afraid it's not possible, but haven't found anywhere it is said to be impossible either. I'd like to include a set of files within a XML document using wildcards. Like this: <?xml version="1.0" encoding="utf-8"?> <mydocument> <!-- ... --> <xi:include href="*include.xml"/> </mydocument> I know it doesn't work, but I think it clearly expresses my intentions. Is there a way to achieve this? Edit: I tried to use xpointer attribute, but couldn't make it work. 回答1: Is it possible to use