Text node or no Text node

Text node or no Text node

Post by Norrman Pe » Fri, 09 Mar 2001 02:49:03



Hi,

I have read the XML spec, but cannot find anything
substantial on the following problem. Given this dtd

  <!ELEMENT test (attribute)*>
  <!ELEMENT attribute (value)>
  <!ATTLIST attribute name CDATA #REQUIRED>
  <!ELEMENT value (#PCDATA)>

and this XML

  <?xml version="1.0"?>
  <!DOCTYPE test SYSTEM "test.dtd" >
  <test>
    <attribute name="Temperatue">
      <value>34.0</value>
    </attribute>
    <attribute name="Humidity">
      <value></value>
    </attribute>
  </test>

what should a validating DOM parser produce for the second value
element?
Should the value element contain a Text node with an empty string or
not?
Is the spec open on this point?

I think there should be an "empty" Text node. Xerces does not.

What's your opinion?

regards
   Per Norrman

 
 
 

1. How to change text in text node?

Hello,

I want to make XSLT script(?) that changes text node to another text.
More specifically, I want to add escape sequence as in C string.

For example,
        <msg>You can type "Hi!\nHow are you" to make greetings</msg>
should be changed to
        "You can type \"Hi!\\nnHow are you\" to make greetings"

Is it possible for XSLT to convert such a way? I found that there is
'translate' function in Xpath. But that could not work since 'translate'
just translates a character to character. And I found 'substring-before'
and 'substring-after' function. But I cannot make script to change
such a way.

Thanks in advance.

-Sanori

--

Dept. of Computer Science               |     /\^       Always being
Korea Advanced Inst. of Sci. and Tech.  |    /   \/\            with Network
Taejon, Republic of Korea, 305-701      |   /     \ \   Mountain Duck (Quack)

2. :NTeX vs teTeX

3. parse out text and link text out of same node

4. Suffolk Acorn Risc Club Meetings

5. How can I select text nodes which contain certain text by XPath Pattern?

6. Installation problems on Thinkpad without floppy...

7. Problem getting node children and text without the node tag

8. SPEC News letter

9. Topic: Copy text from one node to other Node

10. Copy text from one node to other Node

11. How to get a parent node of some text node?

12. child nodes include artificial text nodes !!!!

13. Node with text vs node with child element