Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Changeset 3304

Show
Ignore:
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
  • trunk/tango/text/xml/Document.d

    r3303 r3304  
    1212 
    1313package import tango.text.xml.PullParser; 
     14 
     15version=discrete; 
    1416 
    1517/******************************************************************************* 
     
    485487                /*************************************************************** 
    486488                 
    487                         Return the raw data content, which may be null 
     489                        Return the data content, which may be null 
    488490 
    489491                ***************************************************************/ 
     
    491493                T[] value () 
    492494                { 
     495version(discrete) 
     496{ 
     497                        if (type is XmlNodeType.Element) 
     498                            foreach (child; children) 
     499                                     if (child.type is XmlNodeType.Data) 
     500                                         return child.rawValue; 
     501} 
    493502                        return rawValue; 
    494503                } 
     
    503512                { 
    504513                        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; 
    520514                } 
    521515                 
     
    579573                        auto node = create (XmlNodeType.Element, null); 
    580574                        append (node.set (prefix, local)); 
     575version(discrete) 
     576{ 
    581577                        if (value.length) 
    582                             node.append (create(XmlNodeType.Data, value)); 
     578                            node.data (value); 
     579
     580else 
     581
     582                        node.rawValue = value; 
     583
    583584                        return node; 
    584585                } 
     
    747748                /*************************************************************** 
    748749         
    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. 
    752753 
    753754                ***************************************************************/ 
     
    765766                /*************************************************************** 
    766767         
    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. 
    770771 
    771772                ***************************************************************/ 
     
    778779                /*************************************************************** 
    779780                 
    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
    783784 
    784785                ***************************************************************/