我有一个 XML 文档:
<event>
<type>SUBSCRIPTION_ORDER</type>
<marketplace>
<baseUrl>https://www.acme-marketplace.com</baseUrl>
<partner>ACME</partner></marketplace>
</marketplace>
<creator>
<email>admin@fakeco</email>
<firstName>Alice</firstName>
<lastName>Hacker</lastName>
<openId>https://www.acme-marketplace.com/openid/id/a11a7918-bb43-4429-a256-f6d729c71033</openId>
<uuid>a11a7918-bb43-4429-a256-f6d729c71033</uuid>
</creator>
<payload>
<company>
<uuid>d15bb36e-5fb5-11e0-8c3c-00262d2cda03</uuid>
<email>admin@fakeco</email>
<name>Fake Co.</name>
<phoneNumber>1-415-555-1212</phoneNumber>
<website>fakeco</website>
</company>
<order>
<editionCode>BASIC</editionCode>
<item>
<quantity>10</quantity>
<unit>USER</unit>
</item>
</order>
</payload>
</event>
当我用 nokogiri 加载它时,我得到了奇怪的结果:
1.9.3p194 :056 > doc = Nokogiri::XML(File.open("test.xml")).to_s
=> "<?xml version=\"1.0\"?>\n<event>\n <type>SUBSCRIPTION_ORDER</type>\n <marketplace>\n <baseUrl>https://www.acme-marketplace.com</baseUrl>\n <partner>ACME</partner></marketplace>\n </event>\n"
我究竟做错了什么?