xmlNodeGetContent引入了换行符

时间:2011-07-01 10:23:31

标签: c libxml2

似乎xmlNodeGetContent引入了换行符,其中不应该有。

这是一个节点转储:

ELEMENT td
  ATTRIBUTE width
    TEXT
      content=100%
  ATTRIBUTE bgcolor
    TEXT
      content=#FFFFFF
  ELEMENT font
    ATTRIBUTE face
      TEXT
        content=Arial,Helvetica
    ELEMENT font
      ATTRIBUTE color
        TEXT
          content=#0000FF
      ELEMENT font
        ATTRIBUTE size
          TEXT
            content=-1
        ELEMENT b
          ELEMENT br
  TEXT
    content= 
  ELEMENT hr
  ELEMENT font
    ATTRIBUTE face
      TEXT
        content=Arial,Helvetica
    ELEMENT font
      ATTRIBUTE color
        TEXT
          content=#0000FF
      ELEMENT font
        ATTRIBUTE size
          TEXT
            content=-1
        ELEMENT b
          TEXT
            content=love
        ELEMENT br
  TEXT
    content= 
  ELEMENT ul
    ELEMENT li
      ELEMENT small
        ELEMENT font
          ATTRIBUTE color
            TEXT
              content=#FF0000
          TEXT
            content=s
        TEXT
          content= iubire 
        ELEMENT font
          ATTRIBUTE color
            TEXT
              content=#FF0000
          TEXT
            content=f
        TEXT
          content=; dragoste 
        ELEMENT font
          ATTRIBUTE color
            TEXT
              content=#FF0000
          TEXT
            content=f
        TEXT
          content=; scump 
        ELEMENT font
          ATTRIBUTE color
            TEXT
              content=#FF0000
          TEXT
            content=m
        TEXT
          content=; 
        ELEMENT font
          ATTRIBUTE color
            TEXT
              content=#0000FF
          TEXT
            content=to be in love with
        TEXT
          content= a fi #C3#AEndr#C4#83gostit de; 
        ELEMENT font
          ATTRIBUTE color
            TEXT
              content=#0000FF
          TEXT
            content=to send one's love
        TEXT
          content= a transmite complimente; 
        ELEMENT font
          ATTRIBUTE color
            TEXT
              content=#0000FF
          TEXT
            content=love affair
        TEXT
          content= amor; 
        ELEMENT font
          ATTRIBUTE color
            TEXT
              content=#0000FF
          TEXT
            content=lovelorn
        TEXT
          content= dezn#C4#83d#C4#83jduit
    TEXT
      content= 
    ELEMENT li
      ELEMENT small
        ELEMENT font
          ATTRIBUTE color
            TEXT
              content=#FF0000
          TEXT
            content=vt
        TEXT
          content= a iubi; a-i pl#C4#83cea
    TEXT
      content=

这是xmlNodeGetContent返回的文本:

  s iubire f; dragoste f; scump
  m; to be in love
  with a fi îndrăgostit de; to send
  one's love a transmite complimente; love affair amor; lovelorn deznădăjduit
  vt a iubi; a-i
  plăcea

正如您所看到的那样,有不存在的换行符。

1 个答案:

答案 0 :(得分:0)

尽管有无益的评论(真的,问题是什么并不明显?),我想分享一下我的解释。

由于HTML Tidy使文档美化的额外行。