You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Stefan Berglund <st...@telia.se> on 2001/06/26 15:41:27 UTC

DOMPrint with chCR/chLF

Hello,

I'm having problems with my app, I've borrowed the functionality of the
DOMPrint example to get my parsed XML to a string,
and when it "writes out" the XML_DECL_NODE, it uses the constant:

static const XMLCh  gXMLDecl4[] =
{
  chDoubleQuote, chQuestion, chCloseAngle
    ,   chCR, chLF, chNull
};

Couldn't this be a problem in Unix ? CR/LF can cause a ^M character in some
cases? Is the XML standard saying that there should be a new line
after the declaration section, or could the gXMLDecl4 constant end with
chNull directly after the chCloseAngle?

Hmm now when checking, I see ENTITY_NODE also has chCR, chLF written out, is
this a must?
I'd rather put it all on the same line if it's ok with standards etc??

/Stefan



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: DOMPrint with chCR/chLF

Posted by Hal DeVore <ha...@acm.org>.
>>>>> On Thu, 28 Jun 2001, "Kent" == Kent Dahl wrote:

  Kent> I don't remember the reference, anyone care to confirm or
  Kent> unconfirm?

The following is from: http://www.w3.org/TR/REC-xml

2.11 End-of-Line Handling

       XML parsed entities are often stored in computer files
       which, for editing convenience, are organized into
       lines. These lines are typically separated by some
       combination of the characters carriage-return (#xD) and
       line-feed (#xA).

       To simplify the tasks of applications, the characters
       passed to an application by the XML processor must be
       as if the XML processor normalized all line breaks
       in external parsed entities (including the document
       entity) on input, before parsing, by translating both the
       two-character sequence #xD #xA and any #xD that is not
       followed by #xA to a single #xA character.


...

3.3.3 Attribute-Value Normalization

       Before the value of an attribute is passed to the
       application or checked for validity, the XML processor
       must normalize the attribute value by applying the
       algorithm below, or by using some other method such that
       the value passed to the application is the same as that
       produced by the algorithm.

        1.All line breaks must have been normalized on input to
        #xA as described in 2.11 End-of-Line Handling, so the
        rest of this algorithm operates on text normalized in
        this way.

[[ more details elided ]]

--Hal



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: DOMPrint with chCR/chLF

Posted by Kent Dahl <ke...@trustix.com>.
Stefan Berglund wrote:
> static const XMLCh  gXMLDecl4[] =
> {
>   chDoubleQuote, chQuestion, chCloseAngle
>     ,   chCR, chLF, chNull
> };
> 
> Couldn't this be a problem in Unix ? CR/LF can cause a ^M character in some
> cases? Is the XML standard saying that there should be a new line
> after the declaration section, or could the gXMLDecl4 constant end with
> chNull directly after the chCloseAngle?

I seem to recall something about only one of these (CR or LF) being
permitted in XML, and that a combination of CR/LF must be converted to
the legal one by the parser, meaning you can have CR/LF in the valid XML
file(which in turn makes it editable even in Windows Notepad), but you
can't have it in the XML data...

I don't remember the reference, anyone care to confirm or unconfirm? 

-- 
<[ Kent Dahl ]>================<[ http://www.stud.ntnu.no/~kentda/ ]>
  )____(stud.techn.;ind.øk.data)||(softwareDeveloper.at(Trustix))_(
 /"Opinions expressed are mine and not those of my Employer,      "\
( "the University, my girlfriend, stray cats, banana fruitflies,  " )
 \"nor the frontal lobe of my left cerebral hemisphere.           "/

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org