473,950 Members | 10,664 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to dynamically load schema from a file and then assign to xmldocument and validat

2 New Member
I am creating in memory xmldocument.Pre viously I were validating my file against a dtd file and then by the help of GetElementByID read my needed node.
i.e.

Expand|Select|Wrap|Line Numbers
  1. XmlDocumentType doctype = null; 
  2. doctype = statementsDocument.CreateDocumentType("queries", null,statementsPath +"\\Validation.dtd", null); 
  3. statementsDocument.AppendChild(doctype); 
  4. nodeElem = statementsDocument.CreateElement("queries"); 
  5. statementsDocument.AppendChild(nodeElem); 
  6. .... 
Now I have created validate.xsd.I don't know how to validate through xsd file
Sometime Later I want's validate from this validate.xsd then read my element by Get element ByID()



MY validate.dtd were

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8"?> 
  2. <!--DTD generated by XMLSpy v2006 sp2 U (http://www.altova.com)--> 
  3. <!ELEMENT queries (query+)> 
  4. <!ELEMENT query (statement)> 
  5. <!ATTLIST query 
  6. type CDATA #REQUIRED 
  7. id ID #REQUIRED 
  8. <!ELEMENT statement (#PCDATA)> 
and now my validate.xsd is

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?> 
  2. <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> 
  3. <xs:import namespace="http://www.w3.org/XML/1998/namespace"/> 
  4. <xs:element name="queries"> 
  5. <xs:complexType> 
  6. <xs:sequence> 
  7. <xs:element ref="query" maxOccurs="unbounded"/> 
  8. </xs:sequence> 
  9. </xs:complexType> 
  10. </xs:element> 
  11. <xs:element name="query"> 
  12. <xs:complexType> 
  13. <xs:sequence> 
  14. <xs:element ref="statement"/> 
  15. </xs:sequence> 
  16. <xs:attribute name="type" type="xs:string" use="required"/> 
  17. <xs:attribute name="id" type="xs:ID" use="required"/> 
  18. </xs:complexType> 
  19. </xs:element> 
  20. <xs:element name="statement"> 
  21. <xs:complexType mixed="true"> 
  22. <xs:choice minOccurs="0" maxOccurs="unbounded"/> 
  23. </xs:complexType> 
  24. </xs:element> 
  25. </xs:schema>
May 7 '06 #1
0 2626

Sign in to post your reply or Sign up for a free account.

Similar topics

7
14011
by: Winston | last post by:
Hi, I want to use the Webbrowser Control (the Internet Explorer Control) to display an XML-structure within a C# WinForm. The way the IE displays a XML-file in its native form is exactly what I need (as tree structure with plus/minus). This works great as long as I load the XML to display from a file with the Navigate2-method of the control. But my XML comes not from a file but is created dynamically during runtime.
3
3163
by: caroline.fryer | last post by:
I have an xml document which I only want to load part of depending on the element 'Name'. The structure of my xml document looks like this: <FileDefaults> <File> <Name>Name 1</Name> <Title></Title> <BCS>BCS 1</BCS> <BCSId></BCSId>
3
2683
by: Emily John | last post by:
I am using xml serialization to generate my xml document. I am getting the data as stream of memory and then converting it to xml document object without saving it to the file system. How do I validate this memory stream of data at load time with xml schema ? I may have to validate with multiple schemas at a later time. *** Sent via Developersdex http://www.developersdex.com ***
1
4121
by: Chris Fink | last post by:
I am receiving xml documents from a customer without a reference to a doctype. I know what the Doctype DTD should be need to insert the declaration as follows <?xml version="1.0" encoding="UTF-8"?> <!-- start of add validation tag --> <!DOCTYPE D1XML SYSTEM "http://url/myDTD.DTD"> <!-- end of add validation tag --> <XML.....>
2
18241
by: comic_rage | last post by:
how do you add a comment line/section to an xml schema xsd file? like this <!-- =============================================================== --> <!-- =================== My comment line ======================== --> <!-- =============================================================== -->
7
2755
by: Mac | last post by:
Hi all I have a asp.net application which calls a web service via a wdsl file which retrieves an XML String. The XML String is from a adodb recordset saved as via a stream. Dim oRS as New ADODB.Recordset Dim oStream as New ADODB.Stream
1
2433
by: Jeff Smith | last post by:
Can I load custom web user controls dynamically and access the properties and methods without having to explicitly define custom control types (example 2 below). I have custom web control named EditStuff.ascx which reads from an xml file and loads controls to its self based on string value in xml nodes collection of the xml. There are several controls that can be loaded and for each one there exists a public method called 'IntiControl'...
0
1572
by: delphiconsultingguy | last post by:
Hi all, Spent WAAAYYY too much time trying to figure this out because there's not many good examples out there, so in the interest of sparing y'all from suff'rin same, I've pasted it into eternity for you. Works like a charm. (I know, I know, I love you too) Sean
4
3281
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hi... We've got a lot of places in our code where we read relatively small xml user preference blocks. Currently that's creating a new XmlDocument in every spot. I was thinking we might see some speed improvements by having one, central XmlDocument and using doc.ReadNode() to process all of the fragments. Other than pumping up the NameTable with a mish-mash of different node names and namespaces, are there any other implications I'm...
0
10171
marktang
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...
0
9991
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
11369
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10703
tracyyun
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...
0
9904
agi2029
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...
1
8268
isladogs
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...
0
7443
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();...
1
4967
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3558
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.