Click here to Skip to main content
15,905,682 members
Home / Discussions / C#
   

C#

 
GeneralOwnerDraw TreeView: OnPaint(...) Pin
STW28-Feb-03 4:49
STW28-Feb-03 4:49 
GeneralRe: OwnerDraw TreeView: OnPaint(...) Pin
Carlos H. Perez28-Feb-03 8:59
Carlos H. Perez28-Feb-03 8:59 
GeneralRe: OwnerDraw TreeView: OnPaint(...) Pin
STW28-Feb-03 23:55
STW28-Feb-03 23:55 
GeneralRe: OwnerDraw TreeView: OnPaint(...) Pin
Anonymous5-Mar-03 8:39
Anonymous5-Mar-03 8:39 
GeneralRe: OwnerDraw TreeView: OnPaint(...) Pin
Anonymous8-Mar-03 1:22
Anonymous8-Mar-03 1:22 
GeneralRe: OwnerDraw TreeView: OnPaint(...) Pin
STW8-Mar-03 5:56
STW8-Mar-03 5:56 
GeneralReally annyone event fire order... Pin
Anonymous28-Feb-03 4:14
Anonymous28-Feb-03 4:14 
GeneralRe: Really annyone event fire order... Pin
Paul Riley28-Feb-03 4:22
Paul Riley28-Feb-03 4:22 
GeneralRe: Really annyone event fire order... Pin
James T. Johnson28-Feb-03 4:49
James T. Johnson28-Feb-03 4:49 
GeneralI'm look for a Treeview flicker free and owner draw Pin
STW28-Feb-03 4:12
STW28-Feb-03 4:12 
Questionis this one possible ? Pin
jtmtv1828-Feb-03 2:07
jtmtv1828-Feb-03 2:07 
AnswerRe: is this one possible ? Pin
leppie1-Mar-03 0:00
leppie1-Mar-03 0:00 
GeneralRe: is this one possible ? Pin
jtmtv181-Mar-03 10:58
jtmtv181-Mar-03 10:58 
GeneralRe: is this one possible ? Pin
leppie1-Mar-03 11:23
leppie1-Mar-03 11:23 
GeneralRe: is this one possible ? Pin
jtmtv181-Mar-03 11:46
jtmtv181-Mar-03 11:46 
GeneralRe: is this one possible ? Pin
leppie1-Mar-03 21:36
leppie1-Mar-03 21:36 
GeneralRe: is this one possible ? Pin
jtmtv181-Mar-03 22:50
jtmtv181-Mar-03 22:50 
GeneralRe: is this one possible ? Pin
leppie1-Mar-03 23:16
leppie1-Mar-03 23:16 
GeneralRe: is this one possible ? Pin
jtmtv181-Mar-03 23:26
jtmtv181-Mar-03 23:26 
GeneralRe: is this one possible ? Pin
leppie1-Mar-03 23:30
leppie1-Mar-03 23:30 
GeneralRe: is this one possible ? Pin
jtmtv181-Mar-03 23:42
jtmtv181-Mar-03 23:42 
GeneralRe: is this one possible ? Pin
leppie2-Mar-03 2:43
leppie2-Mar-03 2:43 
GeneralRe: is this one possible ? Pin
jtmtv182-Mar-03 11:56
jtmtv182-Mar-03 11:56 
QuestionHow to get AppInfo/Documentation from an XML Schema via XmlDocument (DOM) in C#? Pin
Mirco J. Nimmrichter27-Feb-03 23:12
Mirco J. Nimmrichter27-Feb-03 23:12 
Hi all,

since days I'm looking for a solution to get the information stored in the <xsd:appinfo> or <xsd:documentation> tag from a known XmlElement (for example got by a XPath selection)... Could anybody give me a hint how I can access to this values in C#?

Here the C# sample code, a small XML sample and the related XML Schema:

XmlTextReader tr = new XmlTextReader(sXMLFile);
vr = new XmlValidatingReader(tr);
vr.ValidationType = ValidationType.Schema;

XmlTextReader sr = new XmlTextReader(sSchemaFile);
XmlSchema schema = XmlSchema.Read(sr, new ValidationEventHandler(ValidationHandler));
sr.Close();

vr.Schemas.Add(schema);
vr.ValidationEventHandler += new ValidationEventHandle(ValidationHandler);
doc = new XmlDocument();
doc.Load(vr);
vr.Close();

string selectExpr = "//test:TestData/test:Collection/test:Element";

XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
nsmgr.AddNamespace("test", "http://xsd.mytest.com/test.xsd");

XmlNode root = doc.DocumentElement;
XmlNode myElementNode = root.SelectSingleNode(selectExpr, nsmgr);

------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<test:TestData xmlns:test="http://xsd.mytest.com/test.xsd" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<test:Collection>
<test:Element Id="1">11.00</test:Element>
</test:Collection>
</test:TestData>

------------------------------

<?xml version="1.0" encoding="utf-8" ?>
<xsd:schema targetNamespace="http://xsd.mytest.com/test.xsd" xmlns:test="http://xsd.mytest.com/test.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0">
<xsd:element name="TestData" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Collection">
<xsd:complexType>
<xsd:annotation>
<xsd:documentation>This is the documentation of the Collection</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="Element" default="1.00">
<xsd:complexType>
<xsd:annotation>
<xsd:documentation>This is the documentation of the Element</xsd:documentation>
<xsd:appinfo>
<formula>5.000000 + 3.000000</formula>
</xsd:appinfo>
</xsd:annotation>
<xsd:simpleContent>
<xsd:extension base="test:ElementType">
<xsd:attribute name="Id" type="xsd:int" default="1" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:simpleType name="ElementType">
<xsd:restriction base="xsd:double">
<xsd:minInclusive value="0.100000" />
<xsd:maxInclusive value="10.000000" />
<xsd:pattern value="\d{1,2}.\d{1,6}" />
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>

------------------------------

The validation works fine and I really get the error notification, that the value of "Element" is out of range. I also get a valid myElementNode object back. But how can I read the Documentation/AppInfo out of this myElementNode? Is it impossible or am I just too stupid? Do I need to write my own parser for that?

Thanks for your help!
Mirco John

GeneralFind Printer List available... Pin
bania27-Feb-03 20:16
bania27-Feb-03 20:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.