DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Gia Guest

    Problem creating element in XML file


    hello,
    i'm trying to get a value from db and create an element for this value.
    i do the following:
    Open recordset
    Get Value from DB:
    Et= cstr(RsRt.Fields.Item(1).Value)
    Create Element in xml file:
    Set root = dom.createElement(Et) <----- Error

    when i run this it says, "One or more arguments are invalid"

    if i change the Et="didi" for example, then it creates the element "didi"
    without any problem.

    the value exist in the db and when i use response.write to view value, its
    successful. What is the correct syntax to use when sending value from DB
    to the CreateElment. Suggestions?

    Regards,
    Gia

  2. #2
    Russell Jones Guest

    Re: Problem creating element in XML file

    What is the value? The createElement method expects a String. Also, does the
    value conform to XML element-name specifications?

    "Gia" <grjorge_me@yahoo.com> wrote in message
    news:3b2e5ce8$1@news.devx.com...
    >
    > hello,
    > i'm trying to get a value from db and create an element for this

    value.
    > i do the following:
    > Open recordset
    > Get Value from DB:
    > Et= cstr(RsRt.Fields.Item(1).Value)
    > Create Element in xml file:
    > Set root = dom.createElement(Et) <----- Error
    >
    > when i run this it says, "One or more arguments are invalid"
    >
    > if i change the Et="didi" for example, then it creates the element "didi"
    > without any problem.
    >
    > the value exist in the db and when i use response.write to view value, its
    > successful. What is the correct syntax to use when sending value from DB
    > to the CreateElment. Suggestions?
    >
    > Regards,
    > Gia




  3. #3
    Gia Guest

    Re: Problem creating element in XML file


    hello,
    the value is "employee" which is a string.
    i noticed that when i use the actual name of the fieldName:
    ex: RsRt.Fields.Item(1).name instead of RsRt.Fields.Item(1).Value

    it took it and generated the XML. i really would like to use the value not
    the field name. Suggestions?

    regards,
    Gia

    "Russell Jones" <arj1@northstate.net> wrote:
    >What is the value? The createElement method expects a String. Also, does

    the
    >value conform to XML element-name specifications?
    >
    >"Gia" <grjorge_me@yahoo.com> wrote in message
    >news:3b2e5ce8$1@news.devx.com...
    >>
    >> hello,
    >> i'm trying to get a value from db and create an element for this

    >value.
    >> i do the following:
    >> Open recordset
    >> Get Value from DB:
    >> Et= cstr(RsRt.Fields.Item(1).Value)
    >> Create Element in xml file:
    >> Set root = dom.createElement(Et) <----- Error
    >>
    >> when i run this it says, "One or more arguments are invalid"
    >>
    >> if i change the Et="didi" for example, then it creates the element "didi"
    >> without any problem.
    >>
    >> the value exist in the db and when i use response.write to view value,

    its
    >> successful. What is the correct syntax to use when sending value from

    DB
    >> to the CreateElment. Suggestions?
    >>
    >> Regards,
    >> Gia

    >
    >



  4. #4
    Rodney Kendall Guest

    Re: Problem creating element in XML file

    Have you tried placing the CStr call around the Et variable in the
    createElement method call? It is still a variant even though you are
    assigning it as a string via CStr. The CStr output in the method call
    should actually send a string rather than a variant maskerading as a string.

    Gia <grjorge_me@yahoo.com> wrote in message news:3b30b9bf$1@news.devx.com...
    >
    > hello,
    > the value is "employee" which is a string.
    > i noticed that when i use the actual name of the fieldName:
    > ex: RsRt.Fields.Item(1).name instead of RsRt.Fields.Item(1).Value
    >
    > it took it and generated the XML. i really would like to use the value

    not
    > the field name. Suggestions?
    >
    > regards,
    > Gia
    >
    > "Russell Jones" <arj1@northstate.net> wrote:
    > >What is the value? The createElement method expects a String. Also, does

    > the
    > >value conform to XML element-name specifications?
    > >
    > >"Gia" <grjorge_me@yahoo.com> wrote in message
    > >news:3b2e5ce8$1@news.devx.com...
    > >>
    > >> hello,
    > >> i'm trying to get a value from db and create an element for this

    > >value.
    > >> i do the following:
    > >> Open recordset
    > >> Get Value from DB:
    > >> Et= cstr(RsRt.Fields.Item(1).Value)
    > >> Create Element in xml file:
    > >> Set root = dom.createElement(Et) <----- Error
    > >>
    > >> when i run this it says, "One or more arguments are invalid"
    > >>
    > >> if i change the Et="didi" for example, then it creates the element

    "didi"
    > >> without any problem.
    > >>
    > >> the value exist in the db and when i use response.write to view value,

    > its
    > >> successful. What is the correct syntax to use when sending value from

    > DB
    > >> to the CreateElment. Suggestions?
    > >>
    > >> Regards,
    > >> Gia

    > >
    > >

    >




Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links