尝试从页面获取联系人详细信息,但是当我运行我的脚本时,它只抓取每个类别的第一部分而忽略其余部分因为某些br标记,因为在联系人详细信息类别中它只抓取名称而不是电话号码或传真。希望有人能给我任何想法,我怎么能得到它?这是我尝试过的:
Sub RestData()
Dim http As New MSXML2.XMLHTTP60
Dim html As New HTMLDocument
Dim ele As Object, post As Object
With CreateObject("MSXML2.serverXMLHTTP")
.Open "GET", "http://www.austrade.gov.au/SupplierDetails.aspx?ORGID=ORG0120000508&folderid=1736", False
.send
html.body.innerHTML = .responseText
End With
Set ele = html.getElementsByClassName("contact-details block dark")(0).getElementsByTagName("p")
For Each post In ele
x = x + 1
Cells(x, 1) = post.innerText
Next post
Set html = Nothing: Set ele = Nothing: Set docs = Nothing
End Sub
Html元素:
<p>Company Name: Vaucraft Braford Stud<br>Phone: +61 7 4942 4859<br>Fax: +61 7 4942 0618<br>Email: <a href="mailto:florfamily1@bigpond.com">florfamily1@bigpond.com</a><br>Web: <a target="_blank" href="http://www.vaucraftbrafords.com.au">http://www.vaucraftbrafords.com.au</a></p>
答案 0 :(得分:1)
您可以尝试这样的事情......
DatabaseReference users = mDatabase.child("received");
// DatabaseReference receiver = users.child(firebaseUser.getUid());
final DatabaseReference receiver =
users.child("GTjrWgpKjoeXUt4JdBJTYP1JkVT2");
receiver.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for (DataSnapshot postSnapshot : dataSnapshot.getChildren()) {
Log.d(TAG, "key count=" + postSnapshot.getKey());
for (DataSnapshot sender: postSnapshot.getChildren()) {
Log.d(TAG, "sender key count=" + sender.getKey());
}
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
Log.e("SHAN " ,databaseError.getMessage());
}
});