...

searching xml

drn
12-21-2002, 03:17 PM
can someone please show me or link to an example where a user can search a xml doc/docs through either xsl, javascript, asp (which ever is best) and press submit where all matching strings are displayed and only those that match

hope i havent over complicated the question

thnx drn

brothercake
12-21-2002, 10:01 PM
Check out http://www.mori.com/pubinfo/articles.phtml?cat=all which is a searchable XML doc processed with PHP SAX (http://www.php.net/manual/en/ref.xml.php)

I wouldn't say that's necessarily the best way; but it's a way. As it goes, I'm quite proud of that :) I can provide source code for interest.

drn
12-22-2002, 10:36 AM
i'm interested:thumbsup:

drn
12-22-2002, 10:41 AM
and thank you for the links

brothercake
12-23-2002, 02:26 PM
Okay - with SAX you name three functions to process open tags, close tags, and tag data:

The three functions I define are called "processOpenTag", "processCloseTag" and "processTagData" - processOpenTag reads attributes from the tags, and decide whether to include the data in an array (which happens at processTagData), based on input criteria from a q str. Once that's done, the array can be sorted etc. and finally output as HTML, using normal php methods.

This is a categories matrix, which is used to compare the q str values against:



$categories = array(
"p" => array(
"cat" => "Politics",
"sub" => array(
"p" => "Politicans, Parties and Elections",
"c" => "Constitution",
"u" => "Europe",
"l" => "Law and Order",
"e" => "Environment",
"g01" => "General Election 2001",
"g97" => "General Election 1997"
)
),
"b" => array(
"cat" => "Business",
"sub" => array(
"i" => "Business Image",
"r" => "Business and Research",
"b" => "Business",
"h" => "Human Resources",
"f" => "Finance",
"p" => "Privatisation",
"c" => "Consumer",
"e" => "E-Business"
)
),
"s" => array(
"cat" => "Social",
"sub" => array(
"n" => "National Identity",
"i" => "International",
"h" => "Housing and Regeneration",
"f" => "Families, Education and Employment",
"a" => "NHS and Health",
"c" => "Culture",
"m" => "Media",
"l" => "Leisure",
"s" => "Science"
)
),
"m" => array(
"cat" => "Methodology",
"sub" => array(
"r" => "Research Methodology",
"i" => "Impact and Image of Polling",
"p" => "Panels",
"t" => "Technology and Quality"
)
),
"c" => array(
"cat" => "Public Consultation",
"sub" => array(
"s" => "Public Service Consultation",
"a" => "Local Government and Research",
"r" => "Local Government Reform",
"p" => "Local Government and Public Perceptions",
"m" => "Local Government Members and Employees"
)
)
);



And the rest of the script ... I can't post here because it's too long. I put it at http://www.brothercake.com/Ref/articles.phtml.txt (view source to see the code)

drn
12-24-2002, 02:58 AM
I think theres something wrong with the page
http://www.brothercake.com/Ref/articles.phtml.txt

drn
12-24-2002, 03:01 AM
sry you say veiw sorce code to see code, my bad

redhatmatt
05-25-2007, 12:21 AM
the link is bad

redhatmatt
05-29-2007, 10:08 PM
I am so close to fixing a problem... but this is the answer I need. I am trying to go across multiple files etc. Please help!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum