Comments (9)
Set the indentation to zero. That will make the output as tight as possible with no added new lines.
from ox.
it does not seems to work that way :(
require 'ox'
root = Ox::Element.new('root')
root << Ox::Element.new('name').tap{|el| el << "value" }
root << Ox::Element.new('name2').tap{|el| el << "value2" }
p Ox.dump( root, indent: 0 )
# => "\n<root>\n<name>value</name>\n<name2>value2</name2>\n</root>\n"
What I want is:
<root><name>value</name><name2>value2</name2></root>
is there something missing in my code ?
from ox.
Should work so I must have broken something on some release. I'll get it fixed.
from ox.
The fix will be a clarification of the documentation. If the indent value is less than 0 then you get a tight one line output.
from ox.
If you can fix this issue and indent: 0 really does generate an xml with no newline I can resort to a single gsub on the result to replace the entities for #64 , this should do the trick for me.
from ox.
Less than zero, so -1 will give you the one line xml.
from ox.
ah ok my bad, will try that then !
I don't why I got stuck with = 0 in my head instead of < 0 :s
from ox.
Let me know if it works. :-)
from ox.
it works !
There is a newline at the end but for some reason every xml builder wants to have this newline, I can take care of it no big deal xD
from ox.
Related Issues (20)
- Parse error for comments containing special characters inside a DOCTYPE declaration HOT 1
- Single carriage return is not converted to line feed HOT 16
- Easy way to get backtrace information from the C extension? HOT 18
- Process XML with instructions longer than 1024 characters. HOT 9
- Ox 2.14.7 causes segfault HOT 14
- RESX XML parsing - support for xml:space="preserve" HOT 3
- Preserve newlines in attributes and bodies when parsing. HOT 2
- [BUG] Bus Error (crashes ruby when using more than 16458 characters in a field) HOT 5
- Request to include a new mode to load which prepends xml attributes with a given string or a default HOT 1
- Ox.load result changes after parsing specific xml. HOT 2
- Sax parser segfault in v2.14.7+ HOT 4
- `StringIO` in `Ox::Builder` HOT 2
- Sax parsing with default encoding set to UTF-8 breaks Ox::Sax#text HOT 2
- OpenSSL::SSL::SSLContext::DEFAULT_CERT_STORE is not shareable across ractors HOT 1
- Issue with gems on M1 that depends on ox HOT 3
- test/tests.rb fails with ruby3.2.0preview3 and onwards HOT 3
- Ruby 3.2 compatibility HOT 2
- cannot load such file -- ox/ox HOT 6
- Cleaning built artifacts after installation breaks macOS HOT 4
- Incorrect ` Start End Mismatch` exception in sax parser HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ox.