XML "Reader" that allows me to access specific nodes and attributes efficiently?

Hi,

I'm pretty much a newcomer when it comes to XML Development and I'm hoping you can help me.
The application I've inherited is a bit of a mess because SQL statements are littered all over the place, making it difficult to find, tune and reuse queries as well as validating them in a semi automated way. Besides, if we wanted to support SQL Server as well as Oracle, we'd have no way of storing the different forms of the query.

So I've started creating an XML file to move all the SQL into.

The current draft XML looks something like:

  <?xml version="1.0" ?> 
 <SQL_Registry>
    <RegistryEntry type="SQL" key="RetrieveReporters">
        <Statement key="ORACLE">
            <Param key="SQL">
                SELECT reporter_code, blah_de_blah from reporters
              </Param>
              <Param key="Num_Params">0</Param> 
            <Param key="Use_Bind_Vars">N</Param> 
         </Statement>
    </RegistryEntry>
    <RegistryEntry type="SQL" key="RetrieveBatchLines">
        <Statement key="ORACLE">
            <Param key="SQL">
                SELECT something from my_batch_details 
                WHERE batch_id = :BATCH_ID
              </Param>
              <Param key="Num_Params">1</Param> 
            <Param key="Use_Bind_Vars">Y</Param> 
         </Statement>
    </RegistryEntry>
(...)
 </SQL_Registry>

What I need now is an intermediary between the Data Access Layer I'm developing and that XML file. It would basically be a class that allows me the following kind of functionality:

- Instantiate the class and specify a source file
- Find a RegistrEntry node with a given key (ie SQL Statement name) and extract the information
for the correct RDBMS (obviously, this can and should be more generic as I simply need access to
the attributes and can place the data in an appropriate class).

I must admit that I'm a total newbie as far as accessing XML files is concerned. I'd like this to
happen in as efficient a way as possible with a file that should end up being hundreds of Kb large.
what I'd certainly like is to avoid schoolboy mistakes like using inefficient or needlessly complex
technology (say, for example, using an XMLTextReader instead of XMLDocument or whatever else is available) or not being aware of some common pitfalls when reading in the data and losing lots of time on what is essentially a side project.

I do not need any ability to update the XML or do anything fancy with it.

So are you aware of any prewritten free classes that would demonstrate how to do this? That would
avoid me having to reinvent the wheel. If not, I certainly don't mind at all doing the legwork on this
but would you be able to let me know which classes you would recommend using to access the
XML (XMLDocument, XMLTextReader, other?) and whether you are aware of any good example of  that technology in use?

Many thanks in advance for helping me to tidy up the SQL mess. :)
0
Wendelius
3/29/2005 3:11:10 PM
asp.net.xml-datasource 7181 articles. 0 followers. Follow

1 Replies
334 Views

Similar Articles

[PageSpeed] 15

Rereading my post, I realise that I didn't start my question with a
little precision: The application I inherited is an ASP.Net one written
in C#. But any sample code you might want to mention or any advice need
not be concerned by the implementation language. I'm comfortable
dealing with other languages and generic advice (go for the XXX XML related classes) would obviously effectively be language independant.

Any advice on helping me clean up the SQL mess would be most welcome.

Best regards,
Wendy G.
0
Wendelius
3/30/2005 8:53:00 AM
Reply:

Similar Artilces:

Setting xml attribute "use=required" property when generating xml from PDM
I am generating an XML schema from a physical data model, and had hoped that the attributes generated would have the property "use=required" set, if the column in the related table was set to mandatory. However, this does not happen. Can anyone advise me how to get this property set, or would I have to use an Extended Model Definition to achieve this? And if so, any suggestions on how to go about getting this done? Thanks Guy ...

superreview requested: [Bug 251274] Error: [Exception... "Node was not found" code: "8" nsresult: "0x80530008 (NS_ERROR_DOM_NOT_FOUND_ERR)" location: "chrome://inspector/content/inspector.xml Line:
Boris Zbarsky <bzbarsky@mit.edu> has asked neil@parkwaycc.co.uk <neil.parkwaycc.co.uk@myrealbox.com> for superreview: Bug 251274: Error: [Exception... "Node was not found" code: "8" nsresult: "0x80530008 (NS_ERROR_DOM_NOT_FOUND_ERR)" location: "chrome://inspector/content/inspector.xml Line: 684"] https://bugzilla.mozilla.org/show_bug.cgi?id=251274 Attachment 193251: Fix https://bugzilla.mozilla.org/attachment.cgi?id=193251&action=edit ------- Additional Comments from Boris Zbarsky <bzbarsky@mit.edu> This just makes su...

superreview granted: [Bug 251274] [FIX]Error: [Exception... "Node was not found" code: "8" nsresult: "0x80530008 (NS_ERROR_DOM_NOT_FOUND_ERR)" location: "chrome://inspector/content/inspector.xml Lin
neil@parkwaycc.co.uk <neil.parkwaycc.co.uk@myrealbox.com> has granted Boris Zbarsky <bzbarsky@mit.edu>'s request for superreview: Bug 251274: [FIX]Error: [Exception... "Node was not found" code: "8" nsresult: "0x80530008 (NS_ERROR_DOM_NOT_FOUND_ERR)" location: "chrome://inspector/content/inspector.xml Line: 684"] https://bugzilla.mozilla.org/show_bug.cgi?id=251274 Attachment 193251: Fix https://bugzilla.mozilla.org/attachment.cgi?id=193251&action=edit ------- Additional Comments from neil@parkwaycc.co.uk <neil.parkwa...

"Initialize Active Directory for Hosting" Fails
Trying to get HMC set up and installed on a new server; been following the step-by-step instructions included with the software.  Everything's was going smoothly until I got to the "Initialize Active Directory for Hosting" step, at which point I started getting this error: "Only one top level element is allowed in an XML document".  I haven't been able to find any info on this error as it relates to an MPS deployment, and haven't made much progress moving past it.  Here's the proc.xml that provtest is trying to process and failing on:<req...

xml nodes have single attribute and are self closing, cannot "xmldatadoc.load()" to dataset. Suggestions?
Hi everyone,I'm trying to "upgrade" my code on a xml load/config/save winform that I have used in the past to make simple changes.  I use a empty dataset, read the xml schema to dataset, create a new xml datadocument from dataset, and bind the datadocument to a datagrid.The current code works fine when your xml nodes look like standard elements:  <x>value</x> (which 99% of mine thus far have)Im trying to update the code so it will work with nodes having attributes: <x name="name"/>   *NOTE: No empty tags, ALL self closing*Below is...

how to read specific node in xml doc, example "1.4.0.2"
I've never worked with xml but I need to get specific node from xml document. In example above a need to get node 2 of node 0 of node 4 of node 1 and its attributes. Can somebody just point me where to look at least? Thanks in advanceYou died at the very end of your life Hi exptrade, Im not sure about your example but ive given you an example here of how to get a specific node and its attributes. XmlDocumen doc = new XmlDocument("person.xml"); -person is the root node <person> <name fname="fez" lname="zef"></name> <addre...

superreview granted: [Bug 428847] XML Parsing Error with ":" in href attribute of xml-stylesheet processing instruction : [Attachment 316114] Fix, with tests.
Jonas Sicking (:sicking) <jonas@sicking.cc> has granted Johnny Stenback (:jst) <jst@mozilla.org>'s request for superreview: Bug 428847: XML Parsing Error with ":" in href attribute of xml-stylesheet processing instruction https://bugzilla.mozilla.org/show_bug.cgi?id=428847 Attachment 316114: Fix, with tests. https://bugzilla.mozilla.org/attachment.cgi?id=316114&action=edit ...

superreview requested: [Bug 428847] XML Parsing Error with ":" in href attribute of xml-stylesheet processing instruction : [Attachment 316114] Fix, with tests.
Johnny Stenback (:jst) <jst@mozilla.org> has asked Jonas Sicking (:sicking) <jonas@sicking.cc> for superreview: Bug 428847: XML Parsing Error with ":" in href attribute of xml-stylesheet processing instruction https://bugzilla.mozilla.org/show_bug.cgi?id=428847 Attachment 316114: Fix, with tests. https://bugzilla.mozilla.org/attachment.cgi?id=316114&action=edit ...

"Attempt to use an "XML" extension that has not been registered..."
Hello, I am using Reporting Service in server mode.I currently have a report in which in include a few subreports. All of them use the same datasource (sqlserver 2005 database connectionstring)I have to add another report which is based on XML data. To do so, I created a new shared datasource, designed my query, added the report parameters, tested the query... This works but when I try to deploy this report on the report server I am getting an error I do not understand:"Attemps to use an "XML" extension of data that has not been registered for this report server"I do...

Changing portal settings fails with "Access to the path "...PortalCfg.xml" is denied.
If I try to make any changes to the ASP.NET Portal Starter kit it fails with an access denied error. This was working when I left last week and is failing today. I don't remember changing anything, but I guess something had to be changed. I have checked NTFS permissions and the ASPNET account has full control on the parent directory of that XML file and on the file itself. I have also checked in IIS, and the Virtual Directory has "write" allowed. The funny thing is that the change I am trying to make works! So if I reload the page I see the change. Here is the full e...

"XML page cannot be displayed" added to XML Download
I'm using these lines to initiae a download of an xml file.  Response.Clear()Response.ContentType = "application/octet-stream"Response.AddHeader("Content-Disposition", _"attachment; filename=""" & varFileName & """")Response.Flush()Response.WriteFile(varFileName)   File looks fine in XML viewer just after created. But the output of the download, when viewed as XML, has the following, fully formatted http error imbedded in it:   XML page cannot be displayed Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh butto...

convert BASDA format XML to "standard" XML
hiya, Many of my recent problems have been that I have found it difficult to get my head round using XSLT on BASDA format XML.I feel that it would be easier to convert the BASDA format to "standard" XML, then do my XSLT. --BASDA snippet <rows> <row> <FIELD NAME="PRODUCT-TYPE">CAR</FIELD> <FIELD NAME="PRODUCT-DATE">01/01/2004</FIELD> </row> </rows> --what I regard as "standard" XML...easier to work with. <rows> <row> <PRODUCT-TYPE>CAR</P...

Controlling user access using "allow" "deny"
I have a web form application for deployment on Windows 2000 Server.  I wish to limit access to the web site to a certain group of users, all having accounts on the server.  The authentication mode is "Windows", impersonate ="true"...  From my reading, this seems the perfect situation to use "roles=" within the authentication block.  I must admit, however, that I am not a server admin guru.  What is a "role" in terms of 2000 server?  What sort of group, organizational unit, etc. would be created on the server to act as a "role"?  Any light shed would be app...

datawindow.import(XML!,"file.xml") syntax error
I am using Pocket PowerBuilder 1.5 build 360 from the help file I saw [ImportFile method (DataWindows)] long dwcontrol.ImportFile ( {saveastype importtype}, string filename {, long startrow {, long endrow {, long startcolumn {, long endcolumn {, long dwstartcolumn } } } } } ) This statement inserts all the data in the file D:\TMP\EMPLOYEE.CSV into dw_employee starting at the first column: dw_employee.ImportFile("D:\TMP\EMPLOYEE.CSV") This statement inserts all the data in the file D:\TMP\EMPLOYEE.XML into dw_employee starting at the first column: dw_em...

Web resources about - XML "Reader" that allows me to access specific nodes and attributes efficiently? - asp.net.xml-datasource

Resources last updated: 1/2/2016 11:04:38 PM