f



Newbie question : Xerces (C++) How do I create the <?xml version="1.0" encoding="UTF-8" ?> header

I have created a XML Writer program, and everything works, but I need to
revice my code and add this "version and encoding" header for completeness
and correctness... I am completely stuck!

I have done this so far:

DOM_Element root = xmlDoc.getRootElement();
root.setAttributes ("xmlns","etc.etc.");

Do I have to previous root called "?" - but this doesn't make much sense as
the tag begins "<?xml" and ends "?>"

From scouring the web, I believe that I coding with a legacy version of
xerces-c. (hence DOM_Element)
I cannot change or update the library

Please can I have a snippet of code?

Thanks a lot!



0
nose_pam (2)
5/14/2004 9:04:17 AM
comp.text.xml 8781 articles. 0 followers. Post Follow

2 Replies
833 Views

Similar Articles

[PageSpeed] 48

I hope this reads a bit nicer:  Hands moving quicker than brain(!)

 I have created a XML Writer program, and everything works, but I need to
revise my code and add this "version and encoding" header for completeness
and correctness... I am completely stuck!

 I have done this so far:

 DOM_Element root = xmlDoc.getRootElement();
root.setAttributes ("xmlns","etc.etc.");

Do I have to create another previous root called "?" - but this doesn't make
much sense as the tag begins "<?xml" and ends "?>"

From scouring the web, I believe that I coding with a legacy version of
xerces-c. (hence DOM_Element): I cannot change or update the library

Please can I have a snippet of code?

Thanks a lot!



0
nose_pam (2)
5/14/2004 9:30:49 AM
In article <c8225m$nat$1@rdel.co.uk>,
mel-tey chamon! <nose_pam@nose_pam.com> wrote:

% I have created a XML Writer program, and everything works, but I need to
% revice my code and add this "version and encoding" header for completeness
% and correctness... I am completely stuck!

This is called the XML declaration. It's not an element. There should
be an attribute on the document class which says whether to write the
XML declaration, though.

-- 

Patrick TJ McPhee
East York  Canada
ptjm@interlog.com
0
ptjm (515)
5/16/2004 2:34:02 AM
Reply: