|
Hi all,
i am new to .net technology (and also to XML). please can anyone explain me these:
1.When we are constructing an XML DTD, how can we create an external entity reference in an attribute value?
2.please can u Give some examples of XML DTDs or schemas that we generally have to work with?
3.which type of applications that can benefit from using XML?
Thanks,
Rahi
If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Rahithi wrote: 3.which type of applications that can benefit from using XML?
XML is *great* for configuration files, and, of course, for data exchange between different applications. About every configurable application that exports or imports data will benefit from XML.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
Thanks for ur response. can u answer my first 2 questions please.......
If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Is the following what you are looking for?
File hello.ent contents:
<?xml encoding="UTF-8"?>Hello
File entity.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE greetings [
<!ENTITY greet SYSTEM "hello.ent">
]>
<root>
<say word="&greet;"/>
</root>
As for other questions see:
http://www.w3schools.com/dtd/default.asp[^]
"We make a living by what we get, we make a life by what we give." --Winston Churchill
-- modified at 2:51 Saturday 16th December, 2006
|
|
|
|
|
I have this schema as shown below. I need to generate an xml file that will use the schema. Note the nested nature of the schema. What i got gave error validated by client. I am in deep sh*t now need help get this working. i work with vb.net or c#
the schema
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="PENCOM_REPORT"
targetNamespace="http://tempuri.org/QCR101.xsd"
xmlns="http://tempuri.org/QCR101.xsd"
xmlns:mstns="http://tempuri.org/QCR101.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
attributeFormDefault="qualified"
elementFormDefault="qualified">
<xs:element name="QCR101" msdata:IsDataSet="true" msdata:EnforceConstraints="False">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="REPORT_HEADER">
<xs:complexType>
<xs:sequence>
<xs:element name="REPORT_CODE" type="xs:string" minOccurs="0" />
<xs:element name="REPORT_NAME" type="xs:string" minOccurs="0" />
<xs:element name="PFA_CODE" type="xs:string" minOccurs="0" />
<xs:element name="PFA_NAME" type="xs:string" minOccurs="0" />
<xs:element name="REPORT_DATE" type="xs:string" minOccurs="0" />
<xs:element name="TOTAL_AMOUNT" type="xs:string" minOccurs="1" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="REPORT_DATA">
<xs:complexType>
<xs:sequence>
<xs:element name="ITEMS_DATA" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="SERIAL_NO" type="xs:string" minOccurs="0" />
<xs:element name="DESCRIPTION" type="xs:string" minOccurs="0" />
<xs:element name="AMOUNT" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="REPORT_FOOTER">
<xs:complexType>
<xs:sequence>
<xs:element name="CONTACT_DETAILS" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="NAME" type="xs:string" minOccurs="0" />
<xs:element name="TEL_NO" type="xs:string" minOccurs="0" />
<xs:element name="EXTN" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
tanks in advance
-- modified at 11:01 Wednesday 13th December, 2006
|
|
|
|
|
Either enable the "Ignore HTML tags in this message" checkbox beneath the smilies or replace all < with <, cause otherwise we see neither your schema nor the xml fragment.
"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
|
|
|
|
|
Ok there is the schema, but I don't see your XML file that happens to fail validation.
"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
|
|
|
|
|
Hey guys, i'm fearly new to xml (espacially xpath) and need a little help here..
My XML document looks like
<br />
<?xml version="1.0" encoding="ISO-8859-1" ?><br />
< Properties><br />
< Property><br />
<Number>10</Number><br />
<Type>Type A</TypeNL><br />
<Description>A nice description</Description><br />
</Property><br />
</Properties><br />
(added spaces in front of the Properties and Property element, because else they appear as smiley)
I'm trying to loop through all properties (ofcourse in my xml document there are more than one properties) and would like to retrieve the number, type and description of the property. I'm writing my app in C#
<br />
XPathDocument docRegion = new XPathDocument(_XmlFilePath);<br />
XPathNavigator navRegions = docRegion.CreateNavigator();<br />
XPathNodeIterator nodeProperty = navRegions.SelectChildren("//Properties/Property", "");<br />
I would expect the SelectChildren function to return a collection of all properties in my XML document, but i'm not getting the expected values returned. Am I doing something wrong, do I need a diffrent approach or something??
|
|
|
|
|
Eduard Keilholz wrote: (added spaces in front of the Properties and Property element, because else they appear as smiley)
You can enable the "Ignore HTML tags in this message" checkbox beneath the smilies to easily post XML fragments. Unfortunately this also disables the other formatting possibilities, but most times it's far more practically than inserting spaces or replacing < with <.
Eduard Keilholz wrote: Am I doing something wrong, do I need a diffrent approach or something??
Documentation says that SelectChildren selects only directly nested children and the first parameter should be a local name and no XPath expression. So either change the first parameter to "Property" (not sure if this works cause I'm not sure whether "Properties" is the current node of the the XPathNavigator ) or use the Select method which allows the use of XPath expressions.
"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
|
|
|
|
|
Seems to be working pretty sweet, thnx a lot!
Stefan Troschütz wrote :
You can enable the "Ignore HTML tags in this message" checkbox beneath the smilies to easily post XML fragments. Unfortunately this also disables the other formatting possibilities, but most times it's far more practically than inserting spaces or replacing < with <.
I thought this would filter all html tags which disables me to insert xml
|
|
|
|
|
I never thought about it, but the checkbox label could be misinterpreted the way you did. Maybe "Treat HTML tags and there content as plain text" would be more precise.
"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 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
|
|
|
|