c#
  • asp.net
  • xml
  • 2013-05-29 48 views 0 likes 
    0

    我使用XML加載。但我有DTD XML負載的問題。加載DTD(文檔類型定義)XML

    我的XML負載的代碼(在C#) -

    XmlDocument soapEnvelopeXml = new XmlDocument(); 
    soapEnvelopeXml.LoadXml(@"<?xml version='1.0' encoding='utf-8'?> 
    <soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'> 
    <soap:Body> 
    <ProcessTGJob xmlns='http://dpi.careerbuilder.com/WebServices/RealTimeJobPost'> 
    <Batch> 
    <Header> 
    <Field name='CBVendorID' value='ED3H3MG5WM50GQP729GL' /> 
    </Header> 
    <Job>     
    <Field name='CBDescription' value='Test Description' /> 
    </Job> 
    </Batch> 
    </ProcessTGJob></soap:Body> 
    </soap:Envelope>"); 
    
    Response.ClearHeaders(); 
    Response.ContentType = "text/xml;charset=UTF-8"; 
    string xmlString = soapEnvelopeXml.InnerXml; 
    Response.Write(xmlString); 
    Response.End(); 
    

    當執行代碼它總是給出一個錯誤is an unexpected token.

    我不明白什麼是代碼的問題。請幫幫我 。

    感謝您的幫助。

    回答

    0

    將content-type更改爲text/xml或application/xml;

    +0

    好吧,但我有錯誤行號2(soapEnvelopeXml.LoadXml(「我的xml字符串」)) –

    +0

    刪除@符號並嘗試。 – MahaSwetha

    +0

    謝謝。但我已經爲此嘗試過了,問題仍然存在。 –

    相關問題