XML Revision

Hi. Just doing some exam revision and have come stuck on a couple of questions. First one is

Demonstrate two different solutions for dealing with text that has been entered into an XML document (within the <section> tags):

<section>This will show details of XML <tags>. </section>

I am not sure what the answer would be for this. I was thinking about moving the <tags> and replacing it with normal text. Not to sure what they want though.

The second question is Declare the followin XML DTD attributes
An element price has an optional attribute value with the values of “pounds” or “Euros”.
Defining the attribute, I would do
<!ATTLIST price value CDATA IMPLIED>
Not sure if I can add the values straight into this, or underneath I would have to do
<!ENTITY value “Pounds” | “Euros” >

Any advise appreciated.

cheers

for you first question I’m not sure either, but I think they are asking how to display special characters so your XML is well-formed.

You can try escape each special character with its entity ref

<section>This will show details of XML <tags>. </section>

or escape all the text with a special strings. start with “![CDATA[” and end with “]]>” e.g.

<section><![CDATA[This will show details of XML <tags>. ]]></section>

I think you can put it straight in. e.g.

<!ATTLIST price value (Pounds|Euros) #IMPLIED>

I suggest getting an editor… it is not worth remember DTD syntax.

kool. Got a new question. Why do XML and XHTML well formed rules differ? My thinking is that XML is a meta markup language, a base language for other languages to be built from. This has a given set of rules which must be obeyed. Then XHTML is a sublanguage, something built through DTD XML. Therefore although the follow the set rules of xml, they can also define their own rules. This is why XHTML has 3 DTD types, strict, transitional and frameset. They are all a different version of HTML with XML DTD applied to it, and all have different rules.

I think I am on the right track, not sure.