How do I remove a line from incoming XML FILE

Discussion in 'ASP General' started by Girish, Feb 17, 2004.

  1. Girish

    Girish Guest

    I have this XML FILE where I am reading data from and it has this node
    doctype "< ! D O C T Y P E a d f S Y S T E M " h t t p : / / w h o s c
    a l l i n g . c o m / d t d / a d f d t d . d t d " > "

    ONLY When I remove this line I could display the data onto the browser, any
    ideas WHY? if not I am using following code to remove the above line, it
    doesn't work

    Dim FindWhat, ReplaceWith

    'dim MyString
    'MyString= "Hello" & chr(34) & "World" & chr(34) & "World"

    FindWhat = "< ! D O C T Y P E &nbsp;&nbsp;a d f &nbsp; S Y S T E M &nbsp;
    " & chr(34) & " h t t p : / / w h o s c a l l i n g . c o m / d t d / a d f
    d t d . d t d " & chr(34) & "&nbsp;>"
    'FindWhat = FindWhat & " h t t p : / / w h o s c a l l i n g . c o m / d t
    d / a d f d t d . d t d "
    'FindWhat = FindWhat & ">"

    response.write "FindWhat :" & FindWhat & "<br>"

    ReplaceWith = ""

    Dim fso, sText, fs, DestinationFile, writingFile, sPath
    set fso = createobject("scripting.filesystemobject")
    sPath = "D:\inetpub\PennyFlyer\carmartnew\business_ivr.xml"

    if fso.FileExists(sPath) then

    Set fs = fso_OpenTextFile(sPath)
    sText = fs.ReadAll()

    'response.write "sText" & sText

    sText = Replace(sText, FindWhat, ReplaceWith)

    DestinationFile = "D:\inetpub\PennyFlyer\carmartnew\newbusiness_ivr.xml"

    Set writingFile = fso.CreateTextFile(DestinationFile,true,false)

    WritingFile.Write(sText)

    WritingFile.Close
    end if

    Thanks
     
    Girish, Feb 17, 2004
    #1
    1. Advertising

  2. Girish

    Mark Schupp Guest

    What error message do you get in the browser?

    --
    Mark Schupp
    Head of Development
    Integrity eLearning
    www.ielearning.com


    "Girish" <> wrote in message
    news:...
    > I have this XML FILE where I am reading data from and it has this node
    > doctype "< ! D O C T Y P E a d f S Y S T E M " h t t p : / / w h o s

    c
    > a l l i n g . c o m / d t d / a d f d t d . d t d " > "
    >
    > ONLY When I remove this line I could display the data onto the browser,

    any
    > ideas WHY? if not I am using following code to remove the above line, it
    > doesn't work
    >
    > Dim FindWhat, ReplaceWith
    >
    > 'dim MyString
    > 'MyString= "Hello" & chr(34) & "World" & chr(34) & "World"
    >
    > FindWhat = "< ! D O C T Y P E &nbsp;&nbsp;a d f &nbsp; S Y S T E M

    &nbsp;
    > " & chr(34) & " h t t p : / / w h o s c a l l i n g . c o m / d t d / a d

    f
    > d t d . d t d " & chr(34) & "&nbsp;>"
    > 'FindWhat = FindWhat & " h t t p : / / w h o s c a l l i n g . c o m / d

    t
    > d / a d f d t d . d t d "
    > 'FindWhat = FindWhat & ">"
    >
    > response.write "FindWhat :" & FindWhat & "<br>"
    >
    > ReplaceWith = ""
    >
    > Dim fso, sText, fs, DestinationFile, writingFile, sPath
    > set fso = createobject("scripting.filesystemobject")
    > sPath = "D:\inetpub\PennyFlyer\carmartnew\business_ivr.xml"
    >
    > if fso.FileExists(sPath) then
    >
    > Set fs = fso_OpenTextFile(sPath)
    > sText = fs.ReadAll()
    >
    > 'response.write "sText" & sText
    >
    > sText = Replace(sText, FindWhat, ReplaceWith)
    >
    > DestinationFile = "D:\inetpub\PennyFlyer\carmartnew\newbusiness_ivr.xml"
    >
    > Set writingFile = fso.CreateTextFile(DestinationFile,true,false)
    >
    > WritingFile.Write(sText)
    >
    > WritingFile.Close
    > end if
    >
    > Thanks
    >
    >
     
    Mark Schupp, Feb 17, 2004
    #2
    1. Advertising

  3. Girish

    Mark Schupp Guest

    Your attachment opens and displays just fine in IE on my system.

    If you are just having problems reading it in and re-writing it why don't
    you open it and re-save it with the MSXML component instead of the file
    system object?

    --
    Mark Schupp
    Head of Development
    Integrity eLearning
    www.ielearning.com


    "Girish" <> wrote in message
    news:%...
    > well, it creates a file called newbusiness_ivr.xml and the file should
    > contain everything and the node doctype replaced by "" right? It doesn't

    it
    > just has the following partial data:
    >

    ============================================================================
    > ==========
    > ÿþ<
    >
    >
    > < e m a i l > t j a v a @ w h o s c a l l i n g . c o m < / e m a

    i
    > l >
    >
    > < p h o n e > 8 6 6 3 1 2 2 2 2 2 < / p h o n e >
    >
    > < / c o n t a c t >
    >
    > < / p r o v i d e r >
    >
    > < / p r o s p e c t >
    >
    > < / a d f >
    >

    ============================================================================
    > ==========
    > I am also attaching business_ivr.xml file which is parsed and contains the
    > above node.
    >
    > Thanks
    >
    > "Mark Schupp" <> wrote in message
    > news:%...
    > > What error message do you get in the browser?
    > >
    > > --
    > > Mark Schupp
    > > Head of Development
    > > Integrity eLearning
    > > www.ielearning.com
    > >
    > >
    > > "Girish" <> wrote in message
    > > news:...
    > > > I have this XML FILE where I am reading data from and it has this node
    > > > doctype "< ! D O C T Y P E a d f S Y S T E M " h t t p : / / w h

    o
    > s
    > > c
    > > > a l l i n g . c o m / d t d / a d f d t d . d t d " > "
    > > >
    > > > ONLY When I remove this line I could display the data onto the

    browser,
    > > any
    > > > ideas WHY? if not I am using following code to remove the above line,

    it
    > > > doesn't work
    > > >
    > > > Dim FindWhat, ReplaceWith
    > > >
    > > > 'dim MyString
    > > > 'MyString= "Hello" & chr(34) & "World" & chr(34) & "World"
    > > >
    > > > FindWhat = "< ! D O C T Y P E &nbsp;&nbsp;a d f &nbsp; S Y S T E M

    > > &nbsp;
    > > > " & chr(34) & " h t t p : / / w h o s c a l l i n g . c o m / d t d /

    a
    > d
    > > f
    > > > d t d . d t d " & chr(34) & "&nbsp;>"
    > > > 'FindWhat = FindWhat & " h t t p : / / w h o s c a l l i n g . c o m

    /
    > d
    > > t
    > > > d / a d f d t d . d t d "
    > > > 'FindWhat = FindWhat & ">"
    > > >
    > > > response.write "FindWhat :" & FindWhat & "<br>"
    > > >
    > > > ReplaceWith = ""
    > > >
    > > > Dim fso, sText, fs, DestinationFile, writingFile, sPath
    > > > set fso = createobject("scripting.filesystemobject")
    > > > sPath = "D:\inetpub\PennyFlyer\carmartnew\business_ivr.xml"
    > > >
    > > > if fso.FileExists(sPath) then
    > > >
    > > > Set fs = fso_OpenTextFile(sPath)
    > > > sText = fs.ReadAll()
    > > >
    > > > 'response.write "sText" & sText
    > > >
    > > > sText = Replace(sText, FindWhat, ReplaceWith)
    > > >
    > > > DestinationFile =

    > "D:\inetpub\PennyFlyer\carmartnew\newbusiness_ivr.xml"
    > > >
    > > > Set writingFile = fso.CreateTextFile(DestinationFile,true,false)
    > > >
    > > > WritingFile.Write(sText)
    > > >
    > > > WritingFile.Close
    > > > end if
    > > >
    > > > Thanks
    > > >
    > > >

    > >
    > >

    >
    >
    >
     
    Mark Schupp, Feb 18, 2004
    #3
  4. Girish

    Girish Guest

    u mean that node is not giving problem, r u reading its data via ASP and
    displaying it? if yes, please send me some sample and / or URL on MSXML
    component please...

    Thanks much!
    "Mark Schupp" <> wrote in message
    news:...
    > Your attachment opens and displays just fine in IE on my system.
    >
    > If you are just having problems reading it in and re-writing it why don't
    > you open it and re-save it with the MSXML component instead of the file
    > system object?
    >
    > --
    > Mark Schupp
    > Head of Development
    > Integrity eLearning
    > www.ielearning.com
    >
    >
    > "Girish" <> wrote in message
    > news:%...
    > > well, it creates a file called newbusiness_ivr.xml and the file should
    > > contain everything and the node doctype replaced by "" right? It

    doesn't
    > it
    > > just has the following partial data:
    > >

    >

    ============================================================================
    > > ==========
    > > ÿþ<
    > >
    > >
    > > < e m a i l > t j a v a @ w h o s c a l l i n g . c o m < / e m

    a
    > i
    > > l >
    > >
    > > < p h o n e > 8 6 6 3 1 2 2 2 2 2 < / p h o n e >
    > >
    > > < / c o n t a c t >
    > >
    > > < / p r o v i d e r >
    > >
    > > < / p r o s p e c t >
    > >
    > > < / a d f >
    > >

    >

    ============================================================================
    > > ==========
    > > I am also attaching business_ivr.xml file which is parsed and contains

    the
    > > above node.
    > >
    > > Thanks
    > >
    > > "Mark Schupp" <> wrote in message
    > > news:%...
    > > > What error message do you get in the browser?
    > > >
    > > > --
    > > > Mark Schupp
    > > > Head of Development
    > > > Integrity eLearning
    > > > www.ielearning.com
    > > >
    > > >
    > > > "Girish" <> wrote in message
    > > > news:...
    > > > > I have this XML FILE where I am reading data from and it has this

    node
    > > > > doctype "< ! D O C T Y P E a d f S Y S T E M " h t t p : / / w

    h
    > o
    > > s
    > > > c
    > > > > a l l i n g . c o m / d t d / a d f d t d . d t d " > "
    > > > >
    > > > > ONLY When I remove this line I could display the data onto the

    > browser,
    > > > any
    > > > > ideas WHY? if not I am using following code to remove the above

    line,
    > it
    > > > > doesn't work
    > > > >
    > > > > Dim FindWhat, ReplaceWith
    > > > >
    > > > > 'dim MyString
    > > > > 'MyString= "Hello" & chr(34) & "World" & chr(34) & "World"
    > > > >
    > > > > FindWhat = "< ! D O C T Y P E &nbsp;&nbsp;a d f &nbsp; S Y S T E M
    > > > &nbsp;
    > > > > " & chr(34) & " h t t p : / / w h o s c a l l i n g . c o m / d t d

    /
    > a
    > > d
    > > > f
    > > > > d t d . d t d " & chr(34) & "&nbsp;>"
    > > > > 'FindWhat = FindWhat & " h t t p : / / w h o s c a l l i n g . c o

    m
    > /
    > > d
    > > > t
    > > > > d / a d f d t d . d t d "
    > > > > 'FindWhat = FindWhat & ">"
    > > > >
    > > > > response.write "FindWhat :" & FindWhat & "<br>"
    > > > >
    > > > > ReplaceWith = ""
    > > > >
    > > > > Dim fso, sText, fs, DestinationFile, writingFile, sPath
    > > > > set fso = createobject("scripting.filesystemobject")
    > > > > sPath = "D:\inetpub\PennyFlyer\carmartnew\business_ivr.xml"
    > > > >
    > > > > if fso.FileExists(sPath) then
    > > > >
    > > > > Set fs = fso_OpenTextFile(sPath)
    > > > > sText = fs.ReadAll()
    > > > >
    > > > > 'response.write "sText" & sText
    > > > >
    > > > > sText = Replace(sText, FindWhat, ReplaceWith)
    > > > >
    > > > > DestinationFile =

    > > "D:\inetpub\PennyFlyer\carmartnew\newbusiness_ivr.xml"
    > > > >
    > > > > Set writingFile = fso.CreateTextFile(DestinationFile,true,false)
    > > > >
    > > > > WritingFile.Write(sText)
    > > > >
    > > > > WritingFile.Close
    > > > > end if
    > > > >
    > > > > Thanks
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >
    > >

    >
    >
     
    Girish, Feb 18, 2004
    #4
    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. Alan Connor
    Replies:
    0
    Views:
    3,046
    Alan Connor
    May 7, 2005
  2. kaushikshome
    Replies:
    4
    Views:
    776
    kaushikshome
    Sep 10, 2006
  3. scad
    Replies:
    23
    Views:
    1,176
    Alf P. Steinbach
    May 17, 2009
  4. Stefan Behnel
    Replies:
    1
    Views:
    1,006
    David Vicente
    Feb 9, 2011
  5. Anthony Papillion
    Replies:
    0
    Views:
    124
    Anthony Papillion
    Sep 2, 2013
Loading...

Share This Page