Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old December 15th, 2006, 07:25 AM
Aray
Guest
 
Posts: n/a
Default Special character problem in DTD

<!ENTITY % testEntity "(test)">
<!ELEMENT testElement %testEntity;>

Above is a valid DTD file. But it doesn't work when I try to put a charater
'/' in to the Content of testEntity. like following

<!ENTITY % testEntity "(test/test)">
<!ELEMENT testElement %testEntity;>

I am newbie to xml, Could you please tell me how to make it works?

Thanks

--



  #2  
Old December 15th, 2006, 07:45 AM
Bjoern Hoehrmann
Guest
 
Posts: n/a
Default Re: Special character problem in DTD

* Aray wrote in comp.text.xml:
Quote:
><!ENTITY % testEntity "(test)">
><!ELEMENT testElement %testEntity;>
>
>Above is a valid DTD file. But it doesn't work when I try to put a charater
>'/' in to the Content of testEntity. like following
>
><!ENTITY % testEntity "(test/test)">
><!ELEMENT testElement %testEntity;>
>
>I am newbie to xml, Could you please tell me how to make it works?
You should review why you want to put the '/' there, perhaps
you confuse it with some other character like ',' or '|'.
--
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
  #3  
Old December 15th, 2006, 10:35 AM
Richard Tobin
Guest
 
Posts: n/a
Default Re: Special character problem in DTD

In article <eltklr$250$1@news.cn99.com>, Aray <1@2.3wrote:
Quote:
>Above is a valid DTD file. But it doesn't work when I try to put a charater
>'/' in to the Content of testEntity. like following
>
><!ENTITY % testEntity "(test/test)">
><!ELEMENT testElement %testEntity;>
>
>I am newbie to xml, Could you please tell me how to make it works?
It's got nothing to do with entities. It doesn't work for the same
reason that

<!ELEMENT testElement (test/test)>

doesn't work. What are you trying to achieve?

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
  #4  
Old December 15th, 2006, 11:05 PM
Peter Flynn
Guest
 
Posts: n/a
Default Re: Special character problem in DTD

Aray wrote:
Quote:
<!ENTITY % testEntity "(test)">
<!ELEMENT testElement %testEntity;>
>
Above is a valid DTD file. But it doesn't work when I try to put a charater
'/' in to the Content of testEntity. like following
>
<!ENTITY % testEntity "(test/test)">
<!ELEMENT testElement %testEntity;>
>
I am newbie to xml, Could you please tell me how to make it works?
Can you please tell us what you want to do (why you think you want to do
this)?

///Peter
--
XML FAQ: http://xml.silmaril.ie/
  #5  
Old December 16th, 2006, 10:35 AM
Aray
Guest
 
Posts: n/a
Default Re: Special character problem in DTD



--

"Peter Flynn" <peter.nosp@m.silmaril.ieдÈëÏûÏ¢
news:4ugngpF180blmU1@mid.individual.net...
Quote:
Can you please tell us what you want to do (why you think you want to do
this)?
In HTML, we offten see the following line:

<form enctype="multipart/form-data" >

the attribute enctype can be "multipart/form-data",
"application/x-www-form-urlencoded" or "text/plain"

I want use XML to describe the FORM tag of HTML, and I want to make sure the
enctype have valid value, so a DTD file with following line is needed:

<!ENTITY % Enctype
"(application/x-www-form-urlencoded|multipart/form-data|text/plain)">

<!ELEMENT form
(button|checkBoxGroup|file|hidden|image|password|r adioGroup|reset|submit|text|select|textArea)*>
<!ATTLIST form name CDATA #IMPLIED
action CDATA #REQUIRED
method (get|post) #REQUIRED
enctype %Enctype; #IMPLIED>

Then, I got the probelm, I can't put the character '/' in there.

Thank you all to reply. :)


  #6  
Old December 16th, 2006, 05:55 PM
Peter Flynn
Guest
 
Posts: n/a
Default Re: Special character problem in DTD

Aray wrote:
Quote:
In HTML, we offten see the following line:
>
<form enctype="multipart/form-data" >
>
the attribute enctype can be "multipart/form-data",
"application/x-www-form-urlencoded" or "text/plain"
>
I want use XML to describe the FORM tag of HTML, and I want to make sure the
enctype have valid value, so a DTD file with following line is needed:
>
<!ENTITY % Enctype
"(application/x-www-form-urlencoded|multipart/form-data|text/plain)">
Ah, OK. Sorry for the misunderstanding: I thought you were trying to
represent elements in a content model.

Unfortunately you can't do that in XML: the values in Token Lists must
be Names (see the XML Specification, production [5]). Name characters
do not include the slash.
Quote:
Then, I got the probelm, I can't put the character '/' in there.
Correct. You can work around this using a Notation:

<!NOTATION mime SYSTEM "http://www.iana.org/assignments/media-types/">
<!ENTITY urlenc SYSTEM "application/x-www-form-urlencoded" NDATA mime>
<!ENTITY formdata SYSTEM "multipart/form-data" NDATA mime>
<!ENTITY plain SYSTEM "text/plain" NDATA mime>

<!ELEMENT form (#PCDATA)>
<!ATTLIST form name CDATA #IMPLIED
action CDATA #REQUIRED
method (get|post) #REQUIRED
enctype ENTITY #IMPLIED>

This makes the valid values for enctype one of urlenc, formdata, and
plain (or whatever you choose to declare them as). An XSLT processor can
then use the XPath function unparsed-entity-uri() to return the string
value of the declared entities.

///Peter
--
XML FAQ: http://xml.silmaril.ie/
  #7  
Old December 18th, 2006, 10:15 AM
Aray
Guest
 
Posts: n/a
Default Re: Special character problem in DTD



--

"Peter Flynn" <peter.nosp@m.silmaril.ieдÈëÏûÏ¢
news:4uiq22F17vjv0U1@mid.individual.net...
Quote:
Aray wrote:
Quote:
><!ENTITY % Enctype
>"(application/x-www-form-urlencoded|multipart/form-data|text/plain)">
>
Ah, OK. Sorry for the misunderstanding: I thought you were trying to
represent elements in a content model.
>
Unfortunately you can't do that in XML: the values in Token Lists must
be Names (see the XML Specification, production [5]). Name characters
do not include the slash.
>
Quote:
>Then, I got the probelm, I can't put the character '/' in there.
>
Correct. You can work around this using a Notation:
>
<!NOTATION mime SYSTEM "http://www.iana.org/assignments/media-types/">
<!ENTITY urlenc SYSTEM "application/x-www-form-urlencoded" NDATA mime>
<!ENTITY formdata SYSTEM "multipart/form-data" NDATA mime>
<!ENTITY plain SYSTEM "text/plain" NDATA mime>
>
<!ELEMENT form (#PCDATA)>
<!ATTLIST form name CDATA #IMPLIED
action CDATA #REQUIRED
method (get|post) #REQUIRED
enctype ENTITY #IMPLIED>
>
This makes the valid values for enctype one of urlenc, formdata, and plain
(or whatever you choose to declare them as). An XSLT processor can then
use the XPath function unparsed-entity-uri() to return the string value of
the declared entities.
>
Thanks for your replay.

What I want is this: someone can write a xml file with this line: <form
name="" action="" method="get" enctype="text/plain">
the atribute enctype's value can only be one of the three:
"application/x-www-form-urlencoded", "multipart/form-data" and "text/plain".

But in solution above, enctype's value can be ony ENTITY defined in my DTD
file(I do define some other ENTITY in the DTD file). how to restrict the
value of enctype can ony be one of the three?

Thanks
Quote:
///Peter
--
XML FAQ: http://xml.silmaril.ie/

  #8  
Old December 18th, 2006, 11:25 AM
Manuel Collado
Guest
 
Posts: n/a
Default Re: Special character problem in DTD

Aray escribió:
Quote:
Thanks for your replay.
>
What I want is this: someone can write a xml file with this line: <form
name="" action="" method="get" enctype="text/plain">
the atribute enctype's value can only be one of the three:
"application/x-www-form-urlencoded", "multipart/form-data" and "text/plain".
>
But in solution above, enctype's value can be ony ENTITY defined in my DTD
file(I do define some other ENTITY in the DTD file). how to restrict the
value of enctype can ony be one of the three?
Perhaps Schematron could help.

Regards.
--
To reply by e-mail, please remove the extra dot
in the given address: m.collado -mcollado

  #9  
Old December 18th, 2006, 11:05 PM
Peter Flynn
Guest
 
Posts: n/a
Default Re: Special character problem in DTD

Aray wrote:
[...]
Quote:
Thanks for your reply.
>
What I want is this: someone can write an xml file with this line:
<form name="" action="" method="get" enctype="text/plain">
the attribute enctype's value can only be one of the three:
"application/x-www-form-urlencoded", "multipart/form-data" and "text/plain".
No. I've already explained that you can't do this in XML. Read the XML
Specification, production [5], as recommended. The slash is not
permitted in token lists.
Quote:
But in solution above, enctype's value can be only ENTITY defined in
my DTD file (I do define some other ENTITY in the DTD file). how to
restrict the value of enctype can ony be one of the three?
Only the names of unparsed (data) declared entities (identified by a
Notation) can be used as the value of a token list attribute, so unless
you are declaring other unparsed entities, the value can only be one of
those you declare. General entities cannot be used (see the Validity
Constraint "Entity Name" to production [56] in the XML Specification).

///Peter
--
XML FAQ: http://xml.silmaril.ie/
  #10  
Old December 19th, 2006, 08:35 AM
Aray
Guest
 
Posts: n/a
Default Re: Special character problem in DTD

Thanks for your help.

I took Manuel Collado <m.collado@lml.ls.fi.upm.es's advise. using schema
to validate the xml

--

"Peter Flynn" <peter.nosp@m.silmaril.ieдÈëÏûÏ¢
news:4uol18F18c5opU1@mid.individual.net...


  #11  
Old December 19th, 2006, 08:35 AM
Aray
Guest
 
Posts: n/a
Default Re: Special character problem in DTD


--

"Manuel Collado" <m.collado@lml.ls.fi.upm.es????
news:458678de@news.upm.es...
Quote:
Perhaps Schematron could help.
Thanks, I study around Schema for few hours, It does work!

Thank you


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles