Fragment parsing

Discussion in 'XML' started by Philippe Poulard, Jun 27, 2005.

  1. hi,

    i have the following fragment :
    ******
    <?xml version="1.0">
    Begin
    <elem/>
    End

    ******
    i intend to insert it within this document :
    ******
    <?xml version="1.0">
    <!DOCTYPE root [
    <!ENTITY in SYSTEM "fragment.xml">
    ]>
    <root>
    Hello world !!!&in;
    </root>

    ******
    the result is (after serialization) :
    ******
    <?xml version="1.0">
    <root>
    Hello world !!!
    Begin
    <elem/>
    End

    </root>
    ******
    while i was expecting :
    ******
    <?xml version="1.0">
    <root>
    Hello world !!!Begin
    <elem/>
    End

    </root>
    ******
    i thought that the text declaration should behave like the xml
    declaration, that is to say that "<?xml ...?>CR" was entirely discarded
    (including the CR) before replacement

    do i have to remove the first CR at hand ?

    do i have to correct my fragment :
    ******
    <?xml version="1.0"?>Begin
    <elem/>
    End

    ****** ?

    did i miss something ???

    --
    Cordialement,

    ///
    (. .)
    -----ooO--(_)--Ooo-----
    | Philippe Poulard |
    -----------------------
     
    Philippe Poulard, Jun 27, 2005
    #1
    1. Advertising

  2. In article <d9p4ig$4i7$>,
    Philippe Poulard <> wrote:
    >i thought that the text declaration should behave like the xml
    >declaration, that is to say that "<?xml ...?>CR" was entirely discarded
    >(including the CR) before replacement


    No, the line break after the text declaration is not part of the
    declaration so it is part of the replacement text of the entity.

    The same is true of the XML declaration; the only reason you don't
    see the line break after that is that it's outside the document
    element.

    >do i have to remove the first CR at hand ?


    Yes.

    >do i have to correct my fragment :
    >******
    ><?xml version="1.0"?>Begin
    ><elem/>
    >End
    >
    >****** ?


    The text declaration must contain an encoding declaration. And you
    don't have to have a text declaration at all unless you want to
    specify an encoding or a version > 1.0.

    -- Richard
     
    Richard Tobin, Jun 27, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stefan Oedenkoven
    Replies:
    1
    Views:
    528
    zinga
    Jan 4, 2005
  2. quique

    fragment cache

    quique, Oct 29, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    347
    quique
    Oct 29, 2003
  3. quique

    fragment page caching

    quique, Oct 30, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    364
    quique
    Oct 30, 2003
  4. Troy Simpson

    Fragment Caching inside page caching?

    Troy Simpson, Jan 19, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    806
    Troy Simpson
    Jan 19, 2004
  5. Replies:
    14
    Views:
    204
    David Golightly
    Sep 22, 2007
Loading...

Share This Page