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. Advertisements

  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. Advertisements

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:
    737
    zinga
    Jan 4, 2005
  2. quique

    fragment cache

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

    fragment page caching

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

    Fragment Caching inside page caching?

    Troy Simpson, Jan 19, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    997
    Troy Simpson
    Jan 19, 2004
  5. =?Utf-8?B?Sm9l?=

    fragment caching problem

    =?Utf-8?B?Sm9l?=, May 26, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    430
    Mr. Dot Net
    Jul 15, 2004
  6. Axel Dahmen

    Can't create fragment/JavaScript hyperlink

    Axel Dahmen, Feb 4, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    570
    Yunus Emre ALPĂ–ZEN
    Feb 4, 2005
  7. DC
    Replies:
    3
    Views:
    1,007
    Juan T. Llibre
    Oct 18, 2005
  8. Replies:
    14
    Views:
    368
    David Golightly
    Sep 22, 2007
Loading...