Geekpedia Programming Tutorials






Newbie: Creating New Tags - No CRLF After Tag

On Tuesday, August 18th 2009 at 05:35 PM
By vbDavidC
Hello,

I am wanting to know when you code with MSXML and you create new tags do you
get CRLFs after each tag.

I am very new to XML files. Someone sent me an XML file to populate. I am
using MSXML v3.0 (although I could go up to 6.0). Anyway the XML file is
very straightforward and I have been able to read certain values then write
values for existing tags.

One requirement is that I may need to create new tags/nodes.

In the XML file I have the following entries:

<no_of_attachments>
<no_of_iterations>1</tpc:no_of_iterations>
<file_name>-</tpc:file_name>
<no_of_attachments>

If <no_of_iteration> >1 then I need to create an additional <file_name> tag.
I got it to work with the following code:

Set newNode = xmlDoc.createNode(1, "newChild", "")
currNode.appendChild newNode
newNode.Text = "abc.txt"

However, if I look at my code using Notepad++ after the new tag there is not
a CRLF before the next tag <no_of_attachments>. However, if I look at it
with IE7 it looks fine. All the other tags have a CRLF at the end of the
line and I would want to be consistent. I found someone on some forum who
basically asked a similar question and it seemed like most responses were
that this was normal. There was no way to specify a 'CRLF' as an option.
Latest Tech Bargains

Advertisement

Free Magazine Subscriptions

Today's Pictures

Today's Video

Other Resources

Latest Download

Latest Icons