Results 1 to 9 of 9

Thread: what is wrong with this ???

  1. #1

    Thread Starter
    Hyperactive Member spoiledkid's Avatar
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    437

    what is wrong with this ???

    I am trying to send a XML String inside a XML tag called value here ... its not allowing me to, whats wrong ??

    <params>
    <Param Name="@strXML" Value="<Root><Table1 ID="1" Name="A"></Root>"/>
    </params>

  2. #2
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724
    It would be the double quotes within the Value attribute - replace them with single quotes, or another alternative

  3. #3

    Thread Starter
    Hyperactive Member spoiledkid's Avatar
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    437
    I tried this ..

    <params>
    <Param Name="@strXML" Value='<Root><Table1 ID="1" Name="A" /></Root>'/>
    </params>

    still gives error ...

  4. #4
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724
    Ah - just had a quick play in IE - replace the < and > with &lt; and &gt; respectively

  5. #5

    Thread Starter
    Hyperactive Member spoiledkid's Avatar
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    437
    I think its something to do with < character. I somehow need to use Server.HTMLEncode method of ASP in VB to convert < > characters to XML values ...

  6. #6

    Thread Starter
    Hyperactive Member spoiledkid's Avatar
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    437
    Originally posted by axion_sa
    Ah - just had a quick play in IE - replace the < and > with &lt; and &gt; respectively
    I know, but its code and not a manual process. How will I know during runtime what tags do I have to convert ??

  7. #7
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724
    I assume you extract the attribute value(s) in code & action accordingly? In that case - replace all occurrences of &lt; and &gt; with their respective node values before you begin executing whatever it is you do.

  8. #8

    Thread Starter
    Hyperactive Member spoiledkid's Avatar
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    437
    You are right .. I wrote this ..

    VB Code:
    1. Public Function HTMLEncode(ByVal inputString As String) As String
    2.         inputString.Replace("<", "&lt;")
    3.         inputString.Replace(">", "&gt;")
    4.  
    5.         Return inputString
    6.     End Function

    however, this fixes the problem. I am now just wondering if there is anything else I need to worry about which I cannot foresee at this time ... ????

  9. #9
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724
    Not offhand - but to err on the right side of cautious... Perhaps have a Google at reserved XML characters, that might pop up a few more than <, > and "

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width