XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old July 25th, 2003, 08:43 AM
Wolfgar Wolfgar is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 13 Wolfgar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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?

Reply With Quote
  #2  
Old July 27th, 2003, 10:19 AM
Wizard2003's Avatar
Wizard2003 Wizard2003 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 206 Wizard2003 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 29 m 24 sec
Reputation Power: 6
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)?

Reply With Quote
  #3  
Old July 27th, 2003, 01:46 PM
Wizard2003's Avatar
Wizard2003 Wizard2003 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 206 Wizard2003 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 29 m 24 sec
Reputation Power: 6
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?!

Reply With Quote
  #4  
Old July 27th, 2003, 01:48 PM
Wizard2003's Avatar
Wizard2003 Wizard2003 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 206 Wizard2003 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 29 m 24 sec
Reputation Power: 6
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"

Reply With Quote
  #5  
Old September 8th, 2003, 07:33 AM
Yoche Yoche is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 1 Yoche User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Re: What is "#text"?

Quote:
Originally posted by Wolfgar
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.


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?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > What is "#text"?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

IBM developerWorks




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway