|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
What is "#text"?
When I do "num-children" of root element, I get an answer of "3" when there is only 1.
Children numbers 1 and 3 are displayed as "#text". It seems that the children that are in the file are on even numbers only. Can someone explain this? |
|
#2
|
||||
|
||||
|
Can you please concretise your problem?
How does the xml structure looks like what is "num-children" (guess it returns the numbers of a node, but which programm/processor)? |
|
#3
|
||||
|
||||
|
In XPath every node has a corresponding object in the xml file except the root node.
There are the following node types: - root node (root) - Processing instructions (proc) - comments (comm) - elements (elem) - namespace-attributes (name) - attributes (atts) - text If you have an xml file like: Code:
<?xml version="1.0" encoding="UTF-8"?> <my:bla xmlns:my="http://anurl.com"> some text </bla> the bla tag does not represent the root. The tree structure would look like this: 1 (root) "some text" | 2--(elem) http://anurl.com:bla "some text" | 3--(name) my "http://anurl.com" | 4--(attr) http://anurl.com | 5--(text) "some text" How you can see there are three childs, perhaps that is what you meant?! |
|
#4
|
||||
|
||||
|
now with indentation...
Code:
1 (root) "some text" | 2--(elem) http://anurl.com:bla "some text" | 3--(name) my "http://anurl.com" | 4--(attr) http://anurl.com | 5--(text) "some text" |
|
#5
|
|||
|
|||
|
Re: What is "#text"?
Quote:
These #text-nodes are the WhiteSpaces between your tags which result in text-nodes! So you either have to edit your xml-file and delete all the whitespaces between your tags (new-line as well!) or you edit your code so that text-nodes are ignored. I heard there were some way to tell the parser to ignore whitespaces ... Anybody knows how? |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > What is "#text"? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|