Xml element serialize problem

Discussion in 'ASP .Net Web Services' started by Guest, Jan 5, 2006.

  1. Guest

    Guest Guest

    Hello,
    I've got some problem with pass Xml element that contains special characters
    ( through ) via Web-service.
    For example -
    Server:
    [WebMethod]

    public XmlElement HelloWorld()

    {

    XmlDocument doc = new XmlDocument();

    doc.LoadXml("<a></a>");

    return doc.DocumentElement;

    }



    Client:

    Service1 s = new Service1();

    s.HelloWorld();

    and I've got such exception


    System.InvalidOperationException: There is an error in XML document (1,
    295). --
    -> System.Xml.XmlException: '', hexadecimal value 0x02, is an invalid
    character
    .. Line 1, position 300.
    at System.Xml.XmlScanner.ScanHexEntity()
    at System.Xml.XmlTextReader.ParseBeginTagExpandCharEntities()
    at System.Xml.XmlTextReader.Read()
    at System.Xml.XmlLoader.LoadChildren(XmlNode parent)
    at System.Xml.XmlLoader.LoadElementNode()
    at System.Xml.XmlLoader.LoadCurrentNode()
    at System.Xml.XmlLoader.ReadCurrentNode(XmlDocument doc, XmlReader
    reader)
    at System.Xml.XmlDocument.ReadNode(XmlReader reader)
    at System.Xml.Serialization.XmlSerializationReader.ReadXmlNode(Boolean
    wrappe
    d)

    How can I fix this problem??
    Thank you.
    Guest, Jan 5, 2006
    #1
    1. Advertising

  2. Could you list the characters you're trying to send back to the client?
    The more we know, the easier it is to help you out.
    Javier G. Lozano, Jan 5, 2006
    #2
    1. Advertising

  3. Guest

    Guest Guest

    For example I'm trying this character '?' , but I think never mind what
    character exactly...


    "Javier G. Lozano" <> wrote in message
    news:...
    > Could you list the characters you're trying to send back to the client?
    > The more we know, the easier it is to help you out.
    >
    Guest, Jan 5, 2006
    #3
  4. Guest

    Guest Guest

    I mean not '?' , but character - smiling face... )))

    <> wrote in message
    news:OqhvC%...
    > For example I'm trying this character '?' , but I think never mind what
    > character exactly...
    >
    >
    > "Javier G. Lozano" <> wrote in message
    > news:...
    >> Could you list the characters you're trying to send back to the client?
    >> The more we know, the easier it is to help you out.
    >>

    >
    >
    Guest, Jan 5, 2006
    #4
  5. I'm sorry, I'm having a hard time understanding you. Do you have
    another character that's easier to work with?
    Javier G. Lozano, Jan 5, 2006
    #5
  6. Javier G. Lozano, Jan 5, 2006
    #6
  7. Guest

    Guest Guest

    I'm trying to send any special character in XmlElement, for example, &#x2
    via Web-Service.
    AFAIK each special character has been encoded in XML

    ms-help://MS.MSDNQTR.2004APR.1033/cpguide/html/cpconSpecialCharacterConversionWhenWritingXMLContent.htm

    in server side it's ok (special characters are encoded), but when client
    retrieve XmlElement, I think, client try to decode special characters from
    &#x2 and replace them to one symbol , of course XML can't contains
    characters such as - smiling face character - and I've got exception.
    What I can do in this situation??


    See below...

    "Javier G. Lozano" <> wrote in message
    news:...
    > Are your characters listed in this link:
    > http://www.w3.org/TR/REC-html40/sgml/entities.html ?
    >

    I didn't find it.
    Guest, Jan 9, 2006
    #7
    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. Gordz
    Replies:
    3
    Views:
    3,921
    John Oakes
    Jun 7, 2004
  2. Jim Cobban
    Replies:
    2
    Views:
    730
    Jim Cobban
    Dec 15, 2003
  3. HANM
    Replies:
    2
    Views:
    691
    Joseph Kesselman
    Jan 29, 2008
  4. Neil
    Replies:
    4
    Views:
    1,491
    Mike Schilling
    Sep 28, 2009
  5. Albert Jan

    Serialize complex type element with simple content

    Albert Jan, Oct 4, 2004, in forum: ASP .Net Web Services
    Replies:
    2
    Views:
    159
    Albert Jan
    Oct 5, 2004
Loading...

Share This Page