I have to order and then print out parts of a text. I've tried some expressions and finally became the code that help me, but I think it isn't really good.
I will post a part of the text and then the code that I've made.
<?xml version="1.0"?>
<recipes>
<recipe>
<title>Beef Parmesan with Garlic Angel Hair Pasta</title>
<ingredient name="beef cube steak" amount="1.5" unit="pound"/>
<ingredient name="onion, sliced into thin rings" amount="1"/>
<ingredient name="green bell pepper, sliced in rings" amount="1"/>
<ingredient name="Italian seasoned bread crumbs" amount="1" unit="cup"/>
<ingredient name="grated Parmesan cheese" amount="0.5" unit="cup"/>
<ingredient name="olive oil" amount="2" unit="tablespoon"/>
<ingredient name="spaghetti sauce" amount="1" unit="jar"/>
<ingredient name="shredded mozzarella cheese" amount="0.5" unit="cup"/>
<ingredient name="angel hair pasta" amount="12" unit="ounce"/>
<ingredient name="minced garlic" amount="2" unit="teaspoon"/>
<ingredient name="butter" amount="0.25" unit="cup"/>
<preparation>
<step>
Preheat oven to 350 degrees F (175 degrees C).
</step>
<step>
Cut cube steak into serving size pieces. Coat meat with the bread crumbs
and parmesan cheese. Heat olive oil in a large frying pan, and saute 1
teaspoon of the garlic for 3 minutes. Quick fry (brown quickly on both sides)
meat. Place meat in a casserole baking dish, slightly overlapping edges.
Place onion rings and peppers on top of meat, and pour marinara sauce
over all.
</step>
<step>
Bake at 350 degrees F (175 degrees C) for 30 to 45 minutes, depending on
the thickness of the meat. Sprinkle mozzarella over meat and leave in the
oven till bubbly.
</step>
<step>
Boil pasta al dente. Drain, and toss in butter and 1 teaspoon garlic. For a
stronger garlic taste, season with garlic powder. Top with grated parmesan
and parsley for color. Serve meat and sauce atop a mound of pasta!
</step>
</preparation>
<comment>
Make the meat ahead of time, and refrigerate over night, the acid in the
tomato sauce will tenderize the meat even more. If you do this, save the
mozzarella till the last minute.
</comment>
<nutrition calories="1167" fat="23" carbohydrates="45" protein="32"/>
</recipe>
<recipe>
<title>Ricotta Pie</title>
<ingredient name="filling">
<ingredient name="ricotta cheese" amount="3" unit="pound"/>
<ingredient name="eggs" amount="12"/>
<ingredient name="white sugar" amount="2" unit="cup"/>
<ingredient name="vanilla extract" amount="2" unit="teaspoon"/>
<ingredient name="semisweet chocolate chips" amount="0.25" unit="cup"/>
<preparation>
<step>
Beat the 12 eggs, 2 cups sugar and vanilla extract together. Stir in
the ricotta cheese and the chocolate chips. Set aside.
</step>
</preparation>
</ingredient>
<ingredient name="dough">
<ingredient name="flour" amount="4" unit="cup"/>
<ingredient name="baking powder" amount="5" unit="teaspoon"/>
<ingredient name="white sugar" amount="1" unit="cup"/>
<ingredient name="shortening" amount="0.5" unit="cup"/>
<ingredient name="eggs, lightly beaten" amount="4"/>
<ingredient name="vanilla extract" amount="1" unit="teaspoon"/>
<preparation>
<step>
Combine the flour, baking powder, and 1 cup of the sugar together. Cut in the
shortening and mix until the mixture resembles coarse crumbs. Mix in 4 of
the eggs and 1 teaspoon of the vanilla. Divide dough into 4 balls and chill (if
needed).
</step>
</preparation>
</ingredient>
<ingredient name="milk" amount="*"/>
<preparation>
<step>
Preheat oven to 325 degrees F (165 degrees C). Grease two deep dish pie
plates.
</step>
<step>
Roll out 2 of the balls to fit into the pie pans. Do not make the crust too thick
as it will expand during cooking and get too thick. Do not flute the edges of
the dough. Roll out the other 2 balls of dough and cut each into 8 narrow
strips for the top of the crust. Alternately you can use cookie cutters and
place the cutouts on the top of the pies.
</step>
<step>
Pour the filling evenly into the pie crusts. Top each pie with 8 narrow strips
of dough or cookie cut-outs. Brush top of pie with milk for shine. Place foil on
the edge of crust.
</step>
<step>
Bake at 325 degrees F (165 degrees C) for 20 to 30 minutes then remove
foil. Continue to bake for another 25 or 30 minutes or until a knife inserted in
the center comes out clean.
</step>
</preparation>
<nutrition calories="349" fat="18" carbohydrates="64" protein="18"/>
</recipe>
> </recipes>
The code I've made is following
<result>
{
for $x in doc()/recipes/recipe
order by $x/nutrition[#calories>600]
return
($x/title) |($x/nutrition[#calories])
}
</result>
The main idea of XQuery expression is to show the title and the calories ordered by calories in <result> tag.
Your first attempt doesn't look that bad, apart from that the result XML doesn't look very useful. You might want to rewrap each title and nutrition in a recipe element. Secondly, your order clause is likely to not do much. You write:
order by $x/nutrition[#calories>600]
But that way you order by the text contents of the nutrition element, which it doesn't have any. You probably meant:
order by $x/nutrition[#calories>600]/#calories
Or perhaps even better, you want to order numerically on calories:
order by $x/nutrition[#calories>600]/#calories/fn:number(.)
HTH!
It is not quite clear to me what you are trying to achieve exactly. So what does the calories > 600 condition stand for (it does not seem to be of much use in the order by clause, as it will just apply to the ordering condition). I would guess, that you want to filter out all nutrition values with less than 600 calories (your current statement would order everything with more than 600 calories, but the others would still appear in the result).
Also, you did miss to put the #calories attribute as the ordering attribute, which I guess is what you want to achieve.
<result>
{
for $x in doc()/recipes/recipe
return ($x/title,
for $n in $x/nutrition[#calories>600]
order by $n/#calories
return $n
)
}
</result>
Related
I’m in a situation like this:
"Cream Corner" by Lynn
An ice cream cone is a kind of edible thing.
An ice cream cone has a number called scoop count.
Rule for printing the name of an ice cream cone:
say "[the scoop count in words]-scoop ice cream cone".
The Cream Corner is a room.
The player holds an ice cream cone with scoop count 3.
Now I want > eat three-scoop to work. I can do this:
Understand "one-scoop" as an ice cream cone
when the scoop count of the item described is 1.
Understand "two-scoop" as an ice cream cone
when the scoop count of the item described is 2.
Understand "three-scoop" as an ice cream cone
when the scoop count of the item described is 3.
[ ... ]
But of course, ideally, I’d like to write a rule like this:
Understand "[number]-scoop" as an ice cream cone
when the scoop count of the item described is the number understood.
However, the Inform documentation specifies that this is impossible:
So we cannot safely say "when the noun is the fir cone", for instance, or refer to things like "the number understood". (We aren't done understanding yet.) If we want more sophisticated handling of such cases, we need to write checking rules and so on in the usual way.
All the same, it isn’t clear to me how to replace such a rule with a checking rule “in the usual way”. How do I use checking rules to make [number]-scoop in the player’s command be interpreted as “an ice cream cone with that many scoops”?
I'm not quite sure what the documentation is implying we do there, but I can help solve the base problem. A partial solution is these two lines:
Understand the scoop count property as referring to an ice cream cone.
Understand "scoop" as an ice cream cone.
This allows the player to type things like three scoop cone or three ice cream cone, and have the three-scoop cone be understood.
This is only a partial solution, as we don't include the dash*, so something like take three-scoop cone wouldn't be understood correctly. The obvious way of solving this problem is by replacing the dash entirely before the command is read, something like this:
[Nonfunctional solution!]
After reading a command:
If the player's command includes "-scoop":
replace the matched text with " scoop";
This doesn't seem to work however, as the above rule matches only whole words--i.e., three -scoop, but not three-scoop. Attempting to do the same with only replacing - fails similarly.
*You can also argue that three ice cream cone shouldn't be a valid match.
I'd like to have two columns on a slide in R Presentation, with the column-split after a full-width paragraph, but I can only get this:
I want the "Ice Cream" section to take up the full width of the slide, and the "Ben's Ice Cream Palace" and "Jerry's Ice Cream Castle" sections to appear next to each other below that. Changing the level of the section headings doesn't seem to have any effect. Is there a way to do this?
Troubleshooting
========================================================
## Ice Cream
My town has two ice-cream parlours, Ben's Ice Cream Palace and Jerry's Ice Cream Castle. It would be nice to show the two establishments' flavours side-by-side so that we could compare them easily when deciding where to go buy ice cream on a hot sunny day.
### Ben's Ice Cream Palace
- Chocolate
- Vanilla
- Neopolitan
- Rum Raisin
- Butter Pecan
- Mint Chocolate Chip
***
### Jerry's Ice Cream Castle
- Chocolate
- Vanilla
- Strawberry
- Chunky Monkey
- Chocolate Chip Cookie Dough
i received data from a datacenter and i have to cleanse and make data useful and my biggest problem is one column lets call it "service_description" and for example the data center belong to a hair salon, this column is filled manually (text box) and contain huge amount of data (Billions), here is a small sample
service description
washed the haair
hair washed and dried
used shampoo on har
nails manicure
nail paint
nail pant
paint the nails
what i need to do is get each category together by ruining a script that will analyze each line and give it specif category e.g. hair could be the category for the first three lines because it is repeated in all of them while nail is category for the rest, taking in consideration the category word could be misspelled.
results
service description possible categories
washed the haair hair
hair washed and dried hair
used shampoo on har hair
nails manicure nail
nail paint nail
nail pant nail
paint the nails nail
I'm assuming your categories are fixed lookup.
I would split the string by white spaces; and for each part I would go through all items in your categories lookup, and pick the one with minimum levenshtein distance.
Some references:
http://en.wikipedia.org/wiki/Levenshtein_distance
http://www.codeproject.com/Articles/13525/Fast-memory-efficient-Levenshtein-algorithm
I would like to seperate each recipe into its own box but I'm not finding too much on the web as to how to do it. Any help would be great.
<?xml version="1.0" encoding="UTF-8"?>
<!--
WebChef Recipes
Author: Randy White
date: 7/10/2011
Filename: meals.xml
Supporting Files: meals.css
-->
<!DOCTYPE recipes
[
<!ELEMENT recipes (heading,recipe*,name*,description*,ingredients*,ingredient*, instructions*,step*) >
<!ELEMENT recipe (name, description,ingredients*,instructions)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT description (#PCDATA)>
<!ELEMENT ingredients (ingredient*)>
<!ELEMENT ingredient (#PCDATA)>
<!ELEMENT instructions (step*)>
<!ELEMENT step (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
]>
<?xml-stylesheet type="text/css" href="meals.css" ?>
<recipes>
<heading>Chinese Recipes</heading>
<recipe>
<name>Beggar's Chicken</name>
<description>
Beggar's chicken is a traditional dish from Hangzhoui. Legend has
it that the disk was indeed created by beggars.
</description>
<ingredients>
<ingredient>
1 3lb fryer chicken
</ingredient>
<ingredient>
2 teaspoons salt
</ingredient>
<ingredient>
1 teaspoon ginger juice
</ingredient>
<ingredient>
4 tablespoons oil
</ingredient>
<ingredient>
1 chopped scallion
</ingredient>
<ingredient>
4 ounces shredded pork
</ingredient>
<ingredient>
1 tablespoon sherry
</ingredient>
<ingredient>
1 tablespoon light soy sauce
</ingredient>
<ingredient>
1 teaspoon sugar
</ingredient>
<ingredient>
2 ounces preserved Yuanne cabbage, julienne
</ingredient>
<ingredient>
aluminum foil
</ingredient>
</ingredients>
<instructions>
<step>Rub cleaned chicked with salt. Rub ginger juice inside of chicken.
Set aside.
</step>
<step>Heat 2 tablespoons of oil in wok. Stir-fry scallion. Add pork.
Stir on high heat. Add sherry, sauce, and sugar. Remove to bowl.
</step>
<step>Heat 2 tablespoons of oil in wok. Stir-fry cabbage. Pour in
meat mixture. Stir-fry one minute.
</step>
<step>Stuff meat mixture into chicken. Wrap in aluminum foil and place
in pan.
</step>
<step>Back chicken 1 hr at 350 degrees. Turn up heat to 400 degrees
and bake 15 more minutes.
</step>
<step>Remove foil. Remove stuffing from chicken to platter. Cut
chicken into bit-sized pieces. Arrange on top of stuffing.
</step>
</instructions>
</recipe>
<recipe>
<name>Chicken with Chestnuts</name>
<description>
A popular dish from Shanghai, this dish is quick and easy to make.
</description>
<ingredients>
<ingredient>
1 pound chestnuts
</ingredient>
<ingredient>
4 tablespoons oil
</ingredient>
<ingredient>
1 slice ginger, 1/8" thick
</ingredient>
<ingredient>
1 scallion, cut into four pieces
</ingredient>
<ingredient>
1 3lb fryer, cut into 2" pieces
</ingredient>
<ingredient>
2 tablespoons sherry
</ingredient>
<ingredient>
1/2 teaspoon salt
</ingredient>
<ingredient>
1/4 cup dark soy sauce
</ingredient>
<ingredient>
2 cups water
</ingredient>
<ingredient>
1 tablespoon sugar
</ingredient>
</ingredients>
<instructions>
<step>Cut chestnuts into halves. Cover with water. Simmer 30 minutes.
Remove shells and skin. Set aside.
</step>
<step>Heat oil in wok. Stir-fry ginger and scallions 30 seconds. Add
chicken. Stir-fry 1 minute. Add sherry, salt, soy sauce, and
water. Cover and simmer 30 minutes.
</step>
<step>Add chestnuts and sugar. Simmer 10 minutes more.
</step>
<step>Bring to high heat and cook 5 minutes. Remove to platter.
Serve hot.
</step>
</instructions>
</recipe>
<recipe>
<name>Salted Duck</name>
<description>
This dish from Nanking is served cold. It works best on a buffet table.
</description>
<ingredients>
<ingredient>
1 5-lb duck
</ingredient>
<ingredient>
2 tablespoons salt
</ingredient>
<ingredient>
1 tablespoon ginger juice
</ingredient>
<ingredient>
Water
</ingredient>
</ingredients>
<instructions>
<step>Wash and clean duck. Wipe dry.
</step>
<step>Rub duck with salt inside and out. Wrap in foil. Refrigerate
3 days.
</step>
<step>Rub inside of duck with ginger juice.
</step>
<step>Put duck in large saucepan. Cover with water. Bring to boil.
Simmer 2 hours.
</step>
<step>Chill. Chop into bite-sized pieces and serve cold.
</step>
</instructions>
</recipe>
<recipe>
<name>Beef with Onions</name>
<description>
A quick and easy dish from Shanghai. Best served on a bed of rice.
</description>
<ingredients>
<ingredient>
1 lb beef steak, julienne
</ingredient>
<ingredient>
1 teaspoon salt
</ingredient>
<ingredient>
3 egg white
</ingredient>
<ingredient>
3 tablespoons cornstarch
</ingredient>
<ingredient>
4 cups oil for deep-frying
</ingredient>
<ingredient>
4 sliced onions
</ingredient>
<ingredient>
1 tablespoon dry sherry
</ingredient>
<ingredient>
1 tablespoon sugar
</ingredient>
<ingredient>
4 tablespoons dark soy sauce
</ingredient>
</ingredients>
<instructions>
<step>Combine beef, salt, egg white and cornstarch. Mix well.
</step>
<step>Heat oil in wok. Deep-fry beef until seared. Drain.
</step>
<step>Reheat 2 tablespoons of oil in wok. Add onions. Stir-fry
until soft and browned.
</step>
<step>Add beef, sherry, sugar, and soy sauce. Stir-fry 1 minute
until beef is glazed and brown.
</step>
</instructions>
</recipe>
<recipe>
<name>Szechwan Beef</name>
<description>
One of the classic chinese dishes.
</description>
<ingredients>
<ingredient>
1 lb flank steak, shredded
</ingredient>
<ingredient>
1 teaspoon salt
</ingredient>
<ingredient>
2 egg white
</ingredient>
<ingredient>
2 tablespoons cornstarch
</ingredient>
<ingredient>
4 cups oil for deep-frying
</ingredient>
<ingredient>
1/2 cup shredded bamboo shoots.
</ingredient>
<ingredient>
1/2 cup shredded green pepper
</ingredient>
<ingredient>
1 tablespoon dark soy sauce
</ingredient>
<ingredient>
1 teaspoon chili paste with garlic
</ingredient>
<ingredient>
1/2 ounce mung bean
</ingredient>
</ingredients>
<instructions>
<step>Mix beef, salt, egg white, and cornstarch.
</step>
<step>Heat oil in wok. Deep-fry beef 1 minute. Drain. Remove.
</step>
<step>Reheat 2 tablespoons of oil in wok. Stir-fry bamboo shoots
and green pepper 30 seconds. Add beef, soy sauce, chili paste
with garlic, and sugar. Stir-fy 1 minute. Remove.
</step>
<step>Reheat 2 cups of oil in wok to smoking hot. Deep-fry mung bean
1 second. Remove to platter. Pour meat over fried
mung bean.
</step>
</instructions>
</recipe>
<recipe>
<name>Twice-cooked Pork</name>
<description>
This Szechwan dish is extremely popular.
</description>
<ingredients>
<ingredient>
1 lb pork loin
</ingredient>
<ingredient>
2 cups water
</ingredient>
<ingredient>
5 tablespoons oil
</ingredient>
<ingredient>
1 leek, cut into 1" pieces
</ingredient>
<ingredient>
1/2 red pepper, cut into thin strips
</ingredient>
<ingredient>
1/2 green pepper, cut into thin strips
</ingredient>
<ingredient>
1 tablespoon bean sauce
</ingredient>
<ingredient>
1 teaspoon ginger
</ingredient>
<ingredient>
1 tablespoon sherry
</ingredient>
<ingredient>
1 tablespoon dark soy sauce
</ingredient>
<ingredient>
1 tablespoon chili paste with garlic
</ingredient>
<ingredient>
2 gloves minced garlic
</ingredient>
<ingredient>
1 thin slice minced ginger
</ingredient>
<ingredient>
2 scallion, cut into 1" pieces
</ingredient>
</ingredients>
<instructions>
<step>Cook pork in water 20 minutes. Drain and cool.
</step>
<step>Cut pork across grains into paper-thin slices.
</step>
<step>Heat 2 tablesppons of oil in wok. Stir-fry leek until wilted.
Add red and green peppers. Stir-fry 30 seconds. Remove.
</step>
<step>Heat 2 more tablespoons of oil in wok. Add pork. Stir-fry
1 minute. Remove.
</step>
<step>Heat 1 tablespoon oil in wok. Stir-fry bean sauce under
moderate heat. Add sugar. Stir-fry 1 minute. Add pork, leek,
and peppers. Cook over high heat for 1 minute. Add sherry,
soy sauce, and chili paste with garlic. Add garlic and
ginger. Stir-fry thoroughly. Add scallion. Stir fry for
another 30 seconds.
</step>
</instructions>
</recipe>
</recipes>
You need to apply a CSS style to each element just like you would an a or div. See this jsfiddle for an example using your data.
I have the next XML Example and I want to get "listing" data in a R dataframe. What's the best way to do it, ex: How would you configure xmlToDataFrame function to do the job starting with an URL?
<response>
<area_name/>
<bounding_box>
<latitude_max>51.667389</latitude_max>
<latitude_min>51.385262</latitude_min>
<longitude_max>0.137236</longitude_max>
<longitude_min>-0.34844</longitude_min>
</bounding_box>
<country>England</country>
<county>London</county>
<latitude>51.5263255</latitude>
<listing>
<agent_address>218a Brick Lane</agent_address>
<agent_logo/>
<agent_name>Salik & Co</agent_name>
<agent_phone>020 3318 7059</agent_phone>
<country/>
<county>London</county>
<description>
Description:
Salik & Co is offering this Commercial Freehold Property for sale on Wise Road, Stratford, London E15... Premises consists of:
12 X 2 Bedroom Flat AS Following-
* 2x Pent House With One Bath
* 2x Flat With 2 Double Bed With 2 Bath
* 8x Flat With 1 Bath
* 4x Car Park
* 4x floor with ground floor parking
* Lift
* Flat 11 & 13 Pent House with 500 sqft Terrace.
* Flat 12 & Ground Floor shop sold for Long lease. Area Profile:
Stratford is a place in the London Borough of Newham in East London. It will be the primary location of the 2012 Summer Olympics. The area is identified in the London Plan as one of 35 major centres in Greater London. Stratford has been a focus of regeneration for some years, and is the location of a number of major projects.... Property Location:
Set only moments from the vibrant amenities of Stratford, Olympic park, Westfield Shopping centre. This modern 2 bed stunning flat offers contemporary accommodation with a private balcony, in a fabulous new eco building close to the green open spaces of East London
Situated on Stratford High Street the property enjoys swift access into the fashionable bars, restaurants and boutiques of Stratford High Street. Transport links include Stratford (Central line, Jubilee Line and British Rail) which provide further link to district line. Price:
Asking price £2.8 million. For further information contact:
Ryan -
Salik -
Office -
Email -
Web -
</description>
<details_url>http://www.zoopla.co.uk/for-sale/details/4507257</details_url>
<displayable_address>Wise Road, London</displayable_address>
<image_caption/>
<image_url>
http://images.zoopla.co.uk/52367ed1b61a63c1b93f1ec0a70d39f83d590c74_354_255.jpg
</image_url>
<latitude>51.53477</latitude>
<listing_id>4507257</listing_id>
<listing_status>sale</listing_status>
<longitude>-0.0045035</longitude>
<num_bathrooms>0</num_bathrooms>
<num_bedrooms>0</num_bedrooms>
<num_floors>0</num_floors>
<num_recepts>0</num_recepts>
<outcode>E15</outcode>
<post_town>London</post_town>
<price>2800000</price>
<price_change>
<date>2010-04-27 00:42:05</date>
<price>3000000</price>
</price_change>
<price_change>
<date>2010-07-04 03:21:14</date>
<price>2800000</price>
</price_change>
<property_type/>
<street_name>Commercial Property</street_name>
<thumbnail_url>
http://images.zoopla.co.uk/52367ed1b61a63c1b93f1ec0a70d39f83d590c74_80_60.jpg
</thumbnail_url>
</listing>
<listing>
<agent_address>Rawlings House 2a Milner Street</agent_address>
<agent_logo>
http://static.zoopla.co.uk/zoopla_static_agent_logo_(29807).gif
</agent_logo>
<agent_name>Marsh & Parsons</agent_name>
<agent_phone>020 3318 6922</agent_phone>
<country/>
<county>London</county>
<description>
A stunning, three bed mews house with spacious, roof terrace in a popular gated development off Milner Street and ideally located for the nearby amenities of South Kensington and Knightsbridge. A large reception room and a contemporary, open plan kitchen occupy the ground floor, while the first floor houses two double bedrooms and a modern family bathroom. An additional shower room can be found on the second floor which also has a substantial area suitable for a third bedroom and access to the sunny roof terrace. Located in the heart SW3's Brompton area, there is a multitude of local amenities available at Chelsea's popular King's Road and Sloane Street, while the shops, bars and restaurants of Brompton Road and Knightsbridge are easily reached. St. Catherine's Mews is ideally located for the Underground stations at both Sloane Square (Circle and District Lines) and South Kensington (Piccadilly, Circle and District Lines) while such a central location provides a number of convenient bus services. For transport links into and out of London the motorways can be accessed via the nearby A4.The property also has planning permission to extend the 2nd floor to encompass some of the roof terrace that would create greater internal square footage.
</description>
<details_url>http://www.zoopla.co.uk/for-sale/details/491528</details_url>
<displayable_address>St Catherines Mews, London SW3</displayable_address>
<floor_plan>
http://content.zoopla.co.uk/5cb125b77de67eb6717bd8a2c74ba7edb6839959.jpg
</floor_plan>
<image_caption>Picture No.46</image_caption>
<image_url>
http://images.zoopla.co.uk/0867139d8bc2e2aac63056d75bbce1677de438c6_354_255.jpg
</image_url>
<latitude>51.493774</latitude>
<listing_id>491528</listing_id>
<listing_status>sale</listing_status>
<longitude>-0.164762</longitude>
<num_bathrooms>0</num_bathrooms>
<num_bedrooms>2</num_bedrooms>
<num_floors>0</num_floors>
<num_recepts>0</num_recepts>
<outcode>SW3</outcode>
<post_town>London</post_town>
<price>1500000</price>
<price_change>
<date>2009-05-16 01:40:29</date>
<price>1350000</price>
</price_change>
<price_change>
<date>2010-02-20 00:30:24</date>
<price>1450000</price>
</price_change>
<price_change>
<date>2011-02-12 00:31:53</date>
<price>1500000</price>
</price_change>
<property_type>Town house</property_type>
<street_name>London</street_name>
<thumbnail_url>
http://images.zoopla.co.uk/0867139d8bc2e2aac63056d75bbce1677de438c6_80_60.jpg
</thumbnail_url>
</listing>
<listing>
<agent_address>175 Putney High Street, Putney</agent_address>
<agent_logo>
http://static.zoopla.co.uk/zoopla_static_agent_logo_(47723).jpeg
</agent_logo>
<agent_name>Foxtons - Putney</agent_name>
<agent_phone>020 3318 9160</agent_phone>
<country/>
<county>London</county>
<description>
A stunning four bedroomed house offering exceptionally spacious accommodation with stylish interior throughout. The property is arranged over four floors and comprises two good-sized reception rooms, generous 29' kitchen/dining room, four bedrooms (two with en suite), two bathrooms, two shower rooms, utility room, guest cloakroom, attractive garden and off-street parking. Akehurst Street is a quiet residential road located close to the green expanses of Richmond Park, and close to amenities in Roehampton with a greater selection of shops, bars and restaurants within easy reach in Putney. The area is well served by a number of local bus routes, while the nearby A3 provides motorists with a fast route into central London and to the South-West.
</description>
<details_url>http://www.zoopla.co.uk/for-sale/details/14226965</details_url>
<displayable_address>Akehurst Street, London</displayable_address>
<image_caption/>
<image_url>
http://images.zoopla.co.uk/5a24b05bff28865405aee72bcf4c46ae2ce299a4_354_255.jpg
</image_url>
<latitude>51.450905</latitude>
<listing_id>14226965</listing_id>
<listing_status>sale</listing_status>
<longitude>-0.242762</longitude>
<num_bathrooms>0</num_bathrooms>
<num_bedrooms>4</num_bedrooms>
<num_floors>0</num_floors>
<num_recepts>0</num_recepts>
<outcode>SW15</outcode>
<post_town>London</post_town>
<price>1499950</price>
<property_type>Town house</property_type>
<street_name>Akehurst Street</street_name>
<thumbnail_url>
http://images.zoopla.co.uk/5a24b05bff28865405aee72bcf4c46ae2ce299a4_80_60.jpg
</thumbnail_url>
</listing>
<listing>
<agent_address>55 Fulham Broadway, Fulham</agent_address>
<agent_logo>
http://static.zoopla.co.uk/zoopla_static_agent_logo_(47732).jpeg
</agent_logo>
<agent_name>Foxtons - Fulham</agent_name>
<agent_phone>020 3318 6868</agent_phone>
<country/>
<county>London</county>
<description>
Located on a quiet residential street in Fulham, this great four bedroomed house offers spacious accommodation with loft conversion and south-facing flat roof. Arranged over three floors, the property comprises reception room with bay window, dining room, kitchen with space to dine and access to the garden, top floor master bedroom with en suite shower room, large second bedroom, two additional bedrooms, bathroom and outside store room. The property is situated on a tree-lined street, ideally located just moments from the local amenities on both Dawes Road and Lillie Road and is within easy reach of a more a comprehensive range of bars, shops and restaurants on nearby Fulham Broadway. The closest underground station is Fulham Broadway (District Line), providing convenient access to various central and greater London destinations.
</description>
<details_url>http://www.zoopla.co.uk/for-sale/details/14351415</details_url>
<displayable_address>Prothero Road, London</displayable_address>
<image_caption/>
<image_url>
http://images.zoopla.co.uk/a9d983b76018a07537de832224bb5174099c2758_354_255.jpg
</image_url>
<latitude>51.48186</latitude>
<listing_id>14351415</listing_id>
<listing_status>sale</listing_status>
<longitude>-0.208447</longitude>
<num_bathrooms>0</num_bathrooms>
<num_bedrooms>4</num_bedrooms>
<num_floors>0</num_floors>
<num_recepts>0</num_recepts>
<outcode>SW6</outcode>
<post_town>London</post_town>
<price>750000</price>
<property_type>Town house</property_type>
<street_name>Prothero Road</street_name>
<thumbnail_url>
http://images.zoopla.co.uk/a9d983b76018a07537de832224bb5174099c2758_80_60.jpg
</thumbnail_url>
</listing>
<longitude>-0.105602</longitude>
<postcode/>
<result_count>76494</result_count>
<street/>
<town/>
</response>
Thank You
Dataframes require that the input data be "rectangular". You clearly do not have such a data arrangement. R's list data type is more appropriate to something like this. The other problem appears to be the presence of ampersands, "&", in this file. Given that "&" is an escape character in html, the safer maneuver here would have been to replace "& " with "& ". If you change all of the "&"'s to "and" you can get xmlToList() to read it and create a corresponding list ( but that might damage other files if they had valid HTML buried in them).
The listing data can be extracted by matching 'listing' to the names of the list :
xmlToList(f)[grep("listing", names(xmlToList(f)))]
(You will need to provide an URL.)