473,406 Members | 2,378 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,406 software developers and data experts.

No way to use entities in a document using schema?

Hi,

This is wha I'm trying to do:

<?xml version="1.0"?>
<!DOCTYPE library [
<!ENTITY foo "Some sentence...">
]>
<library xmlns="http://foo.com">
&foo;
</library>

But Xerces is saying that "library" element type is undefined. I can
understand that as library is defined in the "http://foo.com"
namespace. Does it means that it is impossible to use entities in
a document using schema/namespace?

If it is true, then it is impossible to split a large xml file into
several small files and then include them as external entites?

Thanks for any advice!
Jul 20 '05 #1
3 1489
ke**@cpttm.org.mo (Kent Tong) wrote in message news:<c9**************************@posting.google. com>...
Hi,

This is wha I'm trying to do:

<?xml version="1.0"?>
<!DOCTYPE library [
<!ENTITY foo "Some sentence...">
]>
<library xmlns="http://foo.com">
&foo;
</library>

But Xerces is saying that "library" element type is undefined. I can
understand that as library is defined in the "http://foo.com"
namespace. Does it means that it is impossible to use entities in
a document using schema/namespace?

If it is true, then it is impossible to split a large xml file into
several small files and then include them as external entites?

Thanks for any advice!


If I understand well, you don't want to do validation here at all.
Just suppress validation -- the parser will still read the DTD and
will correctly substitute the value of the entity for every occurence
of its entity reference.
Cheers,

Cheers,

Dimitre Novatchev [XML MVP],
FXSL developer, XML Insider,

http://fxsl.sourceforge.net/ -- the home of FXSL
Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html
Jul 20 '05 #2
di******@eurosport.com (Dimitre Novatchev) wrote in message news:<5f**************************@posting.google. com>...
ke**@cpttm.org.mo (Kent Tong) wrote in message news:<c9**************************@posting.google. com>...
If I understand well, you don't want to do validation here at all.
Just suppress validation -- the parser will still read the DTD and
will correctly substitute the value of the entity for every occurence
of its entity reference.


No, I am not trying to surpress validation. I want validation.

What I am trying to do is:
1. to introduce an entity to represent a long sentence that
would be used in many places.
2. to let different people work on different XML files and
then include the files into the main XML file.
Jul 20 '05 #3
ke**@cpttm.org.mo (Kent Tong) wrote in message news:<c9**************************@posting.google. com>...
di******@eurosport.com (Dimitre Novatchev) wrote in message news:<5f**************************@posting.google. com>...
ke**@cpttm.org.mo (Kent Tong) wrote in message news:<c9**************************@posting.google. com>...
If I understand well, you don't want to do validation here at all.
Just suppress validation -- the parser will still read the DTD and
will correctly substitute the value of the entity for every occurence
of its entity reference.


No, I am not trying to surpress validation. I want validation.

What I am trying to do is:
1. to introduce an entity to represent a long sentence that
would be used in many places.
2. to let different people work on different XML files and
then include the files into the main XML file.


Then you have to write the DTD to describe the structure of this
document type and the real names of the elements.

Unfortunately, DTD's are not namespace aware, therefore namespaces are
defined as attributes.

Here's the correct DTD for your document:

<!DOCTYPE library [
<!ENTITY foo "Some sentence...">
<!ELEMENT library (#PCDATA)>
<!ATTLIST library xmlns CDATA #FIXED
"http://foo.com" >

]>
<library xmlns="http://foo.com">
&foo;
</library>

You can check that now the validation is successful.

I'd greatly recommend a good book on XML -- the one that I have
recently read is:

"Effective XML, 50 Specific Ways to Improve Your XML", by Elliotte
Rusty Harold.

This is a great book that goes deep into many advanced topics of XML.
Hope this helped.
Cheers,

Dimitre Novatchev [XML MVP],
FXSL developer, XML Insider,

http://fxsl.sourceforge.net/ -- the home of FXSL
Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html
Jul 20 '05 #4

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

Similar topics

9
by: Robert Brown | last post by:
Our customer (of our ecommerce system) wants to be able to preserve deleted entities in the database so that they can do reporting, auditing etc. The system is quite complex where each end user...
4
by: Peter C. Chapin | last post by:
I have a need to include Greek letters in some of my XML documents (the documents contain astronomical information and many stars are named using Greek letters). Following some earlier postings on...
2
by: Stanimir Stamenkov | last post by:
I'm trying to find out if it is permissible to include a schema document with absent target namespace to a schema with specified target namespace, and if it is, what are the rules to resolve the...
19
by: Ian | last post by:
I'm using the following meta tag with my documents: <meta http-equiv="Content-Type" content= "text/html; charset=us-ascii" /> and yet using character entities like &rsquo; and &mdash; It...
2
by: kamp | last post by:
Hello, Below is a snippet from a schema. The second enumeration should contain an i umlaut (archaïsch) but when I use this schema with Altova's Stylevision software the iumlaut is not displayed...
2
by: Nick Craig-Wood | last post by:
I'm using xml.minidom to parse some of our XML files. Some of these have entities like "&deg;" in which aren't understood by xml.minidom. These give this error. xml.parsers.expat.ExpatError:...
3
by: bheem | last post by:
I have a few questions about DTD ENTITY. I would appreciate any help. 1. Is there any equivalent of this in xsd? Suppose I want to use the same string in multiple places in an xml file, is it...
3
by: Rohit Sharma | last post by:
Hi all.. ..NET + MSXML platform....VB Need to build a list of all the entities and attributes to allow the user to do search...how can i do that from the schema ?? Cheers Rohit
3
by: Michel de Becdelièvre | last post by:
I have some *performance* trouble reading MathML files in my application (in ASP.Net). - I have small MathML files (2-3k) as input - as (almost) all MathML files these use entities. I have no...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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,...
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...
0
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...
0
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...

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.