473,794 Members | 2,880 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1502
ke**@cpttm.org. mo (Kent Tong) wrote in message news:<c9******* *************** ****@posting.go ogle.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******@eurosp ort.com (Dimitre Novatchev) wrote in message news:<5f******* *************** ****@posting.go ogle.com>...
ke**@cpttm.org. mo (Kent Tong) wrote in message news:<c9******* *************** ****@posting.go ogle.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.go ogle.com>...
di******@eurosp ort.com (Dimitre Novatchev) wrote in message news:<5f******* *************** ****@posting.go ogle.com>...
ke**@cpttm.org. mo (Kent Tong) wrote in message news:<c9******* *************** ****@posting.go ogle.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
1854
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 can belong to multiple institutional affiliations (which can purchase on behalf of the user). The end user also has a rich trail of past transactions affiliations etc. Thus in the schema each user entity is related to many others which in turn...
4
2502
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 the subject of entities. I did the following ---- top of file ---- <?xml version="1.0"?> <!-- I added this to an existing document. --> <!DOCTYPE observation-set >
2
2498
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 target namespace of the components from the included schema document. I'm confused because of the rules I read in the XML Schema spec <http://www.w3.org/TR/xmlschema-1/#element-element>: > If the <element> element information item has <schema>...
19
3403
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 validates at W3C and WDG, and runs in standards compliance mode in Firefox 0.9. What I'm wondering is, is this a good practice? I assume my pages will load faster if declared as using the
2
1862
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 properly. So I changed it into a character entity. I tried several entity declarations (examples found on the web) but none of them worked i.e. Stylevision refused to load the schema. So, I want to know the following: is it possible to use...
2
5985
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: undefined entity: line 12, column 1 Does anyone know how to add entities when using xml.minidom? I've spend some time searching the docs/code/google but I haven't found the answer to this question!
3
3257
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 possible to do without DTD entities? e.g. Consider two elements like this which are present in my xml file. <AddValue>value1</AddValue> <CheckValue>value1</CheckValue>
3
1746
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
2571
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 way to restrict the entities used. - to read an XML file entities into a document, you need to use a DTD, or you get an exception (any other way ?) - The MathML DTD is HUGE (2400+ Entities, ~300k of files), loading it in a document is a big CPU...
0
9672
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
10435
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
9037
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
7538
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
5436
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
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
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
3721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
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.