|
Hi All,
I am very new to XML domain.
I want to know the importance of "" tag.
What information xml version value(1.0) give to us.
Thanks,
Suraj
Suraj Gupta
|
|
|
|
|
Either check the "Ignore HTML tags in this message" checkbox beneath the smilies or replace all < with <, so we can see what tag you're talking about.
The value of the version attribute tells you exactly what the name implies: the version of the XML standard the document conforms to.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Thanks alot...
Suraj
Suraj Gupta
|
|
|
|
|
how can i search within XML document.
|
|
|
|
|
You use XPath.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Hi!
Im working with VS2003 — VB.Net. I stuck with problem. When i apply serialization for my class, i cant get element with 2 attrib: one attribute as null (xsi:nil="true") and another - valuable.
Like this : <IndTaxNum ROWNUM="1" xsi:nil="true" />
My code:
' piece of class for serialization
Public Class DBody
' .....................
<System.Xml.Serialization.XmlElementAttribute("IndTaxNum", _
Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, _
IsNullable:=True)> _
Public IndTaxNum() As IndTaxNumColumn
'.....................
End Class
' type IndTaxNumColumn declare
Public Class IndTaxNumColumn
<System.Xml.Serialization.XmlAttributeAttribute()> _
Public ROWNUM As Integer
<System.Xml.Serialization.XmlTextAttribute()> _
Public Value As String
End Class
XML document use for saving table. Not all variables Value have meaning (some of their Nullable).
<IndTaxNum ROWNUM="1" xsi:nil="true" />
<IndTaxNum ROWNUM="2">345453<IndTaxNum/>
<IndTaxNum ROWNUM="3" xsi:nil="true" />
<IndTaxNum ROWNUM="4">767567<IndTaxNum/>
.................
However if set in code:
Value = System.DBNull.Value.ToString or
Value = Nothing or
Value = String.Empty
generating —
<IndTaxNum ROWNUM="1" />
if dont insert value to array IndTaxNumColumn -
<IndTaxNum xsi:nil="true" />
So, what i must set for result:
<IndTaxNum ROWNUM="1" xsi:nil="true" /> ?
thank you!
|
|
|
|
|
Hi, I am trying to use XPath in my VC++.NET application to navigate my XML document. But I am getting nothing when I run <code>Select()</code> method of <code>XPathNavigator</code> class. I am posting my XML, XSD and CODE with this message. Can I know what is the problem with this code?
XSD File:
<?xml version="1.0"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:target="http://www.example.com/name" targetNamespace="http://www.example.com/name" elementFormDefault="qualified">
<element name="name">
<complexType>
<sequence>
<element name="first" type="string"/>
<element name="middle" type="string"/>
<element name="last" type="string"/>
</sequence>
<attribute name="title" type="string"/>
</complexType>
</element>
</schema>
XML File:
<?xml version="1.0"?>
<name xmlns="http://www.example.com/name" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.example.com/name name5.xsd" title="Mr.">
<first>John</first>
<middle>Fitzgerald Johansen</middle>
<last>Doe</last>
</name>
VC++.NET code:
XmlDocument* m_myDoc = new XmlDocument();
m_myDoc->Load(S"name5.xml");
XPathNavigator* m_myNav = m_myDoc->CreateNavigator();
m_myNav->MoveToRoot();
XPathNodeIterator* myNodeIte = m_myNav->Select(S"/name");
int cnt = myNodeIte->Count;
I am getting no data from this doce.
Thanks in advance.
Priyank
|
|
|
|
|
The problem is that the name element you're trying to select is in the "http://www.example.com/name" namespace (via xmlns attribute) but your XPath expression looks for a name element in the empty namespace. Use the overload of Select that takes an additional IXmlNamespaceResolver instance. The example of the MSDN topic should give you an idea on how to adjust your code.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi
In side my ASPPage I am creating XMLDomDcoument and HTTPRequest Object . I have listed here the Code
Processing flow
1. Loading XML Content from Request Object to XMLDOMDocument
2. Opening our DataCenter Server’s ASP Page by MSXML2.XMLHTTP Object
3. Sending the XMLDOMDocument by MSXML2.XMLHTTP object
<!--#include file="dataCenter.asp"--><br />
<% Set objXMLDocument = CreateObject("MSXML2.DOMDocument")<br />
dataCenter=dataCenter & Mid(Request.ServerVariables("URL"), InStrRev(Request.ServerVariables("URL"), "/")+1) & "?rt=GWAY"<br />
Set objHTTPRequest = CreateObject("MSXML2.XMLHTTP")<br />
objXMLDocument.load(Request)<br />
objHTTPRequest.open "POST", dataCenter, False <br />
objHTTPRequest.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"<br />
objHTTPRequest.send objXMLDocument<br />
ret = objHTTPRequest.responseText<br />
Response.Write ret<br />
Set objXMLDocument = Nothing<br />
Set objHTTPRequest = Nothing<br />
%>
Everything working fine for some time (likely1 hour or 55 minutes ) After that , My Script engine is throwing a Error like
“ Failed to Create Object CreateObject("MSXML2.DOMDocument") “
After restarting my webserice, it working fine and come to same status as mention above
I have question on this issue
1. Whether it is VBScript Engine Issue
2. Whether it is MSXML2.DOMDocument Issue
Thanks in advance
g.p.swamy
|
|
|
|
|
hi friends
how to create the bar chart from xml dynamically in asp.net
thanx
regards
saravanan
|
|
|
|
|
and your problem is exactly ... ?
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
I"m relatively new to XML and I have to create a schema for our company.
I"m a little confused as to the best practices for creating a schema, particularly, what should be an attribute versus a child element.
I also dont know if its best to use global elements and reuse them as child elements or to use a global complexType. Any best practices for this?
The final goal is to create an interface that reads and processes XML, but we're starting w/ our schema definition.
Is it easier programatically to read attributes vs elements using MSXML? Any ideas? Good books on C# and XML?
Thanks.
-C
|
|
|
|
|
Wheatbread wrote: I"m a little confused as to the best practices for creating a schema, particularly, what should be an attribute versus a child element.
Overusage of elements tend to bloat your XML document. I primarily view an element as a hierarchical container of nodes.
Attributes tend to flatten the hierarchy and make your document smaller. I mostly use attributes to uniquely identify and describe an element. However, attributes cannot contain other nodes except for a text node.
How you use elements and attributes is dependent on the data you are trying to represent.
Wheatbread wrote: I also dont know if its best to use global elements and reuse them as child elements or to use a global complexType. Any best practices for this?
You should be aware that a globally defined element can be used as the root element. More than one globally defined element allows a list of roots to choose from. To enforce only one choice of a root element, you must only define one globally and nest all other element declarations into complex type definitions.
Wheatbread wrote: Is it easier programatically to read attributes vs elements using MSXML?
Attributes might be a little easier. Once you have selected an element, the attributes are in name/value pair container off the selected element object.
Wheatbread wrote: Good books on C# and XML?
I cannot really list any books on learning C# or XML since I am not familiar with your background and preferences. I tend to buy reference type books. However, I will list a few web sites that can get you started:
http://www.informit.com/guides/index.asp?rl=1[^]
http://www.w3schools.com/[^]
http://www.topxml.com/[^]
http://www.xml.com/[^]
|
|
|
|
|
Just a few more questions:
So, if I have info that's from a database, probably makes more sense to have elements for a 1:1 relationship w/ the fields of a given record?
My data model is used for communication, serial or network. I have alot of data/value pairs. So I used attributes to describe the value, instead of making alot of elements. For readability, its easier as well. There's a possibility that the data points may be entered into a database, so if I use an XSLT later that I wont have issues w/ linking an attribute to a database field.
I understand the one global element piece, so I removed the other globals elements. I just noticed that an example from another corporate XML communication XSD had multiple globals, and I"m just to figure if I need them.
Thanks again.
-C
|
|
|
|
|
Wheatbread wrote: So, if I have info that's from a database, probably makes more sense to have elements for a 1:1 relationship w/ the fields of a given record?
My data model is used for communication, serial or network. I have alot of data/value pairs. So I used attributes to describe the value, instead of making alot of elements. For readability, its easier as well. There's a possibility that the data points may be entered into a database, so if I use an XSLT later that I wont have issues w/ linking an attribute to a database field.
The usage of elements vs attributes is very subjective. It can be influence by the source and the usage of the output. You can also mix the two together. If you need to change the format of your XML document to meet someone else's needs, you can always transform it via XSLT.
George
|
|
|
|
|
Wheatbread wrote: what should be an attribute versus a child element.
I dont really know what best practices for this are, this is my opinion
Use attributes for what you treat as atomic data, elements for everything that has structure.
Let me explain what I mean when I write "what you treat as..". For example: you have some element representing same thing as record in database, and it has "last modified" attribute. You can view date as NOT atomic. It has attributes "year", "month" etc. You should then have element "last modified" with those attributes, shouldn't you? BUT most probably you use that "last modified" information kind of atomicaly, you always assign\read DateTime object in your code, right. In DB, you have one column of Date type, not columns lastmodifiedday, lastmodifiedmonth, lastmodifiedyear.. Its one value after all. Think of it as number of ticks since 1900 represented as string in dd-mm-yyyy format. Or so.
Umm, now I dunno if my "explanation" did make it clearer
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
I'm not sure I'm following your explanation. My data model is for communication (serial or network), so we matching a database definition isnt as important. But there's a good chance data will eventually be mapped to a database table. So I want to make sure that when we do have to write to a DB that the data model is designed correctly and not complicate things.
-C
|
|
|
|
|
Wheatbread wrote: I'm not sure I'm following your explanation.
No surprise here, I have some difficulties explaining this.
What I was trying to say is that
<file lastModified="22\8\2006" name="file.txt" size="10" />
is ok but
<file name="file.txt" size="10" >
<lastModified>
<day value="22" />
<month value="8" />
<year value="2006" />
</lastModified>
</file>
is probably bad. You can say that day\month\year is VALUE of date, but you cant say it CONTAINS day and month and year, IMO
But
<computer name="myPC">
<disc name="c" >
<folder name="texts">
<file name="text.txt">
</folder>
<folder name="pics">
<file name="image.jpg">
</folder>
<disc name="d" />
</computer>
is better then
<computer name="myPC">
<disc name="c" >
<folder name="texts" files="text.txt;text2.txt" />
<folder name="pics" files="image.jpg;picture.gif" />
<disc name="d" />
</computer>
because when you want to do
<computer name="myPC">
<disc name="c" >
<folder name="texts">
<file name="text.txt" lastModified="8/7/2004">
</folder>
<folder name="pics">
<file name="image.jpg" lastModified="4/3/2006">
</folder>
<disc name="d" />
</computer>
you are screwed in second scenario, because you expected folders to be atomic (csv list of files describes folder) but they suddenly aren't. As in my example with date, if you say VALUE of folder is list of its files (which is retarded idea but its only example of bad practice; best I could think of ) you get the first scenario, but if you realize that folder CONTAINS files you get the second one.
And if there is some flaw in my thinking let me know guys.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
Hi,
As per the three module of development (related to data access from SQL to the front -end and reports on Html)i have developed (ASP.net With c#) n tested it. Its running ok. Speed is also fine as compare to Crystal Report.
Sincearly i have no idea about how the data(format)comes from SQL to the main application.
Is there any better solution,for data transfer in XML . if there is then plzz kindly reply me..
sincerly,
Shriya
|
|
|
|
|
Hi,
I am not very much sure about what your question is.
Do you need to get the data from the database in XML format. Then if you are using Sql Server, try to use FOR XML inn select sql.
Alternatively you can fill data into a dataset and then use that dataset to create a XmlDataDocument. Then if you are using XSLT for your report, then you can make use of the XmlDataDocument.
Pradipta Basu
|
|
|
|
|
Element Nodes in XML file have attributes associated with them.
I randomly select element nodes in an XML document after loading it using DOM class. The selected element node can have zero or more Attributes associated with it.
If selected xml node got attribute I displayed it in ListView.
Attribute Name: Being First ColumnHeader
Attribute Value: Being Second ColumnHeader
Name Item being label of listView can be edited if i enable "labeledit" in property of listView.
But Value under the subitem cannot be edited.
1. How can i simply edit both field using listView?
2. Is there any other control or method that will help me create 2 columns according to number of attributes and enable me to edit fields?
3. How can I edit listBox items? Is there any possibility of using it.
Your reply will be highly appreciated.
Thank you.
Language: Visual C#
|
|
|
|
|
please help me to get some good examples of .xsd file. i need to taks a seminar about this
thankyou
yesuprakash
|
|
|
|
|
Ask google or the search engine of your choice and you will get many answers.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
XPath: /APP/INCOME[@USERID='25']/@Amount
|
|
|
|
|
how to avoid showing coifirm dialog box after editing the xml file through program.
thankyou
Yesuprakash
|
|
|
|