Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

once again i need help! xml/dtd problems

Featured Replies

Hi people, was on here last month with dtd problems!

 

I have modified my dtd to this now as my tutor said i needed to add entities and atributes to my work

 

This is my dtd.

 

<!DOCTYPE MUSICBIDDING [

 

<!ELEMENT HEADER(#PCDATA)>

<!ELEMENT GENRE (#PCDATA)>

<!ELEMENT ARTIST (FIRSTNAME, SURNAME)>

<!ELEMENT ALBUM (#PCDATA)>

<!ELEMENT LABEL (#PCDATA)>

<!ELEMENT PRICE (#PCDATA)>

<!ELEMENT DELIVERY (#PCDATA)>

<!ENTITY % free "free uk delivery">

<!ELEMENT SELLER (FIRSTNAME, SURNAME)>

<!ELEMENT PHONE (#PCDATA)>

<!ELEMENT MOBILE (#PCDATA)>

<!ELEMENT DESCRIPTION (#PCDATA)>

 

]</MUSICBIDING>

 

 

and the xml for the entity is

 

<delivery> %free; </delivery>

 

It's a text shortcut i'm trying to do. The dtd is external.

 

But when previewed the shortcut just says "%free;" instead od "free uk delivery"?

why is this?

 

Also does anyone know what i could use for an atribute?

 

thanks rachel

  • Author

try to validate the dtd or the xml? I'm not sure what your getting at?

  • Author

right, this is my xml

 

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

 

<?xml-stylesheet href="musicbidding.css" type="text/css"?>

 

<!DOCTYPE musicbidding SYSTEM "musicbidding.dtd">

 

 

 

<musicbidding>

 

<header>CD Bay Incorporated Music Bidding</header>

 

<genre>Pop Music</genre>

 

<artist>

<firstname>Amy</firstname>

<surname>Winehouse</surname>

</artist>

 

<album>Back to Black</album>

 

<label>Island</label>

 

<price>£7.98</price>

 

<delivery>%free;</delivery>

 

<seller>

<firstname>Ted</firstname>

<surname>Kord</surname>

</seller>

 

<phone>0191 200 3456</phone>

 

<mobile>07564 33333</mobile>

 

<description>Amy Winehouse's second album, Back to Black,

is one of the finest soul albums, British or otherwise,

to come out for years. Frank, her first album, was a sparse

and stripped-down affair; Back to Black, meanwhile, is neither

of these things. This time around, she's taken her inspiration

from some of the classic 1960's girl groups like the

Supremes and the Shangri-Las, a sound particularly suited to her

textured vocal delivery, while adding a contemporary songwriting

sensibility.</description>

 

</musicbidding>

 

and this is the dtd file

 

<!DOCTYPE MUSICBIDDING [

 

<!ELEMENT HEADER(#PCDATA)>

<!ELEMENT GENRE (#PCDATA)>

<!ELEMENT ARTIST (FIRSTNAME, SURNAME)>

<!ELEMENT ALBUM (#PCDATA)>

<!ELEMENT LABEL (#PCDATA)>

<!ELEMENT PRICE (#PCDATA)>

<!ELEMENT DELIVERY (#PCDATA)>

<!ELEMENT SELLER (FIRSTNAME, SURNAME)>

<!ELEMENT PHONE (#PCDATA)>

<!ELEMENT MOBILE (#PCDATA)>

<!ELEMENT DESCRIPTION (#PCDATA)>

<!ENTITY %free "Free UK Delivery">

 

]</MUSICBIDING>

 

so why won't the entity "free" not work as a text shortcut? don't understand as this is what it says in my xml book?

 

 

Help Please

Hi rachelt, I think you need to have a space between the % and the entity name in the declaration so

<!ENTITY %free "Free UK Delivery">

should be

<!ENTITY % free "Free UK Delivery">

  • Author

Tried that, makes no difference. when i open the html the space that should say free uk delivery actually says %free; so it's as if it's not even seeing the entity in the dtd?

Hi rachelt, I'm not an expert by the way (you probably know more than I do)

Is it because you are using a Parameter entity instead of an Internal entity?

  • Author
Hi rachelt, I'm not an expert by the way (you probably know more than I do)

Is it because you are using a Parameter entity instead of an Internal entity?

 

 

Please explain more please!? difference between?

If you check out this site, it might give you some more pointers.

Not the most exciting site in the world but full of good information.

The phrase that I noticed was this one:

'Parameter entities can't be used in the content of your document; they simply aren't recognized.'

Have a read and let me know if it makes any difference at all or whether I'm talking jibberish :)

Ah, I missed that bit.

 

I have to say, Firefox and Opera disappointed me. Firefox won't load enternal entities and fails. Opera just prints out the entity code. IE appear to be the winner here with the best support.

... yes ... despite how weird it sounds... IE ..nnnnghgh.... is actually good at XML by the looks of it. * :wacko::unsure::shok:

 

 

* or at least better than other major browsers.

  • Author

yes, I got the entitis to work. Anyway new problem?!

 

I have put some entities and an attribute list into the dtd. I'm trying to use my entities as a text replacement in the attribute "price currency" in the dtd but it won't work. It's the currency section. Can anyone explain why the price comes up but not the currency sign? the page does preview in ie. Basically I want it to show a £ or a $ or a € infront of the price. is this right?

 

this is the xml

 

<header>

<title>CD Bay Incorporated Music Bidding</title>

</header>

 

<genre>Pop Music</genre>

 

<artist>

<firstname>Amy</firstname>

<surname>Winehouse</surname>

</artist>

 

<album>Back to Black</album>

 

<label>Island</label>

 

<price currency="&gbp;">7.98</price>

 

<delivery>&del;</delivery>

 

<seller>

<firstname>Ted</firstname>

<surname>Kord</surname>

</seller>

 

<phone>0191 200 3456</phone>

 

<mobile>07564 33333</mobile>

 

<description>Amy Winehouse's second album, Back to Black,

is one of the finest soul albums, British or otherwise,

to come out for years. Frank, her first album, was a sparse

and stripped-down affair; Back to Black, meanwhile, is neither

of these things. This time around, she's taken her inspiration

from some of the classic 1960's girl groups like the

Supremes and the Shangri-Las, a sound particularly suited to her

textured vocal delivery, while adding a contemporary songwriting

sensibility.</description>

 

and this is the dtd

 

<!ELEMENT musicbidding (header, genre, artist, album, label, price, delivery, seller, phone, mobile, description)>

<!ELEMENT musicbidding (#PCDATA)>

<!ELEMENT header (#PCDATA)>

<!ELEMENT genre (#PCDATA)>

<!ELEMENT artist (FIRSTNAME, SURNAME)>

<!ELEMENT album (#PCDATA)>

<!ELEMENT label (#PCDATA)>

<!ELEMENT price (#PCDATA)>

<!ELEMENT delivery (#PCDATA)>

<!ELEMENT seller (FIRSTNAME, SURNAME)>

<!ELEMENT phone (#PCDATA)>

<!ELEMENT mobile (#PCDATA)>

<!ELEMENT description (#PCDATA)>

<!ENTITY del "Free UK Delivery">

<!ENTITY gbp "£">

<!ENTITY usd "$">

<!ENTITY eur "€">

<!ATTLIST price currency (gbp|usd|eur) #REQUIRED>

Hi rachelt, try changing thse lines in your dtd:

<!ENTITY gbp "£">
<!ENTITY usd "$">
<!ENTITY eur "€">

 

to these lines:

<!ENTITY gbp "& # 163;">
<!ENTITY usd "& # 3 6;">
<!ENTITY eur "& # 8364;">

 

EDIT: won't let me post the correct code.

Obviously remove the spaces from the code.

  • Author

<!ENTITY gbp "£">

<!ENTITY usd "$">

<!ENTITY eur "€">

 

Right, I've added this and it still won't show the currency signs. but it's still previewing?

don't understand why not?

  • Author
<!ENTITY gbp "£">

<!ENTITY usd "$">

<!ENTITY eur "€">

 

Right, I've added this and it still won't show the currency signs. but it's still previewing?

don't understand why not?

 

EDIT:

 

once i've just posted this reply I've noticed the code has changed to the signs up above!

I had posted this

 

<!ENTITY gbp "& # 163;">

<!ENTITY usd "& # 3 6;">

<!ENTITY eur "& # 8364;">

 

but with out the spaces.

 

but why won't it work on my computer?

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.