I am trying to create the XML file using the node.js
and npm package xmlbuilder
. When I am trying to create the tags I have some special characters such as : / etc
due to which I am getting the following error:
Error: Invalid character in name: http://google.com.http://google.com
How can I resolve this issue. I can replace it with the blank but I don't want to do that I want my XML to retain these special characters.
var root = builder.create('test:document')
var ObjectEvent = root.ele('ObjectEvent')
for(var ex=0; ex<Extension.length; ex++)
{
Extension[ex].NameSpace = Extension[ex].NameSpace;
Extension[ex].LocalName = Extension[ex].LocalName;
Extension[ex].FreeText = Extension[ex].FreeText;
ObjectEvent.ele(Extension[ex].NameSpace+Extension[ex].LocalName,Extension[ex].FreeText).up()
}
ObjectEvent.ele(Extension[ex].NameSpace+'.'+Extension[ex].LocalName,Extension[ex].FreeText).up()
My Extension
elements would look something like this;
[
{
NameSpace: 'http://google.com',
LocalName: 'http://google.com',
ExtensionVlaues: 0,
FreeText: 'Google Website',
'$$hashKey': 'object:290'
}
]
I wanted to know how can I retain all the special characters in my XML document