Re: Q: Using XML entities for href's - More questions about entities

Wilf Reedijk (wilfr@mail.bc.rogers.wave.ca)
Tue, 03 Mar 1998 11:56:08 -0800


--------------3475517975E1354E3E49F28A
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

When I try to reference an entity within an attribute value, the parser (I am
using msxml) complains.
The message that I am getting is 'Invalid element in context of 'APP'. Expected
[ADDURL,EDITURL] in line 3 and column 18. This message makes no sense to me.

Here is my XML:

<?XML version="1.0"?>
<!DOCTYPE TREE [
<!ENTITY TEST "myapp">
<!ELEMENT TREE (CATEGORY)*>
<!ELEMENT CATEGORY (ADDURL?,EDITURL?,(CATEGORY|APP)*)>
<!ATTLIST CATEGORY
name CDATA #REQUIRED>
<!ELEMENT APP (ADDURL?,EDITURL?)>
<!ATTLIST APP
name CDATA #REQUIRED
thing CDATA #IMPLIED>
<!ELEMENT ADDURL (#PCDATA)*>
<!ELEMENT EDITURL (#PCDATA)*>
]>
<TREE>
<CATEGORY name="mycategory">

<APP name="&TEST;">
<ADDURL> someurl </ADDURL>
<EDITURL> anotherurl </EDITURL>
</APP>
</CATEGORY>
</TREE>

How do we use entities within attributes?

I find the whole concept of entities to be a bit confusing (internal vs.
external; general vs. parameter; parsed vs. unparsed etc.). Is there a site where
one could find some good examples describing how the various types of entities
are used?

Eve L. Maler wrote:

> It's legal to reference a parsed entity from an attribute value, and every
> XML processor should be able to handle it. To do this properly, the
> reference would have to look like this:
>
> <aTag xml-link="simple" href="&aRef;">content</aTag>
>
> (Using an ENTITY-type attribute wouldn't automatically expand it in place,
> and anyway, has to be used exclusively with unparsed entities -- those with
> an NDATA notation.)
>
> Eve
>

--------------3475517975E1354E3E49F28A
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

When I try to reference an entity within an attribute value, the parser (I am using msxml) complains.
The message that I am getting is 'Invalid element in context of  'APP'. Expected [ADDURL,EDITURL] in line 3 and column 18. This message makes no sense to me.

Here is my XML:
 

<?XML version="1.0"?>
<!DOCTYPE TREE [
<!ENTITY TEST "myapp">
<!ELEMENT TREE (CATEGORY)*>
<!ELEMENT CATEGORY (ADDURL?,EDITURL?,(CATEGORY|APP)*)>
 <!ATTLIST CATEGORY
  name CDATA #REQUIRED>
<!ELEMENT APP (ADDURL?,EDITURL?)>
 <!ATTLIST APP
  name CDATA #REQUIRED
  thing CDATA #IMPLIED>
<!ELEMENT ADDURL (#PCDATA)*>
<!ELEMENT EDITURL (#PCDATA)*>
]>
<TREE>
 <CATEGORY name="mycategory">
 
  <APP name="&TEST;">
   <ADDURL>  someurl </ADDURL>
   <EDITURL> anotherurl </EDITURL>
  </APP>
 </CATEGORY>
</TREE>
 

How do we use entities within attributes?

I find the whole concept of entities to be a bit confusing (internal vs. external; general vs. parameter; parsed vs. unparsed etc.). Is there a site where one could find some good examples describing how the various types of entities are used?
 

Eve L. Maler wrote:

It's legal to reference a parsed entity from an attribute value, and every
XML processor should be able to handle it.  To do this properly, the
reference would have to look like this:

<aTag xml-link="simple" href="&aRef;">content</aTag>

(Using an ENTITY-type attribute wouldn't automatically expand it in place,
and anyway, has to be used exclusively with unparsed entities -- those with
an NDATA notation.)

        Eve
 

  --------------3475517975E1354E3E49F28A-- xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ To (un)subscribe, mailto:majordomo@ic.ac.uk the following message; (un)subscribe xml-dev To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message; subscribe xml-dev-digest List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)