Results 1 to 3 of 3

Thread: DomQuery selector using one of the its children nodeValue

  1. #1
    Sencha Premium Member glopes's Avatar
    Join Date
    Jan 2013
    Location
    Chicago
    Posts
    123
    Answers
    16
    Vote Rating
    30
      0  

    Default Answered: DomQuery selector using one of the its children nodeValue

    Hi,

    I have a XML document called myXml that looks like this:
    Code:
    <Row>
        <Proto>TCP</Proto>
        <Date>2013-05-22T00:00:00</Date>
        <Value>10</Value>
    </Row>
    <Row>
        <Proto>UDP</Proto>
        <Date>2013-05-22T00:00:00</Date>
        <Value>5</Value>
    </Row>
    <Row>
        <Proto>TCP</Proto>
        <Date>2013-05-21T00:00:00</Date>
        <Value>12</Value>
    </Row>
    <Row>
        <Proto>UDP</Proto>
        <Date>2013-05-21T00:00:00</Date>
        <Value>5</Value>
    </Row>
    I want to know if there is a way to use Ext.DomQuery.select to get all the Rows where Proto=UDP.
    What I've managed so far is to get the value of one sibling using:
    Code:
    var myValues = Ext.DomQuery.select('Proto:nodeValue(UDP) ~ Value', myXml);
    var myDates = Ext.DomQuery.select('Proto:nodeValue(UDP) ~ Date', myXml);
    What I really need is to select all Rows where Proto = UDP.

    Thanks

  2. This what you're looking for?
    Code:
    var selected = Ext.dom.Query.select('Row:has(Proto:nodeValue(UDP))');
    console.log(selected);

  3. #2
    Sencha - Documentation Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    6,162
    Answers
    501
    Vote Rating
    257
      0  

    Default

    This what you're looking for?
    Code:
    var selected = Ext.dom.Query.select('Row:has(Proto:nodeValue(UDP))');
    console.log(selected);
    Are you a Sencha products veteran who has wondered what it might be like to work at Sencha? If so, please reach out to our human resources manager: fabienne.bell@sencha.com

  4. #3
    Sencha Premium Member glopes's Avatar
    Join Date
    Jan 2013
    Location
    Chicago
    Posts
    123
    Answers
    16
    Vote Rating
    30
      0  

    Default

    Perfect, thanks.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •