Add XMLNS attribute to an xml file

bianca.pira

New Member
Joined
Jul 20, 2010
Messages
6
Hi!<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
<o:p></o:p>
I need to build a macro that creates a xml file, having information taken from the excel file and from a database. The fact is that i have an example that shows me how the final file should look like. <o:p></o:p>
<o:p></o:p>
An example of a final xml source looks like this one:<o:p></o:p>
<!--
<root xmlns="<?XML:NAMESPACE PREFIX = [default] <u NS = "<u" /><root xmlns="<u">http://www.blablabla.com<U>/bla1"</U> , xmlns:xsi = "http://www.blabla2/bla2"><o:p></o:p></ROOT>
<root xmlns="<u"><header><tag1>'<header><o:p></o:p></header></root>
</tag1><root xmlns="<u"><header><tag1>'<tag1>lalala</tag1><o:p></o:p></header></root>
</tag1><root xmlns="<u"><header><tag1>'<tag2></tag1><tag2>tralala</tag2> <o:p></o:p></tag2></header></root>
<root xmlns="<u"><header><tag2>'</header><o:p></o:p></tag2>
</header><DataFromDB xmlns="<u">'<DataFromDB xmlns"http://www.example.com/bla1" , xmlns:xsi = "http://www.example2/bla2"> <o:p></o:p></DataFromDB>
<DataFromDB xmlns="<u">'<series attr1= "1" attr2 = "2"><o:p></o:p>
<row atrr2="2" , attr1="1"></row><ROW atrr2="4" , attr1="3"></ROW><ROW atrr2="6" , attr1="5"></ROW></DataFromDB></root>' </series><o:p></o:p>
<DataFromDB xmlns="<u">'<series attr1= "1" attr2 = "2"><o:p></o:p>
<row atrr2="2" , attr1="1"></row><ROW atrr2="4" , attr1="3"></ROW><ROW atrr2="6" , attr1="5"></ROW></DataFromDB>' </series><o:p></o:p>
<DataFromDB xmlns="<u">'<series attr1= "1" attr2 = "2"><o:p></o:p>
<row atrr2="2" , attr1="1"></row><ROW atrr2="4" , attr1="3"></ROW><ROW atrr2="6" , attr1="5"></ROW></DataFromDB>' </series><o:p></o:p>
'</DataFromDB><o:p></o:p>
'<root>
--><o:p></o:p>
So, i have managed to write a vb procedure that creates the exact document, except adding the xmlns and xmlns:xsi atrribuites to the "root" and to "DataFromDB" tags.<o:p></o:p>
I don't know how to do that. <o:p></o:p>
I use Microsoft XML, v5.0.<o:p></o:p>
Could you please help me with this problem?<o:p></o:p>
</root><DataFromDB xmlns="<u"><series attr1="1" attr2="2"></DATAFROMDB></ROOT>
</series></DataFromDB>
 
Last edited:

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
In order to see the tags I user '' instead of < Hope it works!

Hi!<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
<o:p></o:p>
I need to build a macro that creates a xml file, having information taken from the excel file and from a database. The fact is that i have an example that shows me how the final file should look like. <o:p></o:p>
<o:p></o:p>
An example of a final xml source looks like this one:<o:p></o:p>
'<root xmlns="<?XML:NAMESPACE PREFIX = [default] <u NS = "<u" /><root xmlns="<u">http://www.blablabla.com<U>/bla1"</U> , xmlns:xsi = "http://www.blabla2/bla2"><o:p></o:p></ROOT>
<root xmlns="<u"><header><tag1>'’header><o:p></o:p></header></root>
</tag1><root xmlns="<u"><header><tag1>'’tag1>lalala</tag1><o:p></o:p></header></root>
</tag1><root xmlns="<u"><header><tag1>'’tag2></tag1><tag2>tralala</tag2> <o:p></o:p></tag2></header></root>
<root xmlns="<u"><header><tag2>'’/header><o:p></o:p></tag2>
</header><DataFromDB xmlns="<u">'’DataFromDB xmlns"http://www.example.com/bla1" , xmlns:xsi = "http://www.example2/bla2"> <o:p></o:p></DataFromDB>
<DataFromDB xmlns="<u">'’series attr1= "1" attr2 = "2"><o:p></o:p>
<row atrr2="2" , attr1="1"></row><ROW atrr2="4" , attr1="3"></ROW><ROW atrr2="6" , attr1="5"></ROW></DataFromDB></root>'’/series><o:p></o:p>
<DataFromDB xmlns="<u">'’series attr1= "1" attr2 = "2"><o:p></o:p>
<row atrr2="2" , attr1="1"></row><ROW atrr2="4" , attr1="3"></ROW><ROW atrr2="6" , attr1="5"></ROW></DataFromDB>'’/series><o:p></o:p>
<DataFromDB xmlns="<u">'’series attr1= "1" attr2 = "2"><o:p></o:p>
<row atrr2="2" , attr1="1"></row><ROW atrr2="4" , attr1="3"></ROW><ROW atrr2="6" , attr1="5"></ROW></DataFromDB>'’/series><o:p></o:p>
'’/DataFromDB><o:p></o:p>
'’/root><o:p></o:p>
So, i have managed to write a vb procedure that creates the exact document, except adding the xmlns and xmlns:xsi atrribuites to the "root" and to "DataFromDB" tags.<o:p></o:p>
I don't know how to do that. <o:p></o:p>
I use Microsoft XML, v5.0.<o:p></o:p>
Could you please help me with this problem?<o:p></o:p>
</root>
 
Upvote 0

Forum statistics

Threads
1,215,730
Messages
6,126,529
Members
449,316
Latest member
sravya

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top