|
Hi..
is it valid to nest an XML tag within a tag of the same type ?
like this :
<Drive name="C">
<Folder name="folder1">
<Folder name="New Folder"/>
</Folder>
</Drive>
|
|
|
|
|
You're not really nesting. Nesting would have a <Folder> or <Drive> element within another <Folder> or <Drive> element.
Oh yeah, yes it's legal as long as it's well-formed:
<drive dev="/dev/hda1">
<folder name="bin"/>
<folder name="usr">
<folder name="bin"/>
<folder name="sbin"/>
<folder name="src"/>
<folder name="darwin" link="true"/>
<folder name="include"/>
<folder name="linux" link="true"/>
</folder>
</folder>
<folder name="sbin"/>
</drive>
The W3C says, "A consequence of well-formedness in general entities is that the logical and physical structures in an XML document are properly nested; no start-tag, end-tag, empty-element tag, element, comment, processing instruction, character reference, or entity reference can begin in one entity and end in another."
|
|
|
|
|
I'm reading xml from SQL server with VB.net using an XSD schema file. I have the code working fine, but I'd now like to change the code from reading a file on disk to reading the schema from the file as an embedded resource. Here's my code, what do I need to change??
<br />
Dim conString As String = "MyConnectionString"<br />
Dim strm As Stream<br />
Dim strmReader As StreamReader<br />
Dim cmd As New SqlXmlCommand(conString)<br />
Dim xmlDoc As New XmlDocument<br />
Dim strXML As String<br />
<br />
With cmd<br />
.CommandText = "MyXPath"<br />
.CommandType = SqlXmlCommandType.XPath<br />
.SchemaPath = "C:\MySchemaFile.xsd" '**I want this to be embedded!!**<br />
strm = .ExecuteStream<br />
End With<br />
<br />
strmReader = New StreamReader(strm)<br />
strXML = strmReader.ReadToEnd<br />
xmlDoc.LoadXml(strXML)<br />
Like I said, the above code works fine, but I don't want a physical file location.
Thanks!!!
-Michael
|
|
|
|
|
Add the XSD to the project, change it's build type to Embedded Resource. You'll use the Namespace to get at it. For example, if your assembly default namespace is MyDataAccess , the resource base name will be MyDataAccess.MySchemaFile.xsd . You'd use Assembly.GetExecutingAssembly().GetManifestResourceStream to load it.
Unfortunately, SqlXmlCommand only accepts paths to the SchemaPath So, you embed the XSD, then write it out as a temporary file, use it, and delete the temporary file:
string tmpFilePath = Path.GetTempFileName();
try
{
TextReader rdr = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("MyDataAccess.MySchemaFile.xsd");
TextWriter wr = new StreamWriter(tmpFilePath, false);
wr.WriteLine(rdr.ReadToEnd());
wr.Close();
rdr.Close();
}
catch (Exception e)
{
}
finally
{
if (File.Exists(tmpFilePath)) File.Delete(tmpFilePath);
}
|
|
|
|
|
i am currently trying to create a combo box which will then display "yes" and "no" when i run the macro, the combo box is created in visual basic!
any feed back would be appreciated!
sincerely
hyper Robster
|
|
|
|
|
I'm trying to develop a web based C# app that will read in any xml document and then display the information in a tree form. The user can then expand the parent nodes through a drilldown list and edit its children. Anyone know how I can go about doing this? I've only been able to get the app to update/add/and edit but I don't know how to display the hierarchy. Any help is appreciated.
|
|
|
|
|
How do I put a string into a xml file in a windows application, in a window form? I use a DataReader for accessing data from my database(and not a dataset).
When I was working to a project in ASP, I used
xmlfile.DocumentContent=mystring;
but in windows forms the xml document doesn't have "DocumentContent" property!
|
|
|
|
|
Well yeah, you just can't arbitrarily stick a string into the middle of XmlDocument . Can you elaborate on what you are trying to accomplish? You are iterating over a DataReader for data to do what with it? If you want to insert a new XmlNode into the XmlDocument there are plenty of examples of how that works around.
|
|
|
|
|
Why not use a dataset? Then you could retrieve the xml using the getxml and insert your nodes as required.
|
|
|
|
|
I'm serializing an object (mydata).
What is the code so that the output xml shows:
<mydata
xmlns:xsi='http: www.w3.org="" 2001="" xmlschema-instance'
xsi:nonamespaceschemalocation="myOwn.xsd"
------
<="" mydata="">
The .xsd is given to me. I don't have to create it, I only need some means to getting the two lines above(xmlns... and xsi...) to pop out in the XML when the object is serialized.
Thank you
Larry
|
|
|
|
|
Hello friends,
I got many xml parsers from both third party persons and also MSXML. I would like to know which parser will use less memory? Since i am going to use the parser in Pocket PC system.Please help me.
Thanks
JP
|
|
|
|
|
If you need just need to parse XML, Pocket PC 200o Pro and Pocket PC 2002 comes with MSXML 2.0 parser. Also you can check for SAXON parser support for Pocket PC.
If you need to do XSLT Transformation, Pocket PC 2003 (Windows Mobile) comes with MSXML 3.0 support which is pretty good. You can also try XALAN.
Since MSXML already comes in Pocket PC, I guess, it should work fine with the low memory.
|
|
|
|
|
If you need just need to parse XML, Pocket PC 200o Pro and Pocket PC 2002 comes with MSXML 2.0 parser. Also you can check for SAXON parser support for Pocket PC.
If you need to do XSLT Transformation, Pocket PC 2003 (Windows Mobile) comes with MSXML 3.0 support which is pretty good. You can also try XALAN.
Since MSXML already comes in Pocket PC, I guess, it should work fine with the low memory.
|
|
|
|
|
Hi Thanks for your suggestion. I need XML parser only. So no problem. But I don't know how to use MSXML.That is the big problem. Can u give me some samples for XML parser using MSXML
Thanks
JP
|
|
|
|
|
Does anybody know if Visual Studio .NET (or other tools) can automatically generate sample xml files (for testing, for example) from a given xml schema? (IBM used to have something like that for a given DTD).
Thanks.
|
|
|
|
|
I thought XMLSpy could do that.
|
|
|
|
|
Hi Mark,
Thanks for the info, XMLSpy is not free, I think. Does Visual Studio .NET or some other Microsoft development tools provide that capability?
Thanks.
|
|
|
|
|
You can get it as a trial version.
|
|
|
|
|
I have searched MSDN and Microsoft and found a page which suggests I download some documentation. No download appears. Does anyone know where there is a downloadable version of the Word XML reference. I have the Excel Worksheet reference for Excel 2002 but not Word.
|
|
|
|
|
http://www.xmlw.ie/aboutxml/xml2word/
|
|
|
|
|
I am porting a XML based project from VC6.0 to VC7.0. But, 7.0 compiler shows 'ambigous symbol' error. How can I solve it.
|
|
|
|
|
Add the desired namespace to the offending symbol, e.g., Namespace::symbol .
|
|
|
|
|
(This is not an XML question, but where to ask it?)
How can the title in the title bar be changed according to the last selected frame?
Normally the TITLE of the main HTML (the "page") will be displayed, no matter which content
is actually displayed in the frames.
Miscrosoft's MSDN site (http://msdn.microsoft.com/default.aspx) changes the title with every selection on the left-side frame. How do they do it? Is that MS-IE specific?
|
|
|
|
|
I have a problem with the XslTransformer class.
The transform method i use creates un-wanted text nodes in the output file which are not created when i run the transformation via external tools such as XML Spy.
Basicly speeking, i want to get : <node attr1="val1" attr2="val2" ... />
but i get <node attr1="val1" attr2="val2" ... ></node>
which causes the output to be invalid to my schema.
And naturally i can't change the schema
|
|
|
|
|
Why does this invalidate your schema, they are the same.
|
|
|
|