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

Home Posts Topics Members FAQ

Regression Apache Xerces ? DOCTYPE and XMLSchema

I have an XML document, which is actually physically stored in 2
separated files.

doc1.xml and doc2.xml

I NEED a WAY FOR THIS SIMPLE NEED : XML file splitted into two
physical files,
and use of XML Schema.
USING DTD : OK.
---------------
doc2.xml is included within doc1.xml with an external ENTITY when
using a DTD, and this works fine.

<!DOCTYPE PROJECT SYSTEM "leon/conf/dtd/leon.dtd"
[
<!-- Inclusion des actions standard -->
<!ENTITY DOC2 SYSTEM 'leon/conf/xml/leon.xml'>
]>

<PROJECT id="compta" rootAction="com pta_dashboard">
&DOC2;
</PROJECT>

USING XML Schema : OK if no Entities
------------------------------------
<PROJECT xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespace SchemaLocation= "leon/conf/xml/leon.xsd" id="compta"
rootAction="com pta_dashboard">

<!-- . . . -->
</PROJECT>

But here I need to COPY PASTE the DOC2.XML file content which is ugly
since I have actually many files like doc2.xml to include

*************** *************** **************
*** Here come troubles with Xerces parsers :
*************** *************** **************
1) I tried to add the DOCTYPE with no DTD (supported by an old
version of xerces Parser)

<!DOCTYPE PROJECT
[
<!-- Inclusion des actions standard -->
<!ENTITY DOC2 SYSTEM 'leon/conf/xml/leon.xml'>
]>

<PROJECT xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespace SchemaLocation= "leon/conf/xml/leon.xsd" id="compta"
rootAction="com pta_dashboard">

&DOC2;
</PROJECT>

This is *NOT* working since DOCTYPE is PREFERRED to the XMLSchema and
it says that my root element PROJECT is undefined :-(

2) I tried to play with features :
parser.setFeatu re("http://xml.org/sax/features/validation", true);
parser.setFeatu re("http://apache.org/xml/features/validation/schema",
true);

It did'nt worked either

3) I tried to get rid of the DOCTYPE, got xerces 2.6 (recent) and use
the new XInclude syntax :
<PROJECT xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespace SchemaLocation= "leon/conf/xml/leon.xsd" id="compta"
rootAction="com pta_dashboard">

<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="doc2.xml" parse='xml' encoding="ISO-8859-1"/>
</PROJECT>

This SEEMS to include the doc2.xml file, but how stupid ! It says that
no grammar (DTD) is found for doc2.xml !
Of course because it is an XML Schema.

I also tried :
<PROJECT xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespace SchemaLocation= "leon/conf/xml/leon.xsd" id="compta"
rootAction="com pta_dashboard">

<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="doc2.xml" parse='text' encoding="ISO-8859-1"/>
</PROJECT>

But this is not validating : doc2.xml is considered as a String and
not as a NodeSet ...

-----------------------------------------------------

Did anyone succeed in using Xerces and XMLSchema + entities ?
The only solution I see is to have my own Reader for the XML source
for xerces
and replace the entities of my own before the parsers gets it, but
this what the parser is expected to do ???

Thanks a lot for your help/support
Nicolas BODIN
Jul 20 '05 #1
0 1776

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

Similar topics

0
1451
by: Steinar Bang | last post by:
Platform: Intel PII, debian sarge testing/unstable, Blackdown J2SDK 1.4.0.99beta-1, ant 1.5.3-1, libxerces2-java 2.4.0-1, libxalan-java 2.4.1-1 Is there a way to make the Xerces-J parser, used as a SAX parser in Ant, use Norm Walsh's Catalog Resolver for finding DTDs, by just setting properties with -D command line arguments? Alternatively, is there a way to make Xerces-J not look for the DTD in a <DOCTYPE> declaration, by setting...
2
4661
by: Olaf Meyer | last post by:
Apprentently xerces 2.6.0 (Java) does not validate against contraints specified in the schema (e.g. constraints specified via unique element). The validation works with the XML editor I'm using (XMLSpy4) but not with Xerces 2.6.0. I've included a really short and simple example to illustrate it. I would like to get some comments on the validation capabilities of Xerces 2.6.0. I though it *fully* supported W3C Schema!
0
3091
by: Waseem | last post by:
Hi I have looked and tried everything and i still cant sort this out i have no idea why this wont work I am using Xerces Perl on Windows and Debian to try this and it wont work on both of them. Basically i am tryin to do simple tree transversale and get the node values out
0
1513
by: *Jeff Esposito* | last post by:
Could somebody please point me to some sample xerces c++ code that creates an XML document with a schema. I have been able to find plenty of dtd examples, but no schema examples. What am I supposed to do -- call createDocument with a NULL DocType, add then call setAttribute on the root node for the attributes (xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" and xsi:noNamespaceSchemaLocation="foo.xsd" )?
5
1967
by: Harald Haspl | last post by:
Hello, I've appended a simple XML file and it's appropriate schema below. I want to validate the XML file against the schema with xerces-c. This example contains a section where colours are defined and a section where referenzes to these definitions are made. Values are valid only if they were defined above. A key constraint is defined for Definition/Color/ids, keyref to
2
3675
by: VanOrton | last post by:
Hi all, When XercesDOMParser parses an XML document with a Schema instance, by default it adds all missing default and fixed attributes. I have the impression though that it misses the namespace prefices... I'm using Xerces 2.5.0. Here's a document parsed by Xerces:
3
1956
by: Nicolas | last post by:
Hi everybody, I'm stuck for a couple of days now to the following issue, concerning fixed/default attributes and multiple namespaces. Any help would be greatly appreciated... I'm using Xerces C++ 2.7.0. Here are two XML Schemas:
9
3023
by: mstilli | last post by:
Hi, I am trying to use schema for server side validation using xerces to catch the validation errors. validating this XML: <Content4> <textarea13></textarea13> <binaryobject3></binaryobject3>
2
6773
by: furrypop | last post by:
Hi, I'm trying to get the Perl SOAP::Lite examples to work on a Windows PC, running Apache 2.2.4. Apache is definitely serving CGI scripts, as I've tested a dummy Hello World thing. I'm also definitely getting a hit when I use a browser to get to my hibye.cgi server (well, a blank page rather than a 404). However, when I run my hibye.pl client, I receive a 503 Service Unavailable at H:\scripts\hibye.pl line 25. It works when I...
0
9705
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
9575
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
10320
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
7609
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
6846
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
5645
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4288
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
3806
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2981
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.