XML parsing error

stalkio

New Member
Messages
45
Reaction score
0
Points
0
I am just trying to learn a bit of XML and I came across this:

europe.dtd

Code:
<!ENTITY at "Austria">

<!ENTITY be "Belgium">

<!ENTITY dk "Denmark">

<!ENTITY fi "Finland">

<!ENTITY fr "France">

<!ENTITY de "Germany">

<!-- and so on... -->

XMLpg45.xml

Code:
<?xml version="1.0"  encoding="UTF-8"?>

<!DOCTYPE address [

    <!ELEMENT address (city)*>
    <!ELEMENT city (#PCDATA)>
    <!ATTLIST city country CDATA #IMPLIED>

    <!ENTITY % europe SYSTEM "europe.dtd">

    %europe;

]>


<address>
    <city country="&fr;">Paris</city>
</address>

I am not using a XML editor - only notepad & for some unknown reason when I load it on the browser to check it I get the message:

XML Parsing Error: undefined entity
Location: file:///C:/Documents%20and%20Settings/Ryan%20Bibby/Desktop/Website!!!!!!/Examples/XMLpg45.xml
Line Number 18, Column 2:

<city country="&fr;">Paris</city>
--------^

what am I doing wrong?
 

DeadBattery

Community Support Team
Community Support
Messages
4,018
Reaction score
120
Points
0
Although I don't know anything about XML, I suggest looking at this part
Code:
country="&fr;"
See if that complies to standard forms etc.
:)
 

stalkio

New Member
Messages
45
Reaction score
0
Points
0
yes thanks but can't figure out quite what - I got it from a XML guide book

Anyone at all??
 

marshian

New Member
Messages
526
Reaction score
9
Points
0
For some reason I've never heard about stuff like this...
Anyway, the error is gone when you change "&fr;" into "fr". On the other side, I'm freaking tired atm, so you might want to double-check this...
 

woiwky

New Member
Messages
390
Reaction score
0
Points
0
If you change it to "fr", then it's no longer an entity. So it just becomes country="fr" instead of "country="France"(the expected result).

I'm guessing you're using Firefox, stalkio? Unfortunately, Firefox doesn't currently support parameter entity subset dtd's, and hasn't for a while. It was reported years ago here:

https://bugzilla.mozilla.org/show_bug.cgi?id=22942

But there still has been no ambition to fix it from Mozilla. So you're just gonna have to put the full dtd in a single file.
 
Last edited:

stalkio

New Member
Messages
45
Reaction score
0
Points
0
true ..very true about the entity - yes you are right I was using Firefox..all others seem to accept. Real shame that FF doesn't support dtds = thanks for the push!!
 

kdcco916

New Member
Messages
2
Reaction score
0
Points
0
Try,

<!ATTLIST city CDATA #IMPLIED>
<!ATTLIST country CDATA #IMPLIED>
.
.
.

<address>
<city>Paris</city>
<country>FR<country/>
</address>

You are trying to get too fancy with your XML. Some platforms will not allow you to run an a multiword XML field like 'city country'. You can't get into trouble with something like this 'cityandcountry'

I've run into a lot of headaches with parsing XML data and I've had to really dumb down my designs to make them work.
 

stalkio

New Member
Messages
45
Reaction score
0
Points
0
Also - is it true that X10 doesn't support XSLT? CAN we install it or is there anyway around this?? Because on trying to access some live feeds I was given the following message:

MM_XSLTransform error.
The server could not perform the XSL transformation because an XSLT processor for PHP could not be found. Contact your server administrator and ask them to install an XSLT processor for PHP.
 

woiwky

New Member
Messages
390
Reaction score
0
Points
0
You'd have to make a suggestion in the Feedback & Suggestions forum to have xslt processing libraries installed and hope it gets accepted, get a VPS package where you can install whatever you want on your server, or create your own xslt processor. I'd say creating your own is probably the best way to go unless you'd really make use of having a VPS.

Creating one wouldn't be too hard if you know php fairly well since xml's rules are very clear and strict. The only problem would be adapting the code you have to use your processor instead. But if you can identify all the functions it uses for processing, just name your functions the same and it should be alright.
 

deadimp

New Member
Messages
249
Reaction score
0
Points
0
Some platforms will not allow you to run an a multiword XML field like 'city country'.
What is a multiword XML field?
To me, and I'm guessing to standard XML parsers, it is simply a field with attributes.

The only 'multiword' XML field I could think of explicitly scoped in a namespace, separated by underscores, or a period, but the last two are only different identifiers / naming conventions.
 
Last edited:
Top