You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While trying to get a .Net bug-compatible SOAP output I found the following anomaly...
require'nokogiri'SOAP_NAMESPACES={"xmlns:SOAP-ENV"=>"http://schemas.xmlsoap.org/soap/envelope/","xmlns:SOAP-ENC"=>"http://www.w3.org/2003/05/soap-encoding","xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance","xmlns:xsd"=>"http://www.w3.org/2001/XMLSchema","xmlns:wsa"=>"http://schemas.xmlsoap.org/ws/2004/08/addressing","xmlns:custom"=>"http://local.dev/soap_api/v1"}# Namespaces explicitly post constructedbuilder=Nokogiri::XML::Builder.new(:encoding=>'UTF-8')do |xml|
xml.Envelopedo#Workaround to allow namespace prefixes with "-" (hyphens) in themSOAP_NAMESPACES.eachdo | prefix,href |
xml.doc.root.add_namespace_definition(prefix.gsub('xmlns:',''),href)end#Workaround to allow SOAP envelope to be namespaced after namespace definedxml.doc.root.namespace=xml.doc.root.namespace_definitions.firstendendputs"Expected Output :"putsbuilder.doc.to_xml# Namespaces inline with root elementbuilder=Nokogiri::XML::Builder.new(:encoding=>'UTF-8')do |xml|
xml.Envelope(SOAP_NAMESPACES)do#Workaround to allow SOAP envelope to be namespaced after namespace definedxml.doc.root.namespace=xml.doc.root.namespace_definitions.firstendendputs"Actual Output :"putsbuilder.doc.to_xml
If reasonable I think it should be a simple regex change in nokogiri-1.5.0/lib/nokogiri/xml/document.rb (around line : 60)
arg.each{ |k,v|
key=k.to_sifkey =~ /^xmlns(:\w+)?$/#Change "\w+" to "[0-9A-Za-z_-]+" or whatever is XML NCName compliantns_name=key.split(":",2)[1]elm.add_namespace_definitionns_name,vnextendelm[k.to_s]=v.to_s}
Regards,
parameme
The text was updated successfully, but these errors were encountered:
While trying to get a .Net bug-compatible SOAP output I found the following anomaly...
Expected Output :
Actual Output :
If reasonable I think it should be a simple regex change in nokogiri-1.5.0/lib/nokogiri/xml/document.rb (around line : 60)
Regards,
parameme
The text was updated successfully, but these errors were encountered: