Empact / roxml

ROXML is a module for binding Ruby classes to XML. It supports custom mapping and bidirectional marshalling between Ruby and XML using annotation-style class methods, via Nokogiri or LibXML.
http://roxml.rubyforge.org/
MIT License
223 stars 176 forks source link

Flesh out Namespaced Attribute support #9

Closed Empact closed 15 years ago

Empact commented 15 years ago

Reported by James Healy:

I'm trying to generate an XML that has a root element like so:

I can add the version attribute no worries, but can't quite work out the namespaced attributes. I guessed at the following lines, but they cause a libxml segfault: xml_accessor :xsi, :from => "@xmlns:xsi" xml_accessor :schema_location, :from => "@xsi:schemaLocation"
Empact commented 15 years ago

This may already work with some syntax. If so it should be documented.

yob commented 15 years ago

Since upgading libxml-ruby to 1.1.3 and roxml to 2.5.3, I can't reproduce the segfault anymore and the xml_accessor attributes I guessed at seem to work as expected.

Looks like it fixed itself :)

yob commented 15 years ago

It seems I was a little hasty closing this bug, I found some issues that warrant it staying open when I investigated further. It seems I can't reopen it though.

I've got some ideas for improved namespace support that I'll flesh out over the weekend.

Empact commented 15 years ago

Reopened

Empact commented 15 years ago

I've finally done some work on namespaces. See the xml_namespaces method, and the xml_attr :namespace option. See also spec/xml/namespace_spec.rb.

Let me know if that does it for you.

Empact commented 15 years ago

Switch that: reopen if it's still a problem.