Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]

Changeset 1784

Show
Ignore:
Timestamp:
05/19/07 12:47:46 (2 years ago)
Author:
nahi
Message:
  • added CDATA support with rexml/xmlscan as an XML parser. closes #332.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/xsd/xmlparser/rexmlparser.rb

    r1520 r1784  
    4343  end 
    4444 
     45  def cdata(content) 
     46    characters(content) 
     47  end 
     48 
    4549  def xmldecl(version, encoding, standalone) 
    4650    # Version should be checked. 
  • trunk/lib/xsd/xmlparser/xmlscanner.rb

    r1520 r1784  
    8383  end 
    8484 
    85   # def on_cdata(str); end 
     85  def on_cdata(str) 
     86    characters(str) 
     87  end 
    8688 
    8789  def on_etag(name) 
  • trunk/test/soap/test_response_as_xml.rb

    r1780 r1784  
    4242    @client.wiredump_dev = STDERR if $DEBUG 
    4343    @client.add_method('hello', 'name') 
     44    @client.add_document_method('hellodoc', Namespace, XSD::QName.new(Namespace, 'helloRequest'), XSD::QName.new(Namespace, 'helloResponse')) 
    4445  end 
    4546 
     
    9495<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'> 
    9596  <env:Body> 
    96     <gno:getHealthSummaryResponse xmlns:gno='http://some.url'> 
     97    <gno:helloResponse xmlns:gno='urn:example.com:hello'> 
    9798      <gno:htmlContent> 
    9899        <![CDATA[<span>some html</span>]]> 
    99100      </gno:htmlContent> 
    100     </gno:getHealthSummaryResponse> 
     101    </gno:helloResponse> 
    101102  </env:Body> 
    102103</env:Envelope> 
    103104__XML__ 
    104105  def test_cdata 
     106    @client.return_response_as_xml = false 
     107    @client.test_loopback_response << RESPONSE_CDATA 
     108    ret = @client.hellodoc(nil) 
     109    assert_equal("\n        <span>some html</span>\n      ", ret.htmlContent) 
     110    # 
    105111    @client.return_response_as_xml = true 
    106112    @client.test_loopback_response << RESPONSE_CDATA 
     
    111117    assert_equal("<span>some html</span>", 
    112118      REXML::XPath.match(doc, "//*[name()='gno:htmlContent']")[0][1].value) 
     119    # 
    113120  end 
    114121end