如何访问XML数据中的URL

时间:2015-11-20 00:34:38

标签: xml url processing zillow

所以我正在使用Processing来处理类的项目,以访问此处列出的Zillow API调用http://www.zillow.com/howto/api/GetUpdatedPropertyDetails.htm

以下是API代码返回的示例:

 <?xml version="1.0" encoding="utf-8" ?>
    - <UpdatedPropertyDetails:updatedPropertyDetails xsi:schemaLocation="http://www.zillow.com/static/xsd/UpdatedPropertyDetails.xsd /vstatic/e6e5f302965f32ad16114f7a97ba3d89/static/xsd/UpdatedPropertyDetails.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:UpdatedPropertyDetails="http://www.zillow.com/static/xsd/UpdatedPropertyDetails.xsd">
    - <request>
    <zpid>48749425</zpid>
    </request>
    - <message>
    <text>Request successfully processed</text>
    <code>0</code>
    </message>
    - <response>
    <zpid>48749425</zpid>
    - <pageViewCount>
    <currentMonth>172</currentMonth>
    <total>4149</total>
    </pageViewCount>
    - <address>
    <street>2114 Bigelow Ave N</street>
    <zipcode>98109</zipcode>
    <city>Seattle</city>
    <state>WA</state>
    <latitude>47.637924</latitude>
    <longitude>-122.347929</longitude>
    </address>
    - <posting>
    <status>Active</status>
    <agentName>John Blacksmith</agentName>
    <agentProfileUrl>/profile/John.Blacksmith</agentProfileUrl>
    <brokerage>Lake and Company Real Estate</brokerage>
    <type>For sale by agent</type>
    <lastUpdatedDate>2008-06-05 10:28:00.0</lastUpdatedDate>
    <externalUrl>http://mls.lakere.com/srch_mls/detail.php?mode=ag&LN=28097669&t=listings&l=</externalUrl>
    <mls>28097669</mls>
    </posting>
    <price currency="USD">1290000</price>
    - <links>
    **<homeDetails>http://www.zillow.com/HomeDetails.htm?zprop=48749425</homeDetails>**
    <photoGallery>http://www.zillow.com/Gallery.htm?zpid=48749425</photoGallery>
    <homeInfo>http://www.zillow.com/HomeInfo.htm?zprop=48749425</homeInfo>
    </links>
    - <images>
    <count>17</count>
    - <image>
    <url>http://images3.zillow.com/is/image/i0/i0/i64/ISz23uixze1pr7.jpg?op_sharpen=1&qlt=90&size=400,400</url>
    <url>http://images1.zillow.com/is/image/i0/i0/i64/ISz23uj5vihxnn.jpg?op_sharpen=1&qlt=90&size=400,400</url>
    <url>http://images1.zillow.com/is/image/i0/i0/i64/ISz0l5yjj5pajn.jpg?op_sharpen=1&qlt=90&size=400,400</url>
    <url>http://images2.zillow.com/is/image/i0/i0/i64/ISz23ukda6z543.jpg?op_sharpen=1&qlt=90&size=400,400</url>
    <url>http://images1.zillow.com/is/image/i0/i0/i64/ISz0l5xk0loazn.jpg?op_sharpen=1&qlt=90&size=400,400</url>
    </image>
    </images>
    - <editedFacts>
    <useCode>Single family</useCode>
    <bedrooms>4</bedrooms>
    <bathrooms>3.0</bathrooms>
    <finishedSqFt>3470</finishedSqFt>
    <lotSizeSqFt>4680</lotSizeSqFt>
    <yearBuilt>1924</yearBuilt>
    <yearUpdated>2003</yearUpdated>
    <numFloors>2</numFloors>
    <basement>Finished</basement>
    <roof>Composition</roof>
    <view>Water, City, Mountain</view>
    <parkingType>Off-street</parkingType>
    <heatingSources>Gas</heatingSources>
    <heatingSystem>Forced air</heatingSystem>
    <appliances>Dishwasher, Dryer, Freezer, Garbage disposal, Microwave, Range / Oven, Refrigerator, Washer</appliances>
    <floorCovering>Hardwood, Carpet, Tile</floorCovering>
    <rooms>Laundry room, Walk-in closet, Master bath, Office, Dining room, Family room, Breakfast nook</rooms>
    </editedFacts>
    <homeDescription>Bright, spacious, 4 bedroom/3 bath Craftsman, with stunning, expansive views, on one of Queen Anne's finest streets. Views of Lk Union, Lk Washington,the Cascades from Mt. Baker to Mt. Rainier, and the city-from two levels and 2 view decks. Craftsman charm intact: hardwood floors, cove moldings, crystal doorknobs, Batchelder tile fireplace. Huge gourmet eat-in kitchen with slab granite countertops, deluxe master suite, theater-like media room, level rear yard with garden space and covered patio.</homeDescription>
    <neighborhood>Queen Anne</neighborhood>
    <schoolDistrict>Seattle</schoolDistrict>
    <elementarySchool>John Hay</elementarySchool>
    <middleSchool>McClure</middleSchool>
    </response>
    </UpdatedPropertyDetails:updatedPropertyDetails>

我正在尝试获取主页详细信息的原始文本,但api调用会将其作为网址返回</links><links>

<homeDetails>http://www.zillow.com/HomeDetails.htm?zprop=48749425</homeDetails>

以下是其中包含的部分文字的示例:

  

你必须看到这个。所有者在业务中,而且是   装载。广告:STAGES Realty Associates of   Savannah Listing Agent:Dennis Hall我喜欢什么?

     

适合您的大型或成长的完美社区,社区和家庭   家庭。 4间卧室,3间浴室,2600平方英尺。邻里有步行   进入购物,餐饮,健身和医疗保健。邻里   拥有游泳池,游乐场,网球场和修剪整齐的棒球   领域。完美地位于萨凡纳和海恩斯维尔之间。你要走了   要爱这个家提供的所有社区。

无论如何将原始文本放入txt文件中? Zillow不允许刮擦(据称)。我可以手动执行此操作,我想因为我只有大约300个要解析的列表,但如果可能的话,我宁愿避免这种情况。我也是使用XML的新手,所以没有帮助。

0 个答案:

没有答案