XML Parsing Error: Junk After Document Element

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andy Dingley

    #16
    Re: XML Parsing Error: Junk After Document Element

    pbd22 wrote:
    the "<" and the ">" are getting changed into &lt; and &gt;
    >
    how do i fix this?
    Two possible ways:

    * Use DOM, not a string tool.

    * Learn at least as much about how to work with XML as native strings
    as someone who writes DOMs.

    (Guess what, the first of these is easier and more reliable)

    Comment

    • pbd22

      #17
      Re: XML Parsing Error: Junk After Document Element

      hi.

      i am new to this and i am trying. As for DOM, I have tried the below:

      I am using stringbuilder to build the database values into an
      XML doc.
      then, to create the DOM, I do the following:
      Dim xml As XmlDocument = New XmlDocument
      xml.LoadXml(sbh tml.ToString)

      Context.Respons e.ContentType = "text/xml"
      Context.Respons e.Write(xml)

      This returns nothing on the client. I keep getting "undefined" . I
      appreciate your DOM suggestion, and am learning as i go, but maybe you
      could help to provide a solution?

      thanks again.

      Andy Dingley wrote:
      pbd22 wrote:
      >
      the "<" and the ">" are getting changed into &lt; and &gt;

      how do i fix this?
      >
      Two possible ways:
      >
      * Use DOM, not a string tool.
      >
      * Learn at least as much about how to work with XML as native strings
      as someone who writes DOMs.
      >
      (Guess what, the first of these is easier and more reliable)

      Comment

      • pbd22

        #18
        Re: XML Parsing Error: Junk After Document Element

        ok, i figured this out.

        for others, maybe this will help:

        i am working in .NET

        I created a search_data.asp x file for the AJAX call.
        in the search_data.asp x file, i had the:

        <asp:Content ID="Content1" ContentPlaceHol derID="ContentP laceHolder1"
        Runat="Server">

        tags wrapping my script. hence, autogenerated HTML
        was added after my XML stuff, causing the Junk after XML error.

        take out the content tags and you should be good to go.

        thanks all for your suggestions along the way.


        pbd22 wrote:
        hi.
        >
        i am new to this and i am trying. As for DOM, I have tried the below:
        >
        I am using stringbuilder to build the database values into an
        XML doc.
        then, to create the DOM, I do the following:
        Dim xml As XmlDocument = New XmlDocument
        xml.LoadXml(sbh tml.ToString)
        >
        Context.Respons e.ContentType = "text/xml"
        Context.Respons e.Write(xml)
        >
        This returns nothing on the client. I keep getting "undefined" . I
        appreciate your DOM suggestion, and am learning as i go, but maybe you
        could help to provide a solution?
        >
        thanks again.
        >
        Andy Dingley wrote:
        pbd22 wrote:
        the "<" and the ">" are getting changed into &lt; and &gt;
        >
        how do i fix this?
        Two possible ways:

        * Use DOM, not a string tool.

        * Learn at least as much about how to work with XML as native strings
        as someone who writes DOMs.

        (Guess what, the first of these is easier and more reliable)

        Comment

        Working...