![]() |
![]() |
|
|||||||
| Register | Forum Rules | Getting Started! - Guide | Blog | Videos | Gallery | Members List | Social Groups | Mark Forums Read |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
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 |
|
|
|
#2 |
|
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 |
|
|
|
#3 |
|
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 |
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
< Home - Windows Help - MS Office Help - Hardware Support >
| New To Site? | Need Help? |