xml file format

G

Guest

Hi, All,

I create xml file, when open in notepad (or any text editor), the file
looks like below

<Root> <Table1> <Data1> 10 </Data1> <Data2> 20 </Data2> <Data3> 40 </Data3>
<Table1> </Root>

That means it doesn't show each open and close tag one line. I want the file
look like below

<Root>
<Table1>
<Data1> 10 </Data1>
<Data2> 20 </Data2>
<Data3> 40 </Data3>
<Table1>
</Root>

Can anyone help this out?

Thank you for your time
Martin
 
T

Tim Patrick

Was that a typo in the closing <Table1> tag? You forgot the "/" character.
Also, you need to add in the xml header as the first line.

<?xml version="1.0"?>
 
P

Phill W.

martin1 said:
I create xml file ... the file looks like below

<Root> <Table1> <Data1> 10 </Data1> <Data2> 20 </Data2> <Data3> 40 </Data3>
<Table1> </Root>

I want the file look like below

<Root>
<Table1>
<Data1> 10 </Data1>
<Data2> 20 </Data2>
<Data3> 40 </Data3>
<Table1>
</Root>

Why?

The former is (syntactic errors notwithstanding) perfectly good XML and
any XML reader will happily crunch its way through it.
The presence or absence of whitespace is irrelevant.

There /may/ be some sort of "whitespace" property on the XML object that
will put the line-breaks in, but they /really/ don't matter.

Regards,
Phill W.
 
G

Guest

you are right, the close tag is </Table1>. But when add the header in he
first line, still no line-break, any more advice?

Thaks,
Martin
 
H

Holger Boskugel

Hello Martin,
I create xml file, when open in notepad (or any text editor), the file
looks like below

<Root> <Table1> <Data1> 10 </Data1> <Data2> 20 </Data2> <Data3> 40
<Table1> </Root>

That means it doesn't show each open and close tag one line. I want the file
look like below

<Root>
<Table1>
<Data1> 10 </Data1>
<Data2> 20 </Data2>
<Data3> 40 </Data3>
<Table1>
</Root>

Can anyone help this out?

I don't know why you want separate line, but this job could do a simple
replace
if you have a fixed structure, in the sample above you could do this steps :

a) Replace "<Table" with "{CrLf}<Table"
b) Replace "<Data" with "{CrLf}<Data"
c) Replace "</Table" with "{CrLf}</Table"
d) Replace "</Root" with "{CrLf}</Root"


Regards

Holger
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top