473,386 Members | 1,668 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,386 software developers and data experts.

xinclude all children

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>
----------------------

I want to xinclude all the children of the root element into another
XML file. I've been trying things like
<xi:include href="firstFileName" xpointer="foo/1"/>
However, if(!) I'm understanding correctly, this would only xinclude
the *first* child of the element named 'foo'. Instead, I want to
xinclude *all* the children. I would have thought that this
<xi:include href="firstFileName" xpointer="foo/*"/>
would work, but it generates an error:
XPointer evaluation failed: #foo/*
All the variants of this that I've tried also fail.

How do I xinclude all children of the specified element?

Mike Maxwell
CASL/ U MD
Jul 4 '08 #1
2 2745
hi,

McSwell a écrit :
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>
----------------------

I want to xinclude all the children of the root element into another
XML file. I've been trying things like
<xi:include href="firstFileName" xpointer="foo/1"/>
Provided that your XInclude engine support them, you can use the
xpointer() scheme from the XPointer framework ; usually, tools that
support them only support XPath, or a subset of XPath

If I don't make mistakes, try this :
<xi:include href="firstFileName" xpointer="xpointer(/foo/node())"/>
....but I don't remember if the spec doesn't impose limitations such as
"there must be a single node" :(

You can try RefleX for performing your XInclusions where XPath is rather
well supported :
http://reflex.gforge.inria.fr/
Here is a basic example with XInclude :
http://reflex.gforge.inria.fr/tutori...#dtdValidation

And the result of the test suite, for DOM and SAX (both are supporting
XPath)
http://reflex.gforge.inria.fr/tests-xinclude.html
However, if(!) I'm understanding correctly, this would only xinclude
the *first* child of the element named 'foo'. Instead, I want to
xinclude *all* the children. I would have thought that this
<xi:include href="firstFileName" xpointer="foo/*"/>
would work, but it generates an error:
XPointer evaluation failed: #foo/*
All the variants of this that I've tried also fail.

How do I xinclude all children of the specified element?

Mike Maxwell
CASL/ U MD

--
Cordialement,

///
(. .)
--------ooO--(_)--Ooo--------
| Philippe Poulard |
-----------------------------
http://reflex.gforge.inria.fr/
Have the RefleX !
Jul 7 '08 #2
On Jul 7, 5:23 am, Philippe Poulard <philippe.poular...@SPAMinria.fr>
wrote:
If I don't make mistakes, try this :
<xi:include href="firstFileName" xpointer="xpointer(/foo/node())"/>
Thanks, this appears to be working now!

(I should have mentioned, I was using xmllint to verify the XML doc.)

Mike Maxwell
CASL/ U MD
Jul 7 '08 #3

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...
1
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...
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"?>
4
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...
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...

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.