none
XML Data Island inside HTML/XHTML Architecture

    Question

  • Please see question below. Any answers would be greatly appreciated. Thanks in advance.

    I have a program in Visual Basic. I want to output a log file from my XML data. I would like the final log file to be in the format of XHTML or HTML for portability.

    The HTML would be contain the following XML structure as a data island. When HTML processes a <ObjectRef> it will go find the corresponding <Object> data. It will then pull a remotely located (www.mywebsite.com) VB user control into the web page and fill out the data.

    XML Structure

    <Root>

    <Reports>

    <ReportA>

    <ObjectRef>Object1</ObjectRef>

    <ReportA>

    <ReportB>

    <ObjectRef>Object1</ObjectRef>

    <ObjectRef>Object2</ObjectRef>

    <ReportB>

    </Report>

    <ObjectData>

    <Object1>

    </Object1>

    <Object2>

    <Object2>

    </ObjectData>

    </Root>

    First Level Requirements:

    1. Portability

    2. Must be able to Extract XML Data back out of HTML

    Second Level Requirements:

    1. Dynamic Update: Update as I add data (nodes) to the XML file.

    Questions:

    1. Is this architecture possible?

    2. How big is this task? I admit I know little about web pages. I would think I create one HTML template and fill in the data for each report. The data is currently formatted thru a TextBox control.

    3. How hard is it to extract data back out of the HTML.

    4. Any pointers to information: Books, References, Samples

    Thanks Again,

    Bill

    Wednesday, September 13, 2006 9:34 PM

Answers

  • I'd suggest write your log as XML (not as HTML). Because you need to append to the log it will be better structure it as XML fragment comparing to XML document. Fragment doesn't have XML decl (<?xml ?>) but allows multiple top level elements. Your program would be able to append records one by one to the end of the log file.

    You can always convert fragment to document by adding wrapping top level element -- like <root> at the beginning of the file and </root> at the end. You can run XSLT to transform log to HTML, XHTML or other XML.

    This is quite simple task.

    Extracting data from HTML is not a pleasant experience.

    There are plenty of books about XML You would be able to do your job without any of them. On XSLT I'd recommend you the famous book of famous Michael Kay: (http://www.amazon.com/XSLT-Programmers-Reference-Programmer/dp/0764543814/sr=1-5/qid=1159231694/ref=sr_1_5/104-7939400-9646307?ie=UTF8&s=books).

    Tuesday, September 26, 2006 12:50 AM

All replies

  • I'd suggest write your log as XML (not as HTML). Because you need to append to the log it will be better structure it as XML fragment comparing to XML document. Fragment doesn't have XML decl (<?xml ?>) but allows multiple top level elements. Your program would be able to append records one by one to the end of the log file.

    You can always convert fragment to document by adding wrapping top level element -- like <root> at the beginning of the file and </root> at the end. You can run XSLT to transform log to HTML, XHTML or other XML.

    This is quite simple task.

    Extracting data from HTML is not a pleasant experience.

    There are plenty of books about XML You would be able to do your job without any of them. On XSLT I'd recommend you the famous book of famous Michael Kay: (http://www.amazon.com/XSLT-Programmers-Reference-Programmer/dp/0764543814/sr=1-5/qid=1159231694/ref=sr_1_5/104-7939400-9646307?ie=UTF8&s=books).

    Tuesday, September 26, 2006 12:50 AM
  • Sergey,

    Thanks for the feedback and book link.

    I have not started on any coding for this part of the project as of yet. I am still open to ideas.

    What would the physical process be for the user to tranform the XML to HTML or XHTML using XSLT? Would they have to access a web page to open and translate the XML file? Is there something (pointer) I can place in the XML?

    My understanding of XML is that it is always static. A user could not simply click on the file and have it translate.

    I do not have to append to the log file. Once a log is created it is a seperate entity and would not change.

    I am leaning towards XHTML. It is 'well formed' XML and I would be able to have a schema (additions to my current schema). This would provide me with a tool to extract data out. I also believe it will provide me with a script mechanism to point to the XSLT files and addtional HTML files and controls on the web.

    This is still outside of my grasp, but I believe it is possible. The user would physically click on the XHTML file. The XHTML would run a script obtaining the XSLT. The XSLT would translate the Log XML Data (contained in the XHTML) into the presented HTML.

    Bill
    Tuesday, September 26, 2006 7:45 PM