 |
Changeset 3304
- Timestamp:
- 02/27/08 12:52:56
(9 months ago)
- Author:
- kris
- Message:
removed string(), and made value() scan element data-subordinates instead
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r3303 |
r3304 |
|
| 12 | 12 | |
|---|
| 13 | 13 | package import tango.text.xml.PullParser; |
|---|
| | 14 | |
|---|
| | 15 | version=discrete; |
|---|
| 14 | 16 | |
|---|
| 15 | 17 | /******************************************************************************* |
|---|
| … | … | |
| 485 | 487 | /*************************************************************** |
|---|
| 486 | 488 | |
|---|
| 487 | | Return the raw data content, which may be null |
|---|
| | 489 | Return the data content, which may be null |
|---|
| 488 | 490 | |
|---|
| 489 | 491 | ***************************************************************/ |
|---|
| … | … | |
| 491 | 493 | T[] value () |
|---|
| 492 | 494 | { |
|---|
| | 495 | version(discrete) |
|---|
| | 496 | { |
|---|
| | 497 | if (type is XmlNodeType.Element) |
|---|
| | 498 | foreach (child; children) |
|---|
| | 499 | if (child.type is XmlNodeType.Data) |
|---|
| | 500 | return child.rawValue; |
|---|
| | 501 | } |
|---|
| 493 | 502 | return rawValue; |
|---|
| 494 | 503 | } |
|---|
| … | … | |
| 503 | 512 | { |
|---|
| 504 | 513 | rawValue = val; |
|---|
| 505 | | } |
|---|
| 506 | | |
|---|
| 507 | | /*************************************************************** |
|---|
| 508 | | |
|---|
| 509 | | Return the 'string' of this node, which is raw |
|---|
| 510 | | content for most nodes, and local name for elements |
|---|
| 511 | | |
|---|
| 512 | | ***************************************************************/ |
|---|
| 513 | | |
|---|
| 514 | | T[] string () |
|---|
| 515 | | { |
|---|
| 516 | | auto m = rawValue; |
|---|
| 517 | | if (type is XmlNodeType.Element) |
|---|
| 518 | | m = localName; |
|---|
| 519 | | return m; |
|---|
| 520 | 514 | } |
|---|
| 521 | 515 | |
|---|
| … | … | |
| 579 | 573 | auto node = create (XmlNodeType.Element, null); |
|---|
| 580 | 574 | append (node.set (prefix, local)); |
|---|
| | 575 | version(discrete) |
|---|
| | 576 | { |
|---|
| 581 | 577 | if (value.length) |
|---|
| 582 | | node.append (create(XmlNodeType.Data, value)); |
|---|
| | 578 | node.data (value); |
|---|
| | 579 | } |
|---|
| | 580 | else |
|---|
| | 581 | { |
|---|
| | 582 | node.rawValue = value; |
|---|
| | 583 | } |
|---|
| 583 | 584 | return node; |
|---|
| 584 | 585 | } |
|---|
| … | … | |
| 747 | 748 | /*************************************************************** |
|---|
| 748 | 749 | |
|---|
| 749 | | Return a set containing all data nodes of the |
|---|
| 750 | | nodes within this set, which match the optional |
|---|
| 751 | | value |
|---|
| | 750 | Sweep the data nodes looking for match |
|---|
| | 751 | |
|---|
| | 752 | Returns a matching node, or null. |
|---|
| 752 | 753 | |
|---|
| 753 | 754 | ***************************************************************/ |
|---|
| … | … | |
| 765 | 766 | /*************************************************************** |
|---|
| 766 | 767 | |
|---|
| 767 | | Return a set containing all data nodes of the |
|---|
| 768 | | nodes within this set, which match the optional |
|---|
| 769 | | value |
|---|
| | 768 | Sweep the data nodes looking for match |
|---|
| | 769 | |
|---|
| | 770 | Returns true if found. |
|---|
| 770 | 771 | |
|---|
| 771 | 772 | ***************************************************************/ |
|---|
| … | … | |
| 778 | 779 | /*************************************************************** |
|---|
| 779 | 780 | |
|---|
| 780 | | Sweep the text nodes looking for match |
|---|
| 781 | | |
|---|
| 782 | | Returns a matching node, or null. |
|---|
| | 781 | Sweep the data nodes looking for match |
|---|
| | 782 | |
|---|
| | 783 | Returns true if found. |
|---|
| 783 | 784 | |
|---|
| 784 | 785 | ***************************************************************/ |
|---|
Download in other formats:
|
 |
 |
|
 |
Copyright © 2006-2008 Tango. All Rights Reserved. | Page Width:
Static or
Dynamic