Parse html tag withing xml files with asp

Discussion in 'C#' started by elric, Aug 5, 2008.

  1. #1
    Hi,

    I'am working on a w2003 server with iis6 and mysql 5.

    I'am parsing xml files (newsml) in order to store their content in my database and show them in my website.

    For example I 've in this xml file

    ...
    <datacontent>
    <head>
    <title>Test</title>
    </head>
    <body>
    <p>John Smith <br/>San Francisco<br/><b>USA</b></p>
    ...
    </body>
    </datacontent>
    ...
    Code (markup):

    My code :

    data=""
    Set objXML = Server.CreateObject("Microsoft.XMLDOM")
    objXML.Async = False
    objXML.SetProperty "ServerHTTPRequest", True
    objXML.ResolveExternals = True
    objXML.ValidateOnParse = True
    objXML.Load("C:/Inetpub/ftproot/test.xml")
    Set objRoot = objXML.documentElement
    If IsObject(objRoot) = False Then
    response.Write "<h2>No Root Found </h2>"
    End If
     
    n=0
     
    Set NodeList = objXML.getElementsByTagName("p")
     
    For Each Node In NodeList
    data=data&node.text
    next
    Code (markup):

    My problem is that I get in data this value

    John Smith San Francisco USA
    Code (markup):
    and I would like to get

    John Smith <br/>San Francisco<br/><b>USA</b> 
    Code (markup):
    I've tried to use "node.nodeValue" instead of "node.text" but I only get an empty string.

    Could you provide any help please ?
     
    elric, Aug 5, 2008 IP
  2. elladrone

    elladrone Peon

    Messages:
    116
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    show us the xml file excerpt - I am afraid it was not properly formatted
     
    elladrone, Dec 28, 2009 IP
  3. BlackApache

    BlackApache Member

    Messages:
    37
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #3
    thanks for your reply.......
    i tried <?php includemodules/newpage.php; ?>, but not working.
    I dont know how to set to allow html files to parse out php. could you please help me.....hope your fast reply

    vineethclm added 2 Minutes and 25 Seconds later...

    thanks for your reply.......
    i tried <?php includemodules/newpage.php; ?>, but not working.
    I dont know how to set to allow html files to parse out php. could you please help me.....hope your fast reply
     
    BlackApache, Dec 29, 2009 IP
  4. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #4
    I'd say you just want to output (datacontent).innerXML or .innerText or something like that...
     
    camjohnson95, Jan 3, 2010 IP