473,394 Members | 1,567 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

random xml fragments

dan
Hi,
I've got a quick question here.

Let's say I have this xml
<Books>
<Book>
<Title>XML @ it's finest</Title>
<Cost>$11.00</Cost>
</Book>
<Book>
<Title>Is XML a dead technology</Title>
<Cost>$4.00</Cost>
</Book>
<Book>
<Title>What to do in 2004</Title>
<Cost>$22.00</Cost>
</Book>
<Book>
<Title>Why a penguin?</Title>
<Cost>$15.00</Cost>
</Book>
<Book>
<Title>UNIX Secrets</Title>
<Cost>$9.00</Cost>
</Book>
.... about 20 other "book" nodes go here
</Books>

I am trying to pull out a couple (2-3) random <Book> nodes out of
about 25 <Book> nodes altogether.

I have tried using parse_into_struct() and array_rand() but couldn't
get it to work.

Does anyone have a code sample that will get me started in the right
direction?

Thanks.
Jul 17 '05 #1
0 1556

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Hugh Sparks | last post by:
If I configure and use two different fragment extractors on the same XML document, how can I write xslt template match patterns that distinguish which elements these fragments replaced? Details:...
8
by: jon morgan | last post by:
OK, I'm going to be brave. There is a bug in VS.Net 1.1 that causes random compiler errors. I have raised this issue in posts at least three time in the past couple of months without attracting...
4
by: Oliver Sturm | last post by:
I have an XML file that contains fragments, meaning there's no root element. Node names are in my own "test" namespace. Looks like this: <test:info date="...">Content</test:info> <test:info...
15
by: John Cassidy | last post by:
This has been driving me crazy. I've done basic C in school, but my education is mainly based on object oriented design theory where Java is our tool. For some reason, while helping a friend with a...
4
by: Top Gun | last post by:
If I have a string that is in a constant format of, say 0154321-001, how can I parse this into two fragments: int contractid = 0154321; int contractseq = 001;
1
by: Cybertof | last post by:
Hello, What would be the best way to synchronise 2 big files ? The files have only small modifications (not more than 10Kb changed / added insided). It would a bad choice to transfer 5Mb...
2
by: Gustaf | last post by:
My program is constructing a document from several fragments, which are created on the fly using XSL transformations. I've managed to store the output from each transformation (each fragment) in an...
2
by: Lee Crabtree | last post by:
When reading fragments, it seems like XmlReaders try to read too much. I'm working on a file parser for a new file format, and I've run into a problem. The format has an XML fragment for a header,...
4
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hi... We've got a lot of places in our code where we read relatively small xml user preference blocks. Currently that's creating a new XmlDocument in every spot. I was thinking we might see...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.