Root element name not declared

K

korovev76

Hi guys, i'm using pyrxp to parse some xml like this one:

<?xml version="1.0"?>
<!DOCTYPE MyMessage SYSTEM "mymessage.dtd">
<MyMessage release="2.0">
<From>abc</From>
<To>def</To>
......

where the dtd is defined like this:

<!ENTITY % UsingLocalNames "IGNORE" >
<![%UsingLocalNames;[
<!ENTITY % MyMessage "">
<!ENTITY % FieldA "">
<!ENTITY % FieldB "">
,,,,,


While parsing, I receive an error like this one: Root element name
MyMessage not declared....
Being both the file and the dtd provided by the supplier, I believe
they're correct so I don't understand what's wrong. MyMessage IS
declared... isn't it sufficient?

Thanx
korovev
 
?

=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=

<!DOCTYPE MyMessage SYSTEM "mymessage.dtd">
<MyMessage release="2.0">
[...]
<!ENTITY % MyMessage "">
,,,,, [...]
Being both the file and the dtd provided by the supplier, I believe
they're correct so I don't understand what's wrong. MyMessage IS
declared... isn't it sufficient?

No. MyMessage is declared above as a Parameter Entity (PE), not
as an element. Look for definitions that start with <!ELEMENT.
Also, look for for occurrences of IGNORE around any such definition.

If you see MyMessage used, try to find out what it's "normal"
definition is; the definition you gave is IGNOREd unless
UsingLocalNames is defined to INCLUDE (which I assume it is not).
For example, if there was the fragment

<!ENTITY % MyMessage "Envelope">

<!ELEMENT %MyMessage; (From|To)>

then the name of the root element would not be MyMessage, but
Envelope.

HTH,
Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,123
Latest member
Layne6498
Top