XML TRANSFORM - Serious problem - nested element causes Index error...why oh why???

Discussion in 'ASP .Net' started by KathyB, Jun 24, 2003.

  1. KathyB

    KathyB Guest

    Hi,

    This problem is KILLING my project. I'm transforming an xml doc (step
    by step instruction documents) in asp.net web form. I've tried using
    the xml web control and the following code:

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load
    'Put user code to initialize the page here
    Response.Write("Hello Rod x 2")
    Dim xDoc As New XmlDocument()
    Dim xTrans As New XslTransform()
    Dim xWriter = New XmlTextWriter(Response.Output)
    xDoc.Load(Server.MapPath("KB_Test_WI1.xml"))
    xTrans.Load(Server.MapPath("KB_Test.xsl"))
    xTrans.Transform(xDoc, Nothing, xWriter)
    End Sub

    With both methods I get this error message:

    Index was out of range. Must be non-negative and less than the size of
    the collection. Parameter name: index

    Both methods work on the EXACT same document IF I remove the third
    nested level of the <step> element. xml sample structure is:

    <step />
    <step>
    <step />
    </step>
    <step>
    <step>
    <step /> --here's where the error occurs!!!
    </step>
    </step>

    PLEASE what am I missing? I thought one of the strengths of XML was to
    be able to use this type of structure?

    Thank you.

    Kathy
     
    KathyB, Jun 24, 2003
    #1
    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. William F. Robertson, Jr.
    Replies:
    1
    Views:
    1,004
    Kathy Burke
    Jun 25, 2003
  2. Igor
    Replies:
    1
    Views:
    5,031
    Dimitre Novatchev
    Jul 20, 2003
  3. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,271
    Smokey Grindel
    Dec 2, 2006
  4. HANM
    Replies:
    2
    Views:
    769
    Joseph Kesselman
    Jan 29, 2008
  5. Tomasz Chmielewski

    sorting index-15, index-9, index-110 "the human way"?

    Tomasz Chmielewski, Mar 4, 2008, in forum: Perl Misc
    Replies:
    4
    Views:
    362
    Tomasz Chmielewski
    Mar 4, 2008
Loading...

Share This Page