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
This is probably an issue on my end that I'm doing something wrong, but I can't seem to parse this XML collection properly. The XML looks like:
<?xml version="1.0" encoding="utf-8"?>
<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.SupermarketAPI.com">
<string>Apples</string>
<string>Gerber 100% Apple Juice - 32 Fl. Oz.</string>
<string>Gerber Apple Juice - 4-4 Fl. Oz.</string>
<string>Gerber Organic Apple Juice - 4-4 Fl. Oz.</string>
<string>Pedialyte Tetra/Brick Pk Apple Flavor - 4-6.8 Fl. Oz.</string>
</ArrayOfString>
My representer looks like:
require'representable/decorator'require'representable/xml'require'representable/xml/collection'classStringsSerializer < Representable::DecoratorincludeRepresentable::XML::Collectionself.representation_wrap=:ArrayOfString# TODO: this belongs in `Representable::XML::Collection`# REF: https://github.com/apotonick/representable/issues/119defself.remove_namespaces!representable_attrs.options[:remove_namespaces]=trueendremove_namespaces!itemswrap: :stringend
And I'm parsing via:
StringsSerializer.new([]).from_xml(raw_xml)
The result is a collection where each entry is the Nokogiri::XML::Element rather than the String representing the text child of each element. For example, my tests are failing with messages like:
object at index 0 failed to match:
expected #<Nokogiri::XML::Element:0x3fe7b9f4a3b8 name="string" children=[#<Nokogiri::XML::Text:0x3fe7b9f46b00 "Apples">]> to be a kind of String
Any idea where I'm going wrong here? I imagine it's probably just a problem on my side.
The text was updated successfully, but these errors were encountered:
This is probably an issue on my end that I'm doing something wrong, but I can't seem to parse this XML collection properly. The XML looks like:
My representer looks like:
And I'm parsing via:
The result is a collection where each entry is the
Nokogiri::XML::Element
rather than theString
representing the text child of each element. For example, my tests are failing with messages like:Any idea where I'm going wrong here? I imagine it's probably just a problem on my side.
The text was updated successfully, but these errors were encountered: