Questions tagged [xml-builder]
62 questions
19
votes
3 answers
Ruby on Rails: Using XML Builder Partials
Partials in XML builder are proving to be non-trivial.
After some initial Google searching, I found the following to work, although it's not 100%
xml.foo do
xml.id(foo.id)
xml.created_at(foo.created_at)
…

randombits
- 47,058
- 76
- 251
- 433
12
votes
1 answer
NameError: uninitialized constant ActiveRecord::Associations::Builder::XMLMarkup
I found a post with a headline quite similar to this one, but it didn't give me the answer I was looking for.
I am trying to use builder inside a model. The code looks something like this:
require 'builder'
class Document < ActiveRecord::Base
...
…

klaffenboeck
- 6,297
- 3
- 23
- 33
11
votes
3 answers
Parse XML to JSON and back ... with xml2js and xmlbuilder?
Trying to parse XML into JSON with xml2js and then return the JSON to XML using xmlbuilder (usually after modifying the content programmatically).
I think that the two should be complements, per this post…

prototype
- 7,249
- 15
- 60
- 94
9
votes
2 answers
What can I use to generate a local XML file?
I have a project that I am working on and I do not know much about Rails or Ruby.
I need to generate an XML file from user input.
Can some direct me to any resource that can show me how to do this pretty quickly and easily?

ironmantis7x
- 807
- 2
- 23
- 58
7
votes
1 answer
Ruby XML Builder, how to create this namespace?
I'm using Ruby's XML Builder and trying to find the proper syntax to recreate the following RSS 2.0 declaration:
What's the appropriate way of going about this with XML Builder to put…

randombits
- 47,058
- 76
- 251
- 433
5
votes
1 answer
Adding namspace in xml using a xmlbuilder in nodejs
I am generating xml in nodejs by using xmlbulilder package, now my requirement is to add namespace to xml.
for example
nodeText
how we can…

Sachin
- 109
- 1
- 8
4
votes
1 answer
Rails xml-builder custom namespace remove white space
I have a Google merchant centre XML script which is printing additional white space within every element and I can't seem to get rid of it
I've simplified the script below to demonstrate what I'm after. Current
script:
xml.instruct!
xml.feed…

moztech
- 430
- 2
- 4
- 14
3
votes
2 answers
Unable to create CDATA section in XML using "xmlbuilder" node.js module
I am using "xmlbuilder" node.js module to create xml file. I need to create a CDATA section as follows:
I referred the github link, but didn't found any useful stuff.
How to create such CDATA section…

Kushagra Sinha
- 79
- 1
- 6
3
votes
2 answers
convert flat file records to xml in java
I have a scenario where records of employees written in flat file, something like :
flatFile.txt
============
1|name1|dept1|10000
2|name2|dept2|12000
3|name3|dept3|9500
....
....
Now I want to read this flat file and convert above employee records…

Nirmal
- 4,789
- 13
- 72
- 114
2
votes
2 answers
How to make a method returning XMLError compatible with anyhow::Error?
This is my code (XMLElement from xml-builder):
use anyhow::Result;
use xml_builder::XMLElement;
fn foo() -> Result<()> {
let mut v = XMLElement::new("v");
v.add_child(XMLElement::new("e"))?;
Ok(())
}
It doesn't compile:
error[E0277]: the…

yegor256
- 102,010
- 123
- 446
- 597
2
votes
1 answer
NodeJS checking if XML element exists and add or delete
I'm working with XML in NodeJS. I've been using the xmlbuilder to create my XML. The problem is that now I need to check if a element already exists and delete or update it.
For example, I have the following XML
…

myTest532 myTest532
- 2,091
- 3
- 35
- 78
2
votes
1 answer
layout for XML builder in rails 3
I would like to create general layout file for XML response. For example I would like to wrap those general part of RSS in the layout and leave the content be generated in the corresponding view file.
For example,
# in…

PeterWong
- 15,951
- 9
- 59
- 68
2
votes
1 answer
How to import text file for xmlbuilder in node.js
I am using xmlbuilder npm package - which looks powerful , except I want to import an existing xml file into the xmlbuilder and manipulate elements / attributes etc as opposed to building the whole thing from scratch. It is possible to do it with…

Martin Thompson
- 3,415
- 10
- 38
- 62
2
votes
1 answer
Testing XmlBuilder with Rspec
I posted a question (Rails XML builder not rendering) regarding rendering XML using XmlBuilder. That particular issue was resolved but I’ve run into another issue testing this controller action.
The issue seems to be with Rspec as because the same…

Nate Bird
- 5,243
- 2
- 27
- 37
1
vote
1 answer
Nested to_xml issue?
This may be a basic question but it has been causing me some problems. I am trying to dump an ActiveRecord Object to an XML file using the to_xml function. For whatever reason, this does not work for me if I try to nest it into an element.
Basically…

Rhawb
- 53
- 1
- 8