Discussion:
Carriage return in IXMLDOMNODE.TEXT
(too old to reply)
Samuel
2003-12-12 16:47:54 UTC
Permalink
i am using msxml2 package. when i create a element node ,
i add Carriage Return (ascii 13) and a New Line (ascii 10)
in the text of the node. after i save it to xml file, i
could c both of them with HEX code. but when i read the
data in through IXMLDOMNODE.TEXT, only NEW LINE(ascii 10)
LEFT, but Carriage Return(ascii 13) gone. could any body
let me know why, and how could i get the Carriage Return
also when i read data out. thanks
Han
2003-12-15 13:45:42 UTC
Permalink
XML saves only LF from CRLF. W3C's decision. CRLF is kind of MS dialect of
new line character. I'll prefer script or something as a remedy for the
problem. Of course better choice I don't know will exist.
Post by Samuel
i am using msxml2 package. when i create a element node ,
i add Carriage Return (ascii 13) and a New Line (ascii 10)
in the text of the node. after i save it to xml file, i
could c both of them with HEX code. but when i read the
data in through IXMLDOMNODE.TEXT, only NEW LINE(ascii 10)
LEFT, but Carriage Return(ascii 13) gone. could any body
let me know why, and how could i get the Carriage Return
also when i read data out. thanks
Robert Rossney
2003-12-15 16:26:10 UTC
Permalink
"Han" <***@kornet.net> wrote in message news:***@TK2MSFTNGP11.phx.gbl...
: XML saves only LF from CRLF. W3C's decision. CRLF is kind of MS dialect of
: new line character. I'll prefer script or something as a remedy for the
: problem. Of course better choice I don't know will exist.

CR/LF is more a BASIC thing than a Microsoft thing. It's a throwback to a
time when there was a carriage to return and lines needed to be fed because
your terminal actually used paper. But no matter.

XML's default whitespace processing is as Han describes. If you need to
preserve whitespace in a DOM document, you can, by setting the
preserveWhitespace property to True.

Bob Rossney
***@well.com

:
: "Samuel" <***@premiumit.com> wrote in message
: news:0b8e01c3c0cf$b0114170$***@phx.gbl...
: > i am using msxml2 package. when i create a element node ,
: > i add Carriage Return (ascii 13) and a New Line (ascii 10)
: > in the text of the node. after i save it to xml file, i
: > could c both of them with HEX code. but when i read the
: > data in through IXMLDOMNODE.TEXT, only NEW LINE(ascii 10)
: > LEFT, but Carriage Return(ascii 13) gone. could any body
: > let me know why, and how could i get the Carriage Return
: > also when i read data out. thanks
:
:
Han
2003-12-16 01:50:30 UTC
Permalink
Hi Robert.
Post by Robert Rossney
: XML saves only LF from CRLF. W3C's decision. CRLF is kind of MS dialect of
: new line character. I'll prefer script or something as a remedy for the
: problem. Of course better choice I don't know will exist.
CR/LF is more a BASIC thing than a Microsoft thing. It's a throwback to a
time when there was a carriage to return and lines needed to be fed because
your terminal actually used paper. But no matter.
Interesting and informative post. I've found more interesting article posted
in 1996. Culture or something. Still I failed to find the use of CR in
operating systems other than Windows.
http://www.google.co.kr/groups?hl=ko&lr=&ie=UTF-8&oe=UTF-8&newwindow=1&selm=Dou3Bt.8FA%40zebra.alphacdc.com&rnum=7
Post by Robert Rossney
XML's default whitespace processing is as Han describes. If you need to
preserve whitespace in a DOM document, you can, by setting the
preserveWhitespace property to True.
With whitespace=true, I still failed to find CR in a node's text property.
Can you be more specific? I tested like the following.

x.preserveWhitespace=true
x.loadxml "<x/>"
x.documentelement.text="a" & chr(13) & chr(10) & "b"
t=x.documentelement.text
msgbox asc(mid(t, 2))

The result is 10 instead of 13.

Loading...