• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1070
  • Last Modified:

Support of SAX Parser with ASP

Hi all
 Can we use a SAX parser in ASP Coding.. How to use it and also provide the code to do socode.

if we instantiate XMLDom at client side does Netscape brwose support . since Msxml dll file comes along with IE will netscape support i.e a system having only Netscape browser support the xmldom instantiation at client side does the msxml dll be present along with  netscape ?

0
indu_ma
Asked:
indu_ma
  • 2
1 Solution
 
edmund_mitchellCommented:
Of course you can use a SAX parser in ASP coding.  One needs only to instantiate the parser, load the file, instantiate the content handler and code the content handler implementation. So certainly you can do a transform using a SAX parser.

ASP
<%Response.ContentType = "text/xml"
     
    Dim generator, ch
    ' instantiate XML generator class
    Set generator = Server.CreateObject("XMLFilesVBSAX.CGenerator")
    Set ch = Server.CreateObject("XMLFilesVBSAX.CSerializer")
    ch.RegisterOutputStream Response
    generator.generateXML ch
%>

Then ->

<%Response.ContentType = "text/xml"
     
    Dim reader, ch
    ' instantiate XMLReader class
    Set reader = Server.CreateObject("MSXML2.VBSAXXMLReader.3.0")
    ' instantiate class that implements IVBSAXContentHandler
    Set ch = Server.CreateObject("XMLFilesVBSAX.CSerializer")
    ch.RegisterOutputStream Response
    ' turn off namespace prefixes
    reader.putFeature "http://xml.org/sax/features/namespace-prefixes", False
    ' register ContentHandler implementation
    Set reader.contentHandler = ch
    ' begin processing document
    reader.parseURL "file://c:\temp\whatever.xml"
%>

And lastly ->

<%    
    Dim reader, ch
    ' instantiate XMLReader class
    Set reader = Server.CreateObject("MSXML2.VBSAXXMLReader.3.0")
    ' instantiate class that implements IVBSAXContentHandler
    Set ch = Server.CreateObject("XMLFilesVBSAX.CInvoice2HTML")
    ' turn off namespace prefixes
    reader.putFeature "http://xml.org/sax/features/namespace-prefixes", False
    ' register ContentHandler implementation
    Set reader.contentHandler = ch
    ' begin processing document    
    reader.parseURL "file://c:\temp\whatever.xml"
%>

These code snippets will serialize XML into HTML or vice versa (uses a whatever.xml file - not included).  There's much more you can do, but this is a simple start.

Also, you might get some mileage from this M$ website:

http://msdn.microsoft.com/library/default.asp?URL=/library/en-us/dnxml/html/vbsax2jumpstart.asp

Netscape can work with the DOM up to Level 1 in 6.0.  Check out:
http://www.scottandrew.com/index.php/articles/dom_1
for some info.

I hope that answers your questions.

Edmund
0
 
MoondancerCommented:
It's time to clean up this topic area and that means taking care of this question. Your options at this point are:

1. Award points to the Expert who provided an answer, or who helped you most. Do this by clicking on the "Accept Comment as Answer" button that lies above and to the right of the appropriate expert's name.

2. PAQ the question because the information might be useful to others, but was not useful to you. To use this option, you must state why the question is no longer useful to you, and the experts need to let me know if they feel that you're being unfair.

3.  Ask Community Support to help split points between participating experts.  Just comment here with details.

4.  Delete the question because it is of no value to you or to anyone else.  To use this option, you must state why the question is no longer useful to you, and the experts need to let me know if they feel that you're being unfair.

If you elect for option 2, 3 or 4, just post comment with details here and I'll take it from there.  We also request that you review any other open questions you might have and update/close them.  Display all your question history from your Member Profile to view details.

PLEASE DO NOT AWARD THE POINTS TO ME.
____________________________________________
---------->  Hi Experts:

In the event that the Asker does not respond, I would very much appreciate your opinions as to which Expert ought to receive points (if any) as a result of this question.  Likewise, you can also suggest that I PAQ or delete the question.

------------->  The ALL TOPICS link has been updated today to reflect all the new TAs.

Thank you everyone.

Moondancer :)
Community Support Moderator @ Experts Exchange
0
 
MoondancerCommented:
Finalized by EE Moderator
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now