1. #1
    Sencha Premium Member glopes's Avatar
    Join Date
    Jan 2013
    Location
    Chicago
    Posts
    104
    Answers
    12
    Vote Rating
    25
    glopes will become famous soon enough glopes will become famous soon enough

      0  

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

    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 - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    5,357
    Answers
    429
    Vote Rating
    200
    slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of

      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 recruiting manager: sheryl@sencha.com

  4. #3
    Sencha Premium Member glopes's Avatar
    Join Date
    Jan 2013
    Location
    Chicago
    Posts
    104
    Answers
    12
    Vote Rating
    25
    glopes will become famous soon enough glopes will become famous soon enough

      0  

    Default


    Perfect, thanks.

Thread Participants: 1

Tags for this Thread