0

JOOX をいじっていると、実際に要素から何らかの値を取得するという概念に苦労しているようです。

次の XML を検討してください。

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header/>
    <SOAP-ENV:Body>
        <gwm:getAddressBookListResponse xmlns:gwm="http://schemas.novell.com/2005/01/GroupWise/methods" xmlns:gwt="http://schemas.novell.com/2005/01/GroupWise/types" xmlns:gwe="http://schemas.novell.com/2005/01/GroupWise/events">
            <gwm:books>
                <gwt:book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="gwt:AddressBook">
                    <gwt:id>584FB626.hbo.abp_poa1.104.16E3363.1.1.1@53</gwt:id>
                    <gwt:sid>1</gwt:sid>
                    <gwt:name>Contacts1</gwt:name>
                    <gwt:version>3</gwt:version>
                    <gwt:modified>2016-12-13T07:49:42Z</gwt:modified>
                    <gwt:isPersonal>1</gwt:isPersonal>
                    <gwt:isFrequentContacts>1</gwt:isFrequentContacts>
                </gwt:book>
                <gwt:book>
                    <gwt:id>GroupWiseSystemAddressBook@52</gwt:id>
                    <gwt:name>Contacts2</gwt:name>
                    <gwt:isPersonal>0</gwt:isPersonal>
                    <gwt:isFrequentContacts>0</gwt:isFrequentContacts>
                </gwt:book>
                <gwt:book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="gwt:AddressBook">
                    <gwt:id>584FB626.hbo.haporo_poa1.104.16E3363.1.3.1@53</gwt:id>
                    <gwt:sid>3</gwt:sid>
                    <gwt:name>Contacts3</gwt:name>
                    <gwt:version>3</gwt:version>
                    <gwt:modified>2016-12-13T07:49:42Z</gwt:modified>
                    <gwt:isPersonal>1</gwt:isPersonal>
                    <gwt:isFrequentContacts>0</gwt:isFrequentContacts>
                </gwt:book>
                <gwt:book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="gwt:AddressBook">
                    <gwt:id>584FB629.hbo.haporo_poa1.104.16E3363.1.5.1@53</gwt:id>
                    <gwt:sid>5</gwt:sid>
                    <gwt:name>Contacts4</gwt:name>
                    <gwt:version>2</gwt:version>
                    <gwt:modified>2016-12-13T07:49:45Z</gwt:modified>
                    <gwt:description>Bazinga !</gwt:description>
                    <gwt:isPersonal>1</gwt:isPersonal>
                    <gwt:isFrequentContacts>0</gwt:isFrequentContacts>
                </gwt:book>
            </gwm:books>
            <gwm:status>
                <gwt:code>0</gwt:code>
            </gwm:status>
        </gwm:getAddressBookListResponse>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

gwt:id 要素、またはその値に興味があります。したがって:

$(document).find("book").find("id").forEach(element -> {
        element... // now what?
    });

element.getValue() のようなものはなく、 toString() は要素名と値を出力するので機能しませんが、私は値だけに興味があります。さらに、getNodeValue() は null を返します

私が求めている要素の値を取得する方法 (例: 584FB629.hbo.haporo_poa1.104.16E3363.1.5.1@53 )

4

1 に答える 1