473,804 Members | 2,715 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XInclude Issue !

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"?>
<?xml-stylesheet href="doc.xsl" type="text/xsl"?>
<!DOCTYPE doc []>
<doc xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:xi="http://www.w3.org/2001/XInclude"
xsi:noNamespace SchemaLocation= "doc.xsd">
<group1>
<b1>
<b11>lalala</b11>
<b12>lilili</b12>
</b1>
</group1>
</doc>

I want to extract this bloc from each files :

<b1>
<b11>lalala</b11>
<b12>lilili</b12>
</b1>

I want to create ONE unique file like this file :

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="doc.xsl" type="text/xsl"?>
<!DOCTYPE doc []>
<doc xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:xi="http://www.w3.org/2001/XInclude"
xsi:noNamespace SchemaLocation= "doc.xsd">
<group1>
<b1>
<b11>lalala</b11>
<b12>lilili</b12>
</b1>
<b1>
<b11>lalala</b11>
<b12>lilili</b12>
</b1>
<b1>
<b11>lalala</b11>
<b12>lilili</b12>
</b1>
</group1>
</doc>
To do that i've inserted xinclude like that but it doesn't work :

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="doc.xsl" type="text/xsl"?>
<!DOCTYPE doc []>
<doc xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:xi="http://www.w3.org/2001/XInclude"
xsi:noNamespace SchemaLocation= "doc.xsd">
<group1>
<xi:include href="File1.xml " xpointer="group 1">
<xi:fallback>No tFoundError</xi:fallback>
</xi:include>

<xi:include href="File2.xml " xpointer="group 1">
<xi:fallback>No tFoundError</xi:fallback>
</xi:include>

<xi:include href="File3.xml " xpointer="group 1">
<xi:fallback>No tFoundError</xi:fallback>
</xi:include>
</group1>
</doc>

What's wrong ?
Any help would be greatly appreciated.

regards
Mike
Sep 8 '06 #1
11 1851
When you say "doesn't work", what are you getting instead?

Are you sure you're running this through software which implements XInclude?

Are you sure the documents can be found at those relative URIs (which,
in some systems, may be case-sensitive)?
Sep 8 '06 #2
Le Fri, 08 Sep 2006 15:21:10 -0400, Joseph Kesselman a écrit :
When you say "doesn't work", what are you getting instead?
With :

<xi:include href="test.xml" xpointer="group 1">
<xi:fallbackFIC HIER NON TROUVE </xi:fallback>
</xi:include>

There's the following error:

"Include operation failed, reverting to fallback. Resource error reading
file as XML (href='File1.xm l'). Reason: XPointer resolution unsuccessful."

the element group1 seems not to be found ?? I've tried many calls like
xpointer="eleme nt(group1)" ...

Are you sure you're running this through software which implements XInclude?
I've tryed in eclipse with oxygenxml plugin there is a checkbox to activate
XInclude, and i've checked it.
Are you sure the documents can be found at those relative URIs (which,
in some systems, may be case-sensitive)?
documents can be found, each file File1.xml, File2.xml, ... are parsed and
i can transform them individualy with my stylesheets.

Thank you!
Sep 8 '06 #3
Le Fri, 08 Sep 2006 15:21:10 -0400, Joseph Kesselman a écrit :
When you say "doesn't work", what are you getting instead?
With :

<xi:include href="File1.xml " xpointer="group 1">
<xi:fallback404 ERR </xi:fallback>
</xi:include>

There's the following error:

"Include operation failed, reverting to fallback. Resource error reading
file as XML (href='File1.xm l'). Reason: XPointer resolution unsuccessful."

the element group1 seems not to be found ?? I've tried many calls like
xpointer="eleme nt(group1)" ...

Are you sure you're running this through software which implements XInclude?
I've tryed in eclipse with oxygenxml plugin there is a checkbox to activate
XInclude, and i've checked it.
Are you sure the documents can be found at those relative URIs (which,
in some systems, may be case-sensitive)?
documents can be found, each file File1.xml, File2.xml, ... are parsed and
i can transform them individualy with my stylesheets.

Thank you!
Sep 8 '06 #4
john fra wrote:
"Include operation failed, reverting to fallback. Resource error reading
file as XML (href='File1.xm l'). Reason: XPointer resolution unsuccessful."

the element group1 seems not to be found
Hm. Are the examples really as simple as those you've shown us, or are
namespaces involved?

I haven't used xpointer yet, so I'm not sure what else to suggest checking.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Sep 8 '06 #5
In article <ky************ *************** **@40tude.net>,
john fra <jo**@localhost .localdomainwro te:
<xi:include href="File1.xml " xpointer="group 1">
That would include an element with ID "group1", not name "group1".
>I've tried many calls like
xpointer="elem ent(group1)" ...
And so would that.

In your original message you say the files are like this:

<doc ...>
<group1>
<b1>
<b11>lalala</b11>
<b12>lilili</b12>
</b1>
</group1>
</doc>

and that you want the <b1element.

You can get that by using xpointer="eleme nt(/1/1/1)" - that is, the
first child of the first child of the first child of the document. To
get it by element name you would have to use something like the
XPointer xpointer() scheme, which may not be supported by your
XInclude implementation. The syntax would (I think) be something like
xpointer="xpoin ter(//b1)".

-- Richard
Sep 8 '06 #6
Ah. Thanks; that helps me too. I'm so used to thinking in terms of XPath
syntax that I apparently have trouble reading XPointer syntax.
>XPointer xpointer() scheme, which may not be supported by your
XInclude implementation. The syntax would (I think) be something like
xpointer="xpoin ter(//b1)".
That looks more like an XPath. Did you mistype, or did they confuse the
terminology?
Sep 9 '06 #7
In article <Gu************ *************** ***@comcast.com >,
Joe Kesselman <ke************ @comcast.netwro te:
XPointer xpointer() scheme, which may not be supported by your
XInclude implementation. The syntax would (I think) be something like
xpointer="xpoin ter(//b1)".
>That looks more like an XPath.
Yes, that's essentially what the XPointer xpointer scheme is - a
syntax for using XPaths to identify fragments.
>Did you mistype, or did they confuse the
terminology?
If I remember correctly, the original plan for XPointer was to use
XPaths. It was only later reduced to a core of "barenames" (IDs) and
the numeric element scheme, with the XPath part relegated to a
never-completed optional scheme.

See http://www.w3.org/TR/xptr - in particular the "previous version"
and "superseded by" links.

-- Richard
Sep 9 '06 #8
Richard Tobin wrote:
If I remember correctly, the original plan for XPointer was to use
XPaths. It was only later reduced to a core of "barenames" (IDs) and
the numeric element scheme, with the XPath part relegated to a
never-completed optional scheme.
Hm. If I'd known about it at the time, I'd have protested loudly. Might
not have had any effect, but...

(I understand why they might not want to support full XPath. I even
understand why they might want the default to be match-by-IDs. But
introducing a completely different syntax Bothers me.)

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Sep 9 '06 #9
Le 8 Sep 2006 23:53:17 GMT, Richard Tobin a écrit :
In article <ky************ *************** **@40tude.net>,
john fra <jo**@localhost .localdomainwro te:
> <xi:include href="File1.xml " xpointer="group 1">

That would include an element with ID "group1", not name "group1".
>>I've tried many calls like
xpointer="ele ment(group1)" ...

And so would that.

In your original message you say the files are like this:

<doc ...>
<group1>
<b1>
<b11>lalala</b11>
<b12>lilili</b12>
</b1>
</group1>
</doc>

and that you want the <b1element.

You can get that by using xpointer="eleme nt(/1/1/1)" - that is, the
first child of the first child of the first child of the document. To
get it by element name you would have to use something like the
XPointer xpointer() scheme, which may not be supported by your
XInclude implementation. The syntax would (I think) be something like
xpointer="xpoin ter(//b1)".

-- Richard
Ok, thank for all who've answered in this thread.

I understand why it don't work :

-1st : oxygenxml don't allow range, range-inside, and many others (maybe
due to parsers saxon or xalan). xpointer="xpoin ter(//b1)" isn't don't work
too.

-2nd : oxygenxml isn't able to deal with empty tags like this :
<doc ...>
<group1>
<b1>
<b11/>
<b12/>
</b1>
</group1>
</doc>

The result on inclusion is a truncated file (Bug?)
When I replace tags like <b11/by <b11></b11it works...

-3rd : I've forgottent to declare
<!ELEMENT xi:include EMPTY>
<!ATTLIST xi:include
xmlns:xi CDATA #FIXED "http://www.w3.org/2001/XInclude"
href CDATA #REQUIRED
parse (xml|text) "xml"
encoding CDATA #IMPLIED>
in doctype!...

Sep 11 '06 #10

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

Similar topics

1
2628
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 which uses xerces lib. I can't find what is wrong. Here is my files: sample.xsd: <?xml version="1.0"?> <schema
1
1755
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 must be missing something fundamental, can someone point it out, please? Here are all the gory details; ---- command line ----
3
1619
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
1491
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" xmlns:xi="http://www.w3.org/2001/XInclude" > <xi:include href="test-included.xml"
9
2104
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 error: -- Validating "structure.xml" against
1
1475
by: Sergey Numerov | last post by:
Of the numerous XML standards, the classes of System.XML support only XPath, XML Schema and DTD. If I want to exploit XLink, XInclude or XQuery, can .NET offer me anything? Are there third-party libraries that are compatible with some/all of the mentioned standards? How is programmatic processing of XML data that utilzes some/all of the above typically done?
4
3386
by: Tim Arnold | last post by:
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...
7
1874
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 href="./endcapA/disk/1a/10011.xml"/<!--D1A TR middles--> <xi:include href="./endcapA/disk/1a/10012.xml"/<!--D1A TR middles--> <xi:include href="./endcapA/disk/1a/10001.xml"/<!--D1A TR
2
2772
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 </Ph:Item> .... <Ph:Itemstill more stuff </Ph:Item> </src:fragment>
0
9571
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10561
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10318
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10302
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9132
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6845
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4277
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2976
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.