473,804 Members | 3,196 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XInclude and XSchema

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:

--
[Xerces-J 2.7.1] Validating "structure. xml" against
"file:/D:/development/webapps/XCManager/web/WEB-INF/schemas/structure.xsd"
....
Ln 48 Col 70 - cvc-complex-type.2.4.a: Invalid content was found
starting with element 'xi:include'. One of
'{"http://www.wolterinkwe bdesign.com/xml/structure":clas s}' is expected.
--
What should i do?

I want to be able to use the xi:include element anywhere in
my xml document.
Should i change my xschema?
Oct 11 '05 #1
9 2104
Tjerk Wolterink writes:
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:

I want to be able to use the xi:include element anywhere in my xml
document. Should i change my xschema?


Yeah, this is a real pain. I don't know of a good general solution.

One could imagine writing an XSLT transform which produced a new
XInclude-friendly schema from an ordinary original, but the result
would be O(n^2) in size . . .

ht
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
Oct 12 '05 #2
Henry S. Thompson wrote:
Tjerk Wolterink writes:

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:

I want to be able to use the xi:include element anywhere in my xml
document. Should i change my xschema?

Yeah, this is a real pain. I don't know of a good general solution.

One could imagine writing an XSLT transform which produced a new
XInclude-friendly schema from an ordinary original, but the result
would be O(n^2) in size . . .

ht


Should'nt the xml schema xinclude elements be first processed before
it is validated against an xschema document??

Does'nt the w3c define how it must be done?

I'm using Xerces 2.7.1, they claim they support xinclude.

Oct 12 '05 #3
Tjerk Wolterink wrote:
Should'nt the xml schema xinclude elements be first processed before
it is validated against an xschema document??

Does'nt the w3c define how it must be done?


I re-read the XInclude recommendation, it is not clear to me. The
recommendation talks about including "infosets", which I understand as
the product of an XML Schema validation (right?).

Suppose that file A "xincludes" file B: this would mean that both A and
B are supposed to be validated against their respective XML schemas
first, and then merged. Hence, it would not be allowed to have 2 invalid
files A and B, whose merge however is valid. (I guess the 2 files have
to be at least well formed in order to produce infosets).

The question can be summarized simply as: "do you first Xinclude and
then check schema conformance, or first check schema conformance and
then Xinclude ?"

Pascal
Oct 12 '05 #4
Pascal Sartoretti wrote:
Tjerk Wolterink wrote:
Should'nt the xml schema xinclude elements be first processed before
it is validated against an xschema document??

Does'nt the w3c define how it must be done?

I re-read the XInclude recommendation, it is not clear to me. The
recommendation talks about including "infosets", which I understand as
the product of an XML Schema validation (right?).

Suppose that file A "xincludes" file B: this would mean that both A and
B are supposed to be validated against their respective XML schemas
first, and then merged. Hence, it would not be allowed to have 2 invalid
files A and B, whose merge however is valid. (I guess the 2 files have
to be at least well formed in order to produce infosets).

The question can be summarized simply as: "do you first Xinclude and
then check schema conformance, or first check schema conformance and
then Xinclude ?"


anyone has an anwser?
Oct 12 '05 #5
Tjerk Wolterink wrote:
Pascal Sartoretti wrote:
Tjerk Wolterink wrote:
Should'nt the xml schema xinclude elements be first processed before
it is validated against an xschema document??

Does'nt the w3c define how it must be done?


I re-read the XInclude recommendation, it is not clear to me. The
recommendation talks about including "infosets", which I understand as
the product of an XML Schema validation (right?).

Suppose that file A "xincludes" file B: this would mean that both A
and B are supposed to be validated against their respective XML
schemas first, and then merged. Hence, it would not be allowed to have
2 invalid files A and B, whose merge however is valid. (I guess the 2
files have to be at least well formed in order to produce infosets).

The question can be summarized simply as: "do you first Xinclude and
then check schema conformance, or first check schema conformance and
then Xinclude ?"


anyone has an anwser?

i think i found the answer here:
http://www.xml.com/pub/a/2002/07/31/...de.html?page=2

CopyPaste:
===
One of the most common questions about XInclude is how inclusion
interacts with validation, XSL transformation, and other processes
that may be applied to an XML document. The short answer is that it
doesn't. XInclusion is not part of any other XML process. It is a
separate step which you may or may not perform when and where it is
useful to you.

For example, consider validation against a schema. A document can be
validated before inclusion, after inclusion, or both. If you validate
the document before the xi:include elements are replaced, then the
schema has to declare the xi:include elements just like it would
declare any other element. If you validate the document after the
xi:include elements are replaced, then the schema has to declare the
replacement elements. Inclusion and validation are separate,
orthogonal processes that can be performed in any order which is
convenient in the local environment.
===
Oct 12 '05 #6
Infoset is not necessarily post schema-validation infoset. XInclude
and W3C XML Schema are independent RECs, and can and should be
implemented independently.

There is no unique correct ordering of the two -- I might wish to
constrain where xi:include elements may go in my document, so write a
schema which specifies thes and schema-validate first, then XInclude,
or I might only care about the validity of the result, so I XInclude
first, then schema-validate, or I might have _two_ schemas, and do
schema-validate, XInclude, schema-validate.

There are a number of XML Pipelining languages/tools around, to allow
you to specify which operations you want performed in which order.

I don't know if Xerces easily allows you to specify
XInclude-then-schema-validate, which appears to be what the OP wants.

ht
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
Oct 12 '05 #7
Henry S. Thompson wrote:
Infoset is not necessarily post schema-validation infoset. XInclude
and W3C XML Schema are independent RECs, and can and should be
implemented independently.

There is no unique correct ordering of the two -- I might wish to
constrain where xi:include elements may go in my document, so write a
schema which specifies thes and schema-validate first, then XInclude,
or I might only care about the validity of the result, so I XInclude
first, then schema-validate, or I might have _two_ schemas, and do
schema-validate, XInclude, schema-validate.

There are a number of XML Pipelining languages/tools around, to allow
you to specify which operations you want performed in which order.

I don't know if Xerces easily allows you to specify
XInclude-then-schema-validate, which appears to be what the OP wants.


Yes that is what i want, i
think is it easily possible with the api,
but my xml editor does not have an option
to xlinclude-then-schema-validate.

too bad.
But.. there is one strange thing:

When i have a document like this:

<?xml version="1.0"?>
<human-interface
xmlns="http://www.wolterinkwe bdesign.com/xml/human-interface"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocat ion="http://www.wolterinkwe bdesign.com/xml/human-interface
../schemas/human-interface.xsd"
xmlns:xi="http://www.w3.org/2001/XInclude">

<xi:include href="validatio n-messages.xml" parse="xml"/>

</human-interface>
Then there is enough information in the document to validate the
document against the schema (./schemas/human-interface.xsd)

But the validator does not know wether it must
xinclude-then-schema-validate
or just start schema-validate right away.

Should'nt w3c define a attribute like
xi:includeBefor eValidate="true "
??

Now i do'nt know how to document is validated with a validator.
( must i really programmaticall y setup the validator to work right?)
Oct 12 '05 #8
Tjerk Wolterink wrote:
i think i found the answer here:
http://www.xml.com/pub/a/2002/07/31/...de.html?page=2

CopyPaste:
===
One of the most common questions about XInclude is how inclusion
interacts with validation, XSL transformation, and other processes that
may be applied to an XML document. The short answer is that it doesn't.
XInclusion is not part of any other XML process. It is a separate step
which you may or may not perform when and where it is useful to you.

For example, consider validation against a schema. A document can be
validated before inclusion, after inclusion, or both.


Very good source, thanks (Elliotte Rusty Harold is always a goldmine...).

So it seems that everything is possible, however it would be nice to
have real-world experience or "best practices" to know what works well
(or not!). Can anybody provide such information?

Pascal
Oct 13 '05 #9
Tjerk Wolterink wrote:
Henry S. Thompson wrote:
Infoset is not necessarily post schema-validation infoset. XInclude
and W3C XML Schema are independent RECs, and can and should be
implemented independently.

There is no unique correct ordering of the two -- I might wish to
constrain where xi:include elements may go in my document, so write a
schema which specifies thes and schema-validate first, then XInclude,
or I might only care about the validity of the result, so I XInclude
first, then schema-validate, or I might have _two_ schemas, and do
schema-validate, XInclude, schema-validate.

There are a number of XML Pipelining languages/tools around, to allow
you to specify which operations you want performed in which order.

I don't know if Xerces easily allows you to specify
XInclude-then-schema-validate, which appears to be what the OP wants.


Yes that is what i want, i
think is it easily possible with the api,
but my xml editor does not have an option
to xlinclude-then-schema-validate.

too bad.
But.. there is one strange thing:

When i have a document like this:

<?xml version="1.0"?>
<human-interface
xmlns="http://www.wolterinkwe bdesign.com/xml/human-interface"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocat ion="http://www.wolterinkwe bdesign.com/xml/human-interface
./schemas/human-interface.xsd"
xmlns:xi="http://www.w3.org/2001/XInclude">

<xi:include href="validatio n-messages.xml" parse="xml"/>

</human-interface>
Then there is enough information in the document to validate the
document against the schema (./schemas/human-interface.xsd)

But the validator does not know wether it must
xinclude-then-schema-validate
or just start schema-validate right away.

Should'nt w3c define a attribute like
xi:includeBefor eValidate="true "
??

Now i do'nt know how to document is validated with a validator.
( must i really programmaticall y setup the validator to work right?)


anyone??

Oct 13 '05 #10

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

Similar topics

1
1596
by: Xaradas | last post by:
Someone could tell me how can I validate an xml file against an Xschema using php? Thanks and sorry for my little english. ------------------------------------- "Computer Science is no more about computers than astronomy is about telescopes." ::
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 ----
4
3075
by: Binesh Bannerjee | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi. In another thread, Martin Honnen <mahotrash@yahoo.de> wrote: > XHTML is XML so there is no problem to use it inside of an XML document e.g. > <root> > <description> > <p xmlns="http://www.w3.org/1999/xhtml">description goes here</p> > </description>
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>
0
1027
by: Tjerk Wolterink | last post by:
I want to define an schema that allows the following documents: The name of the elements do not matter, but all the elements should have the following attribute: <xsd:attribute name="type" type="xsd:string"/>
11
1851
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
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
9704
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10069
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
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...
1
7608
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
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();...
0
5505
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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.