I'm creating a system that uses XML to store an audit trail of the
steps that it has been through in the system.
The way the schema is defined, there is a "Tag" for every application
that performs modifications to any data, and "Fields" inside the tag
that outline the changes that were made.
Applications in the flow of the system read in these XML files and will
"overlay" these tags in order to obtain data for all fields that were
modified from a certain point on to act on that data and post their
results.
By the end of the system, as you can see, there are many, many Tags in
these XML files, and using an XSD schema to validate the file when it's
read in is horribly inefficient. Rather, I would like to define the
schema in such a way that it will be a validator for only the Tags and
their contents, and apply that schema to the tags that are written in.
Currently, I have tried to do this 2 ways, one way using a validating
reader and trying to .Skip() tags that are not needed at the current
point, and the other was to use an XmlDocument to perform validation on
fragments of XML.
The problem I saw, however, was that according to MSDN documentation,
..Skip() on a validating reader validates the XML that it is skipping!
(Doesn't make much sense, huh). So I had to modify how I used the
ValidatingReade r:
.. Create an XmlValidatingRe ader for the xml file to be read in
.. If a tag is found that should not be validated (not needed by the
current application), valReader.MoveT oNextAttribute( ) and
valReader.MoveT oElement() until the tag is complete.
The second way, using an XmlDocument and fragment validation, was
attempted like this:
.. Create an XmlTextReader for the xml file to be read in
.. Create an XmlDocument from the text reader
.. Get all "Tags" from the element list of the document
.. Loop through the resulting list and if the Name of the tag is one we
need to validate, create an XmlValidatingRe ader for the .OuterXml of
the node and .Read() on the ValidatingReade r.
The problem with both of these algorithms is that the overhead of
creating the reader and document, moving the cursor manually, and all
the other manual operations proved to negate any benefit (according to
Durations set in the code to time the sections) versus just creating a
ValidatingReade r and passing that to the Deserialize function.
Currently this is what I'm doing, and the hit for Validating while
Deserializing is huge. So I want to do my own small validation, and
pass just an XmlTextReader to the Deserialize function.
Any Ideas?
Thanks! 0 1832 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: marcum williams |
last post by:
Below I'm generating an updategram via xslt and currently referencing
schema via
<updg:sync mapping-schema="hpXSD.xsd">
....
</updg:sync>
But I would like to LOAD the .xsd schema into memory and APPLY to the
updategram in memory. Tried using XmlValidatingReader but couldn't
get it to work. Thanks
|
by: Michael Palmer |
last post by:
I'm reading xml from SQL Server 2K with VB.net using an XSD schema file
and SQLXML 3.0. I have the below code working fine, but I'd like to change
the code from reading the schema file from a directory to reading the
schema as an embedded resource. Here's my current code, what would I need
to change??
Dim strm As Stream
Dim strmReader As StreamReader
Dim cmd As New SqlXmlCommand("MyConnectionString")
Dim xmlDoc As New XmlDocument
|
by: Edward Diener |
last post by:
I could not find an example of an inline XSD schema for an XML document
which has no namespaces. Could someone supply one ? When I tried validating
my XML with an inline XSD schema, using XmlDocument.Load on a validating
reader set to System.Xml.ValidationType.Auto, it failed and I do not know
why.
My XML is:
<?xml version='1.0'?>
<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>
<xs:element name='Employee'>
|
by: Stefano |
last post by:
Hi all,
what is the correct use of the "default" attribute in XML Schema?
For example:
<xs:element name="myProperty" type="xs:string" default="myDefaultValue"/>
What can I do with it? What is the meaning of <
....default="myDefaultValue" /> ?
|
by: kamii47 |
last post by:
I am creating in memory xmldocument.Previously I were validating my file against a dtd file and then by the help of GetElementByID read my needed node.
i.e.
XmlDocumentType doctype = null;
doctype = statementsDocument.CreateDocumentType("queries", null,statementsPath +"\\Validation.dtd", null);
statementsDocument.AppendChild(doctype);
nodeElem = statementsDocument.CreateElement("queries");
statementsDocument.AppendChild(nodeElem); ...
| |
by: Norsoft |
last post by:
How can I convert an existing schema to an xml document. I have a series of schema documents that validate xml documents that describe metadata. Normally the metadata is first defined in a database, then schemas generated from the database. In this case I was given the schemas and I am writing an application to create the database entries.
I can't use a dataset as we have a very specific database structure.
I started to load them into an...
|
by: Jethro |
last post by:
I've tried to find the simplest demonstration of my issue. I have
source XML that looks like this (not a real XSD schema, but it doesn't
matter at this point):
(in var xmlStr:)
<xsd:element
xmlns:xsd="http://www.w3.org/2001/XMLSchema">abab</xsd:element>
Essentially, it's just an xml node w/ an xsd prefix, and the namespace
defined right on the node. Then, some jibberish is the text of the
|
by: Mark |
last post by:
Hi...
I've been trying the .Validate() method on the XmlDocument to validate some
xml against a schema, but one thing I noted was that unless the document
explicitly declares the schema as a default namespace, Validate() just lets
it slide through as a success.
Is there a way to Validate() either a) mandating against a particular
schema, or at the very least b) supplying a default namespace to be used even
when not explicitly declared?
|
by: Mikus Sleiners |
last post by:
I have a task to create xml document from c# code.
I have example of that document should look like and also a xml schema.
I wonder if i can use this xml schema somehow ?
This is schema:
<?xml version="1.0"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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: 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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |