W3C home > Mailing lists > Public > www-dom@w3.org > January to March 1999

Seeking advice on design of XML,DOM,XSchema based application

From: Amit Rekhi <amitr@abinfosys.com>
Date: Fri, 8 Jan 1999 14:52:22 +0530
Message-ID: <011201be3ae8$65d4a150$0c01a8c0@vsnl.net.in>
To: <www-dom@w3.org>
Hello,

I have just completed the design of an XML based application which I have
tried to explain below.
I would be grateful if anyone would provide their comment/criticism on my
approach before I begin my implementation phase.

Given below is the AIM of the application described in 4 points
labelled AIMN (N = 1 to 4).
Intermingled with the AIMs is my design approach labelled
MY DESIGN APPROACH TO AIMN

SCENARIO
The scenario in which my app. will operate is as follows :-
I have a bunch of XML files along with their XSchema files on my web server.
Each XML file has an associated XSchema file.
Each of my clients will have my
- XML based app. installed
- A web browser with an inbuilt XMLDOM parser installed. The browser
would have native XML support as well.


For an XML file requested by any of my clients from their native XML
browsers my client side app. will need to

AIM1. Capture the served XML file
AIM2. Emit a hierarchical tree control of the schema of served XML file
(present in the .xsc file) in HTML format
AIM3. Pass the emitted HTMLised tree control to browser for display

MY DESIGN APPROACH TO AIM1-AIM3

- As far as capturing the reqested XML file data is concerned
my app. will extract the XML DOM tree of the requested XML file from
the DOMXML parser embedded in the client XML browser.
- In order to emit a hierarchical tree control of the schema of the served
XML file (present in the .xsc file) in HTML format, the app. will :-
- Obtain the XSchema DOM tree
- Invoke an XSL processor and pass it the XSchema DOM tree and
XSL rules which will contain HTML templates to get the
tree control HTML DOM tree output.
- The XSL processor will output the tree control HTML DOM tree
which my app. will then pass to the browser

Let me illustrate my point with an example.
Let's say I have a MyFile.xsc which is :-

<XSchema>
<ElementDecl Name="Root">
<Model>
<Ref Element="Ele1" Frequency="OneOrMore"/>
</Model>
</ElementDecl>
<ElementDecl Name="Ele1">
<Model>
<PCData/>
</Model>
</ElementDecl>
</XSchema>

and it's instance MyFile.xml is :-

<?xml version="1.0"?>
<?XSchema System="MyFile.xsc"?>
<Root>
<Ele1>Test-Data1</Ele1>
</Root>


My app. would execute the following steps

- XMLDOMtree = Extract-from-browser-XML-parser(MyFile.xml);
- XSchemaDOMtree = Obtain-XSchema-DOM-tree(XMLDOMtree);
- HTMLDOMtree = XSLProcessor(XSchemaDOMtree,XSLrules);
- Pass the HTMLDOMtree to browser for display so that the browser
output would be something like


Root
|
|
Ele1

On clicking a node of the tree control on the browser the user will be
presented with the structure of the node (as in the XSchema) for him to
fill in data + the following options :-
- Make new instance of node
- Get previous instance of node
- Get next instance of node
- Get parent instance of current instance
- Get child instance of current instance


For the MyFile.xsc and it's MyFile.xml instance file case
<Root>
<Ele1>1</Ele1>
<Ele1>2</Ele1>
</Root>
I would get a tree something like :-

Root
|
Ele1

|
| OnClick on Ele1 node would produce a form like
|
\/
_____________________________________
| Structure of Ele1
|
| Content Type Value Current Instance
| PCData 1 1
| List of Options
| * Make new instance of node
| * Get previous instance of node
| * Get next instance of node
| * Get parent instance of current instance
| * Get child instance of current instance
|
|____________________________________

On clicking any of the above option, the client application will be
invoked

AIM4. My client app. on invocation by any of the above options is
supposed to
- query the XML instance data depending upon option clicked and
- insert/retrieve the resulting XML, and
- then emit the resultant XML as HTML.

MY DESIGN APPROACH TO AIM4

Assuming that the user clicks on a tree node and then clicks on an option.
The app. at this point already has
  - the XML DOM tree of the requested XML instance file
  - the XSchema DOM tree of the instance file

- Depending upon option clicked the app. will query the the instance XML
file's XML DOM tree and it will retrieve/insert the resulting
XML DOM sub tree using the XML DOM API,
- The resultant XML DOM sub tree will be given to the XSL processor
along with the XSL rules to emit the resultant HTML DOM
subtree.
- The emitted HTML DOM subtree will be passed back to the browser for
display.


For the MyFile.xsc and it's MyFile.xml instance file case
<Root>
<Ele1>1</Ele1>
<Ele1>2</Ele1>
</Root>

Assuming the user has
- selected the "Ele1" node and
- got the options form
- pressed the "get next instance of node" option on the form

the client app. will need to query the the MyFile.xml XML DOM tree
giving it the element name ("Ele1") and the
action ("get-next-instance").The XML DOM tree will contain
<Root>
<Ele1>1</Ele1>
<Ele1>2</Ele1>
</Root>
My client app. on querying will remove the following
XML tree fragment "<Ele1>2</Ele1>"
This removed tree fragment will be converted to an HTML DOM tree
using XSL and emitted out.
In short my app. will execute the following steps :-

- Ele1XMLDOMsubtree = Query("Ele1","Get-next-instance",XMLDOMtree)
- HTMLDOMtree = XSLProcessor(Ele1XMLDOMsubtree,XSLrules);
- Pass the HTMLDOMtree to browser for display
where XMLDOMtree = The MyFile.xml XMLDOM tree

The HTMLDOM tree that will be passed to the browser
for the "<Ele1>2</Ele1>" XMLDOM tree fragment will be
rendered as follows :-

_____________________________________
| Structure of Ele1
|
| Content Type Value Current Instance
| PCData 2 2
| List of Options
| * Make new instance of node
| * Get previous instance of node
| * Get next instance of node
| * Get parent instance of current instance
| * Get child instance of current instance
|
|____________________________________

On any furthur clicks on options above,
the design approach to AIM4 would be followed and steps in that repeated.

I hope I was able to make my design intention clear enough for
comment.

Thanks in advance for any replies,


AMIT
Received on Friday, 8 January 1999 04:22:00 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:46 GMT