TechTalkz.com Logo Ask the Expert

Go Back   TechTalkz.com Technology & Computer Troubleshooting Forums > Tech Support Archives > Programing Languages > VB.NET

Notices

Tabbing an Xml File

VB.NET


Reply
 
Thread Tools Display Modes
Old 14-12-2007, 09:42 PM   #1
bg_ie@yahoo.com
Guest
 
Posts: n/a
Tabbing an Xml File

Hi,

I'm working in VB6 and I'm processing an xml file which is tabbed as
follows -

<?xml version="1.0"?>
<Barry>
<Meta/>
<Data>
<Block Version="01">
<NODE Name="1" Value="A" Updated="false"/>
<NODE Name="3" Value="B" Updated="false"/>
<NODE Name="8" Value="B" Updated="false"/>
<NODE Name="11" Value="A" Updated="false"/>

I then process this file and I replace the Block Node as follows -

<?xml version="1.0"?>
<Barry>
<Meta/>
<Data>
<Block Version="01">
<NODE Name="1" Value="A" Updated="false"/><NODE Name="3" Value="B"
Updated="false"/><NODE Name="8" Value="B" Updated="false"/><NODE
Name="11" Value="A" Updated="false"/>

As you can see, the NODEs are no longer tabbed as they were
previously...

So the question is, how can I correct this formatting as some of the
file users edit the file in notepad and want it tabbed as before?

This is a quick idea as to how I edit the file currently

Set blockNode = xmlDocument__.selectSingleNode("Barry/Data/Block"
Set nodeList = blockNode.childNodes
Set XmlNode = xmlDocument__.createElement("Block")
Set attrName = xmlDocument__.createAttribute("Name")
attrName.Text = "1"
XmlNode.Attributes.setNamedItem attrName
blockNode.appendChild XmlNode

Thanks for your help,

Barry
  Reply With Quote
Old 14-12-2007, 09:43 PM   #2
Tom Shelton
Guest
 
Posts: n/a
Re: Tabbing an Xml File

On 2007-12-14, bg_ie@yahoo.com <bg_ie@yahoo.com> wrote:
> Hi,
>
> I'm working in VB6 and I'm processing an xml file which is tabbed as
> follows -
>
><?xml version="1.0"?>
><Barry>
> <Meta/>
> <Data>
> <Block Version="01">
> <NODE Name="1" Value="A" Updated="false"/>
> <NODE Name="3" Value="B" Updated="false"/>
> <NODE Name="8" Value="B" Updated="false"/>
> <NODE Name="11" Value="A" Updated="false"/>
>
> I then process this file and I replace the Block Node as follows -
>
><?xml version="1.0"?>
><Barry>
> <Meta/>
> <Data>
> <Block Version="01">
> <NODE Name="1" Value="A" Updated="false"/><NODE Name="3" Value="B"
> Updated="false"/><NODE Name="8" Value="B" Updated="false"/><NODE
> Name="11" Value="A" Updated="false"/>
>
> As you can see, the NODEs are no longer tabbed as they were
> previously...
>
> So the question is, how can I correct this formatting as some of the
> file users edit the file in notepad and want it tabbed as before?
>
> This is a quick idea as to how I edit the file currently
>
> Set blockNode = xmlDocument__.selectSingleNode("Barry/Data/Block"


I believe that the XmlDocument object has an Indent property.... Which
is false by default.

--
Tom Shelton
  Reply With Quote
Old 14-12-2007, 10:22 PM   #3
Tom Shelton
Guest
 
Posts: n/a
Re: Tabbing an Xml File

On 2007-12-14, bg_ie@yahoo.com <bg_ie@yahoo.com> wrote:
> Hi,
>
> I'm working in VB6 and I'm processing an xml file which is tabbed as
> follows -
>
><?xml version="1.0"?>
><Barry>
> <Meta/>
> <Data>
> <Block Version="01">
> <NODE Name="1" Value="A" Updated="false"/>
> <NODE Name="3" Value="B" Updated="false"/>
> <NODE Name="8" Value="B" Updated="false"/>
> <NODE Name="11" Value="A" Updated="false"/>
>
> I then process this file and I replace the Block Node as follows -
>
><?xml version="1.0"?>
><Barry>
> <Meta/>
> <Data>
> <Block Version="01">
> <NODE Name="1" Value="A" Updated="false"/><NODE Name="3" Value="B"
> Updated="false"/><NODE Name="8" Value="B" Updated="false"/><NODE
> Name="11" Value="A" Updated="false"/>
>
> As you can see, the NODEs are no longer tabbed as they were
> previously...
>
> So the question is, how can I correct this formatting as some of the
> file users edit the file in notepad and want it tabbed as before?
>
> This is a quick idea as to how I edit the file currently
>
> Set blockNode = xmlDocument__.selectSingleNode("Barry/Data/Block"


I believe that the XmlDocument object has an Indent property.... Which
is false by default.

--
Tom Shelton
  Reply With Quote
Reply

Thread Tools
Display Modes



< Home - Windows Help - MS Office Help - Hardware Support >


New To Site? Need Help?

All times are GMT +5.5. The time now is 01:06 PM.


vBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO
Copyright © 2005-2010, TechTalkz.com. All Rights Reserved - Privacy Policy
Valid XHTML 1.0 Transitional