Open jonnyfiveiq opened 12 years ago
Further info... here is the XML that came back in string_or_io
<?xml version="1.0" encoding="UTF-8"?>
Sorry closed by mistake... still an issue.
Ok managed to put a band aid round the problem it seems that the ParseOptions set to STRICT break it, by changing this to default_xml, this resolved the issue. Can you recommend how to fix this longer term via the vcloud gem rather than me changing the happymapper.rb...many thanks
xml = Nokogiri::XML(xml, nil, nil, Nokogiri::XML::ParseOptions::DEFAULT_XML) #NEW AMENDED LINE node = xml.root
Couple questions.
1) What version of director are you working against? We built this against 1.5, so there may be some odditites on other versions.
2) That xml you posted is clearly incomplete. Was that b/c of github filtering something out or is that exactly what you got, including the whitespace and 'Testb Organization' twice at the end?
Thanks for responseŠ
From: Zach Robinson notifications@github.com Reply-To: DieboldInc/vcloud-ruby <reply+i-7827575-d083e9fe8a73fe1bdb45798ca4696be1118f114e-2084157@reply.gith ub.com> Date: Wednesday, 24 October 2012 15:44 To: DieboldInc/vcloud-ruby vcloud-ruby@noreply.github.com Cc: John Hardy john@jhardy.co.uk Subject: Re: [vcloud-ruby] Issue with parse result from vCD (#2)
Couple questions.
1) What version of director are you working against? We built this against 1.5, so there may be some odditites on other versions.
2) That xml you posted is clearly incomplete. Was that b/c of github filtering something out or is that exactly what you got, including the whitespace and 'Testb Organization' twice at the end?
‹ Reply to this email directly or view it on GitHub https://github.com/DieboldInc/vcloud-ruby/issues/2#issuecomment-9742038 .
looks like it has to do with the unicode chars on these lines:
<Description>Testb Organization</Description>
<FullName>Testb Organization</FullName>
Those chars are html escaped and need to be html unescaped, for example using CGI.unescapeHTML(xml_stuff) before being fed to nokogiri for parsing. Looking at the best way to do that in the vcloud gem (maybe a restclient option or something).
I pushed up a new branch called 'unicode' that I think will fix your issue. If you get a chance to give it a try and let me know then I'll push it into the gem if all is good.
HI again,
All connected, and returning the list of orgs. Next to create an org object, where it fails. Using your example code I cannot get it to work, any help much appreciated.
There is only one org called testorg at the moment.
@session.get_org_references.each do |org_ref| @org_name = org_ref.name puts @org_name end @org = @session.get_org_from_name(@org_name)
/Users/~/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/gems/1.9.1/gems/nokogiri-1.5.5/lib/nokogiri/xml/document.rb:55:in'
read_memory': xmlParseCharRef: invalid xmlChar value 1 (Nokogiri::XML::SyntaxError) from /Users/~/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/gems/1.9.1/gems/nokogiri-1.5.5/lib/nokogiri/xml/document.rb:55:in
parse' from /Users/~/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/gems/1.9.1/gems/nokogiri-1.5.5/lib/nokogiri/xml.rb:33:inXML' from /Users/~/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/gems/1.9.1/gems/nokogiri-happymapper-0.5.5/lib/happymapper.rb:261:in
parse' from /Users/~/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/gems/1.9.1/gems/nokogiri-happymapper-0.5.5/lib/happymapper.rb:666:inparse' from /Users/~/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/gems/1.9.1/gems/vcloud-0.0.1.1/lib/vcloud/parses_xml.rb:30:in
parse_xml' from /Users/~/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/gems/1.9.1/gems/vcloud-0.0.1.1/lib/vcloud/rest_api.rb:88:inparse_response' from /Users/~/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/gems/1.9.1/gems/vcloud-0.0.1.1/lib/vcloud/rest_api.rb:9:in
refresh' from /Users/~/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/gems/1.9.1/gems/vcloud-0.0.1.1/lib/vcloud/base_vcloud_entity.rb:30:infrom_reference' from /Users/~/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/gems/1.9.1/gems/vcloud-0.0.1.1/lib/vcloud/client.rb:76:in
get_org_from_name' from /Users/~/NetBeansProjects/vCloud Director/lib/main.rb:19:in `