Hi Tom,

Refering to my previous email, you are in situation 2 ;-). However, I wonder
why IE is telling you that you are in case 1. This is confusing but should
be ignored. Thus, you'll have to opt for one of the solutions I told you :
attributes, empty elements or schemas. I recommend using a "code" attribute
on your transaction element.

bye,
David


> David,
> thanks for the response.
>
> Here is a code snippet and the accompanying error messages from Xerces
> and Internet Explorer.
>
> I believe you may be correct...I am trying to impose restrictions on
> character
> data...ensuring it is either a BUY or SELL code.
>
> ====================================my program======================
> <?xml version='1.0' encoding='UTF-8'?>
> <!DOCTYPE DOCUMENT [
> <!ELEMENT transaction_file (transaction)* >
> <!ELEMENT transaction (code)>
> <!ENTITY % validCodeEnum "BOUGHT|SOLD">
> <!ELEMENT code (%validCodeEnum;)>
> ]>
>
> <!--notice second record has code=LEASE-->
>
> <transaction_file>
>   <transaction>
> <code>BOUGHT</code>
>   </transaction>
>   <transaction>
> <code>LEASE</code>
>   </transaction>
> </transaction_file>
> ====================================Xerces error======================
> C:\xerces\java sax.SAXCount -v d:\Temp\petest.xml
> [Fatal Error] petest.xml:6:17: A '<' character or an element type is
> required in the
> declaration of element type "code"
> org.xml.sax.SAXException: Stopping after fatal error.....
>
> ====================================from IE======================
> The XML page cannot be displayed Cannot view XML input using style sheet.
> Please correct the error and then click the Refresh button, or try again
> later.   Parameter entities cannot be used inside markup declarations in
an
> internal subset. Line 6, Position 16  <!ELEMENT code (%validCodeEnum;)>
> ---------------^
>
> Tom
>
> > ----------
> > From: David Bourget[SMTP:[EMAIL PROTECTED]
> > Sent: Wednesday, April 19, 2000 12:15 PM
> > To: [EMAIL PROTECTED]
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: Resend - can ELEMENTS reference ENTITIES?
> >
> > Hi Tom,
> >
> > > I am having some trouble with enumeration in XML.
> > >
> > > Rather than doing this,
> > >
> > > <!ELEMENT TxnCode (BUY|SELL|DEP|INT)>
> > >
> > > I need to do the following, but it seems to be invalid,
> > >
> > > <!ENTITY % validCode "BUY|SELL|DEP|INT">
> > >
> > > <!ELEMENT TxnCode (%validCode;)>
> >
> > I see two possible issues here
> >
> > 1- If Xerces-* does not allow you to use a PE in that context, then this
> > is
> > a bug.
> >
> > 2- If Xerces-* tell you that you are doing something wrong but that this
> > entity reference is well placed that's because you can't define
> > restrictions
> > on the character data of an element in a DTD. The construction you are
> > using
> > defines the content model of your element, but it seems that you have
not
> > defined those children elements. I strongly suggest that you use an
> > attribute as they are really meant to fill the purpose *I think* you are
> > describing here. However, there is a way to achieve the same result in
> > using
> > elements :
> >
> > <!ELEMENT BUY EMPTY>
> > <!ELEMENT SELL EMPTY>
> > <!ELEMENT DEP EMPTY>
> > <!ELEMENT INT EMPTY>
> >
> > <!ELEMENT TxnCode (BUY|SELL|DEP|INT)>
> >
> > Using it will result in :
> > <TxnCode>
> >     <BUY/>
> > </TxnCode>
> >
> > An other solution would be to use schemas.
> >
> > I hope this help,
> > David
> >
> >
> >

Reply via email to