Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old March 13th, 2006, 04:55 AM
MrFredBloggs@hotmail.com
Guest
 
Posts: n/a
Default XML Parser Won't Accept (#DATA) In DTD

Hi All,

I'm new to XML.

My DTD:

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE database [
<!ELEMENT database (table+)>
<!ELEMENT row (#CDATA)>
<!ELEMENT table (row+)>
<!ATTLIST database name CDATA #REQUIRED>
<!ATTLIST table name CDATA #REQUIRED>]>

isn't accepted by an XML parser, it complians about the line:
<!ELEMENT row (#CDATA)>
specifically about the #DATA part. If I change this to #PCDATA then all
is OK but I want the content between the <row></row> tags to be
unparsed.

How do I achieve this.

Thanks,

MrFred.

  #2  
Old March 13th, 2006, 05:15 AM
Joe Kesselman
Guest
 
Posts: n/a
Default Re: XML Parser Won't Accept (#DATA) In DTD

MrFredBloggs@hotmail.com wrote:[color=blue]
> I want the content between the <row></row> tags to be
> unparsed.[/color]

Element content is always #PCDATA, not #CDATA, per the XML
Recommendation's grammar.

To suppress parsing, you have to escape the data appropriately. If
you're using XML processing APIs to generate the document, they'll take
care of that for you; if not, you need to either escape a few of the
characters yourself or wrap it in a <!CDATA[[]]> section.

Also note that in XML 1.0, there are characters which are flat-out
illegal no matter how you try to escape them. If what you're trying to
express is a block of binary data, the usual solution is to encode it in
base 64 or some similar system and make converting it back to raw binary
the application's responsibility.


--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
  #3  
Old March 13th, 2006, 05:45 AM
MrFredBloggs@hotmail.com
Guest
 
Posts: n/a
Default Re: XML Parser Won't Accept (#DATA) In DTD


Joe Kesselman wrote:[color=blue]
> MrFredBloggs@hotmail.com wrote:[color=green]
> > I want the content between the <row></row> tags to be
> > unparsed.[/color]
>
> Element content is always #PCDATA, not #CDATA, per the XML
> Recommendation's grammar.
>
> To suppress parsing, you have to escape the data appropriately. If
> you're using XML processing APIs to generate the document, they'll take
> care of that for you; if not, you need to either escape a few of the
> characters yourself or wrap it in a <!CDATA[[]]> section.
>
> Also note that in XML 1.0, there are characters which are flat-out
> illegal no matter how you try to escape them. If what you're trying to
> express is a block of binary data, the usual solution is to encode it in
> base 64 or some similar system and make converting it back to raw binary
> the application's responsibility.
>
>
> --
> () ASCII Ribbon Campaign | Joe Kesselman
> /\ Stamp out HTML e-mail! | System architexture and kinetic poetry[/color]

Thanks for that, MrFred.

 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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