I have a complex xml file, which contains stories within a magazine. The
structure of the xml file is as follows:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<magazine>
<story>
<story_id>11223 3</story_id>
<pub_name>Pulee n's Publication</pub_name>
<pub_code>PP</pub_code>
<edition_date>2 0031201</edition_date>
<edition_name ></edition_name>
<section_name ></section_name>
<page_id></page_id>
<headline>My Story Headline</headline>
<subhead>Sub head</subhead>
<byline>Pulee n</byline>
<source></source>
<dateline></dateline>
<storytype></storytype>
<column>Searc h</column>
<company_list ></company_list>
<keyword_list ></keyword_list>
<text><p>In other news....</p><p>second paragraph</p></text>
<photo>
<caption></caption>
<photo_filename >197943-96068.jpg</photo_filename>
<photocredit> </photocredit>
</photo>
<photo>
<caption></caption>
<photo_filename >197943-96069.jpg</photo_filename>
<photocredit> </photocredit>
</photo>
<photo>
<caption></caption>
<photo_filename >197943-96067.jpg</photo_filename>
<photocredit> </photocredit>
</photo>
</story>
</magazine>
So there could be multiple <story>'s for each magazine. Now in the backend,
the data gets stored into an Oracle database. However, the data for the
photo's are stored in a separate table from the actual story. What's the
best way to approach the parsing of the story contents, and building a query
out of it, and then parsing the photo contents and building a query out of
that.
Any ideas are welcome. I've been trying to parse the xml file, however I
cannot think of a quick way of doing this. So I wonder maybe someone out
there, can guide me in the right direction and/or suggest a quick solution. 3 3504
Serialize and Deserialize for persistant storage.
Then play with the object :D Much easier
"Pir8" <pi**@mscorlib. com> wrote in message
news:OM******** ******@TK2MSFTN GP11.phx.gbl... I have a complex xml file, which contains stories within a magazine. The structure of the xml file is as follows:
<?xml version="1.0" encoding="ISO-8859-1" ?> <magazine> <story> <story_id>11223 3</story_id> <pub_name>Pulee n's Publication</pub_name> <pub_code>PP</pub_code> <edition_date>2 0031201</edition_date> <edition_name ></edition_name> <section_name ></section_name> <page_id></page_id> <headline>My Story Headline</headline> <subhead>Sub head</subhead> <byline>Pulee n</byline> <source></source> <dateline></dateline> <storytype></storytype> <column>Searc h</column> <company_list ></company_list> <keyword_list ></keyword_list> <text><p>In other news....</p><p>second paragraph</p></text> <photo> <caption></caption> <photo_filename >197943-96068.jpg</photo_filename> <photocredit> </photocredit> </photo> <photo> <caption></caption> <photo_filename >197943-96069.jpg</photo_filename> <photocredit> </photocredit> </photo> <photo> <caption></caption> <photo_filename >197943-96067.jpg</photo_filename> <photocredit> </photocredit> </photo> </story> </magazine>
So there could be multiple <story>'s for each magazine. Now in the
backend, the data gets stored into an Oracle database. However, the data for the photo's are stored in a separate table from the actual story. What's the best way to approach the parsing of the story contents, and building a
query out of it, and then parsing the photo contents and building a query out of that.
Any ideas are welcome. I've been trying to parse the xml file, however I cannot think of a quick way of doing this. So I wonder maybe someone out there, can guide me in the right direction and/or suggest a quick
solution.
"Pir8" <pi**@mscorlib. com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. .. The main problem that I am concerned with is that within the <text> there might be and will be html tags i.e. <p><strong><a href=""> and so on. I do realize that I could use the node's innerxml property to retrieve this but will there be any other complications in the future?
It *should* work, but it depends on your html. I wouldn't want to throw
non-xhtml html at an xml parser, its just not particularly safe. You might
want to consider wrapping the body of text in a CDATA section. The xml format that I pasted is pretty much the same...There are some
other tags that I did not include, which also will go into a separate table of its own into oracle.
I asked about the format because, personally, I would have used an id
attribute instead of a <story_id> element. My main concern is that, when parsing the <story>, <photo> separately, I need to associate the <story_id> along with the data from the <photo> section, so as to enter it into the database to keep the appropriate relationships for the application that will be using this data.
I will read more about XPath and how it can be helpful. I appreciate your suggestions.
Well, as a very base concept I would probably query the xml document with
XPathNavigator using the xpath query /magazine/story, use the resultant
XPathNodeIterat or to grab each story and use subseqent queries to pull out
the various pieces out. "Daniel O'Connell" <onyxkirx@--NOSPAM--comcast.net> wrote in message news:Od******** ******@TK2MSFTN GP10.phx.gbl... If I may ask, what kind of problems are you having? Serialization is probably not your only answer(it could have flexibility issues). My immediate idea would be to use xpath. At that, is this xml format set in stone? "Pir8" <pi**@mscorlib. com> wrote in message news:OM******** ******@TK2MSFTN GP11.phx.gbl... I have a complex xml file, which contains stories within a magazine.
The structure of the xml file is as follows:
<?xml version="1.0" encoding="ISO-8859-1" ?> <magazine> <story> <story_id>11223 3</story_id> <pub_name>Pulee n's Publication</pub_name> <pub_code>PP</pub_code> <edition_date>2 0031201</edition_date> <edition_name ></edition_name> <section_name ></section_name> <page_id></page_id> <headline>My Story Headline</headline> <subhead>Sub head</subhead> <byline>Pulee n</byline> <source></source> <dateline></dateline> <storytype></storytype> <column>Searc h</column> <company_list ></company_list> <keyword_list ></keyword_list> <text><p>In other news....</p><p>second paragraph</p></text> <photo> <caption></caption> <photo_filename >197943-96068.jpg</photo_filename> <photocredit> </photocredit> </photo> <photo> <caption></caption> <photo_filename >197943-96069.jpg</photo_filename> <photocredit> </photocredit> </photo> <photo> <caption></caption> <photo_filename >197943-96067.jpg</photo_filename> <photocredit> </photocredit> </photo> </story> </magazine>
So there could be multiple <story>'s for each magazine. Now in the backend, the data gets stored into an Oracle database. However, the data for
the photo's are stored in a separate table from the actual story. What's
the best way to approach the parsing of the story contents, and building a query out of it, and then parsing the photo contents and building a query
out of that.
Any ideas are welcome. I've been trying to parse the xml file, however
I cannot think of a quick way of doing this. So I wonder maybe someone
out there, can guide me in the right direction and/or suggest a quick solution.
assuming that the file is valid XML (even with the embedded HTML), you can
easily extract components of the structure using XPath queries, and even
iterate over the structure, pulling out each photo and each item.
The query for story_id is literally: /magazine/story/story_id
--- Nick
"Pir8" <pi**@mscorlib. com> wrote in message
news:OM******** ******@TK2MSFTN GP11.phx.gbl... I have a complex xml file, which contains stories within a magazine. The structure of the xml file is as follows:
<?xml version="1.0" encoding="ISO-8859-1" ?> <magazine> <story> <story_id>11223 3</story_id> <pub_name>Pulee n's Publication</pub_name> <pub_code>PP</pub_code> <edition_date>2 0031201</edition_date> <edition_name ></edition_name> <section_name ></section_name> <page_id></page_id> <headline>My Story Headline</headline> <subhead>Sub head</subhead> <byline>Pulee n</byline> <source></source> <dateline></dateline> <storytype></storytype> <column>Searc h</column> <company_list ></company_list> <keyword_list ></keyword_list> <text><p>In other news....</p><p>second paragraph</p></text> <photo> <caption></caption> <photo_filename >197943-96068.jpg</photo_filename> <photocredit> </photocredit> </photo> <photo> <caption></caption> <photo_filename >197943-96069.jpg</photo_filename> <photocredit> </photocredit> </photo> <photo> <caption></caption> <photo_filename >197943-96067.jpg</photo_filename> <photocredit> </photocredit> </photo> </story> </magazine>
So there could be multiple <story>'s for each magazine. Now in the
backend, the data gets stored into an Oracle database. However, the data for the photo's are stored in a separate table from the actual story. What's the best way to approach the parsing of the story contents, and building a
query out of it, and then parsing the photo contents and building a query out of that.
Any ideas are welcome. I've been trying to parse the xml file, however I cannot think of a quick way of doing this. So I wonder maybe someone out there, can guide me in the right direction and/or suggest a quick
solution. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jean de Largentaye |
last post by:
Hi,
I need to parse a subset of C (a header file), and generate some unit
tests for the functions listed in it. I thus need to parse the code,
then rewrite function calls with wrong parameters. What I call "shaking
the broken tree" :)
I chose to make my UT-generator in Python 2.4. However, I am now
encountering problems in choosing the right parser for the job. I
struggle in choosing between the inappropriate, the out-of-date, the...
|
by: ARK |
last post by:
I am writing a search program in ASP(VBScript). The user can enter keywords
and press submit.
The user can separate the keywords by spaces and/or commas and key words may
contain plain words, single quoted strings (phrases), double quoted strings
(phrases).
For example:
Keywords:
Jack, Jill, Jim, "Timothy Brown", Mary OR
|
by: Sven Neuberg |
last post by:
Hi,
I have been handed the task of updating and maintaining a web
application, written in ASP and Javascript, that takes complex
user inputs in HTML form and submits them to server-side ASP
pages for processing. The problem is, the user inputs can
become very complex, and the way this application was developed,
the inputs are all concatenated into monstrously long strings
of text that are then submited as <hidden> inputs in HTML forms...
|
by: mriedel |
last post by:
I'm using the InstallContext class to parse the command-line arguments of a console application. The arguments are in the form of "-file=myFile.txt -flag", and the InstallContext object gives me what I need through the Parameters and IsParameterTrue properties.
However, I can't find any documentation or code samples that confirm that this is an acceptable use of the InstallContext class. I understand the need to use Regex or some other means...
|
by: Robert Neville |
last post by:
Basically, I want to create a table in html, xml, or xslt; with any
number of regular expressions; a script (Perl or Python) which reads
each table row (regex and replacement); and performs the replacement
on any file name, folder, or text file (e.g. css, php, html). For
example, I often rename my mp3 (files); the folder holding the mp3
files; and replace these renamed values in a playlist/m3u/xml file.
The table should hold clean...
| |
by: davebaty |
last post by:
I'm relatively new to VB programming (VB 2005), and have come across a problem parsing complex text files. Basically I have a file which has lines something like the following:
max_gross_weight = 150000 // (pounds)
empty_weight = 74170 // (pounds)
max_number_of_stations = 50
station_load.0 = "170.0, 41.0, -1.5, 0.0, Pilot" //Weight (lbs),
station_load.1 = ...
|
by: nedelm |
last post by:
My problem's with parsing. I have this (arbitrary, from a file)
string, lets
say:
"Directory: /file{File:/filename(/size) }"
I would like it to behave similar to LaTeX. I parse it, and then I
write it
out for diferent variables, like:
|
by: chixor1 |
last post by:
I have been charged with Parsing the data from many Abstract files, and then inputing this information into a SQL Database.
The file format is rather unusual and certainly not delimited in any reasonable fashion.
I was wondering if anyone would be able to assist or provide an idea of how I may go about parsing this data for insertion.
The plan is to write a small application in VB that will allow me to run through each text file, and then...
|
by: padmagvs |
last post by:
I am working on some code which parses wsdl . I have a complex wsdl which is failing to parse . I have to modify this wsdl for parsing .
wanted to know the complex wsdl i am using is as per standards.
first change done
in schema section i have something defined like this
<xsd:complexType name="CallTermType" abstract="true"/> which is used in later sections as
<xsd:complexType name="EndOfPage">
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |