|
hi sudheer,
is it .NET? If yes, look on System.Xml namespace, expecially classes System.Xml.XmlTextReader or System.Xml.XmlDocument on MSDN.com, there are lot of exmaples how to read XML files.
If it's not .NET, what is it?
best regards,
David 'DNH' Nohejl
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
Hai,
i want to retrive the xml data, i have one xml file, that file contain some data. i want retrive the that data. please givethe procedure how to retrive?
thanks
sudheer
|
|
|
|
|
Hi,
I need an application which displays a tee view of an XML document.
I have seen many applications which do the same. But I need to draw the Tree with the element text and with out attributes node in the tree.
Let me make it clear..
Here is snippet of the xml file.
--------------------------------------------------------------------------------
- <device name="TenGiPHY" deviceversion="1.0.0.1" productid="24622.10.0.1" fileversion="1.0.2.2">
- <group name="PMA/PMD">
- <folder name="MDIO">
- <register name="PMACTR1" length="16" address="0x10000" resetval="0x2040" access="rw">
<longname>PMA Control Register 1
<value>0x0
- <element name="RES" offset="15" length="1">
<longname>PMA reset
<desc>This bit remains set (1) while reset is in progress and is cleared (0) automatically as soon as reset is completed. The first MDIO access following an MDIO reset must be an address frame. Access to this bit affects the entire device.
<modified>false
<state text="Normal operation" value="0x0">
<state text="All registers within the TenGiPHY-L are set to their initial state." value="0x1">
----------------------------------------------------------------------------------------
The tree I need is
TenGiPHY
|
|_PMA/PMD
| |
| |_MDIO
| | |_PMACTR1
| |_NextFolderName
|
|_Next group name
and so on..
But I have the least idea to do this.
Could anyone help me?
Thank you,
|
|
|
|
|
Sorry, some lines are missing..
I am giving the xml lines here again..
<!DOCTYPE device (View Source for full doctype...)>
- <device name="TenGiPHY" deviceversion="1.0.0.1" productid="24622.10.0.1" fileversion="1.0.2.2">
- <group name="PMA/PMD">
- <folder name="MDIO">
- <register name="PMACTR1" length="16" address="0x10000" resetval="0x2040" access="rw">
<longname>PMA Control Register 1</longname>
<value>0x0</value>
- <element name="RES" offset="15" length="1">
<longname>PMA reset</longname>
<desc>This bit remains set (1) while reset is in progress and is cleared (0) automatically as soon as reset is completed. The first MDIO access following an MDIO reset must be an address frame. Access to this bit affects the entire device.</desc>
<modified>false</modified>
<state text="Normal operation" value="0x0" />
<state text="All registers within the TenGiPHY-L are set to their initial state." value="0x1" />
</element>
|
|
|
|
|
what is the requirements needed to host the xml web service i mean if the hosting dosn't support .NET framework can i publish the web service on it or no, please help me
|
|
|
|
|
Has anyone else had any issues with the Dataset.SaveXML method??
I have found that with this xml file
<database xmlns="http://tempuri.org/Database.xsd">
<DBTable>
<name>vwAppointment</name>
<selectall>false</selectall>
<selectbykey>false</selectbykey>
<update>true</update>
<insert>true</insert>
<delete>false</delete>
<DBFields>
<name>pkId</name>
<primarykey>false</primarykey>
<datatype>int</datatype>
<nullable>false</nullable>
<length>4</length>
<precision>10</precision>
<selectby>-1</selectby>
<updateby>false</updateby>
<deleteby>false</deleteby>
</DBFields>
<DBFields>
<name>AppointmentType</name>
<primarykey>false</primarykey>
<datatype>varchar</datatype>
<nullable>false</nullable>
<length>30</length>
<precision>30</precision>
<selectby>-1</selectby>
<updateby>false</updateby>
<deleteby>false</deleteby>
</DBFields>
</DBTable>
</database>
and this xslt
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<xsl:for-each select="database/DBTable/name">
<<xsl:value-of select="*"/>Table>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
The transform does not work, however if i remove this attribute
xmlns="http://tempuri.org/Database.xsd"
the transform will work (well work to some extent with my dodgy xpath queries).
Why does this happen? how can i get around this? is there an xslt setting i need to change?
Thanks for your help
Pete
|
|
|
|
|
Hi there.
I have an SQL XML template residing on a web server which takes a parameter (japanese characters) and calls a stored proc.
If I hard code the japanese parameter into the XML file, I can execute the stored proc and have records returned.
However, the XML template is called from an ASP page, also on the web server, using the ("Msxml2.ServerXMLHTTP.4.0") object. I call the template using the following code:
-------------------------------------------------------------------------
Set SearchObj = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0")
templateURL = "http://localhost/xmldir/xmltemplate/global_search.xml"
Param = "?PRIM_NAME=" & JAPANESE_NAME
SearchObj.open "GET", templateURL & Param, False
SearchObj.send
-------------------------------------------------------------------------
Variable 'JAPANESE_NAME' is a company name in japanese (ie. double byte).
Every other instance of double byte characters are handled fine by my ASP and XML, however it is only when I am trying to send some double byte characters as arguments to this template that it fails.
I have also tried passing the japanese data to the XML template manually via a URL call....but it also fails.
My XML template looks like this:
----------------------------------------------------------
<root xmlns:sql="urn:schemas-microsoft-com:xml-sql" sql:xsl="global_search.xsl">
<sql:header>
<sql:param name="PRIM_NAME">
<sql:query>
exec my_stored_proc @PRIM_NAME
----------------------------------------------------------
I can run the stored proc through query analyzer and give it some japanese characters as arguments and it works fine.
Can SQL XML templates handle double byte data passed as a parameter or does it have to be hard coded in the file?
Any help would be appreciated
|
|
|
|
|
Greetings,
I have a xsl file which transforms my xml file into a html page, and when I use it as a style sheet for my xml data it works fine. But when I use XslTransform called from a c# application it doesn't transform the file correctly it replaces my java script "<" symbol with "<" symbol.
I have this code in a "
|
|
|
|
|
hi,
replace "<" with "<;". Yes, in JS. It will render/transform (?) correctly for browser. Than it should be fine. Also, you should (or even must, I am not sure) call XslTransform constructor that take XmlResolver as a parametr. (I don't know if it's really needed bt other constructors are obsolete )
best regards,
David 'DNH' Nohejl
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
Thanks for the reply,
It still didn't work, it just left the &.l.t.; (kept formating it as <) in the javascript code. I saw a code blurb where they suggested commenting out the "<![CDATA" section with // so it won't resolve that.
At any rate here is a snippet of the code I am trying to do.
------------------------------------------------------------
<?xml version='1.0'?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>
<xsl:template match="/">
<HTML>
<BODY>
<SCRIPT type="text/javascript">
//<![CDATA[
function test()
{
// Note, in this example the < has "." between them to keep the formating, since the forum kept reformating it as "<"
for(int index=0;index&.l.t.;10;index++)
{
... Do something here.
}
}
//]]>;
</SCRIPT>
...
...
It doesn't make any sense why this isn't working.
|
|
|
|
|
hi,
belive me, it works maybe remove <![CDATA]> ?I am working on something similar and it is working!
here is (simplified) my code:
<br />
<script language="JavaScript"><br />
function ShowSelect(o)<br />
{ <br />
var x2 = document.getElementsByTagName('div');<br />
for(i=0;i<x2.length;i++)<br />
{<br />
<br />
}<br />
}<br />
</script><br />
</head><br />
<body><br />
<br />
try<br />
{<br />
XslTransform xt = new XslTransform();<br />
xt.Load(StylesheetURL);<br />
xt.Transform(SourceURL,ResultURL,new XmlUrlResolver());<br />
}<br />
catch(Exception ex)<br />
{<br />
<br />
throw;<br />
}<br />
What I missed? This is definitely working in my app. I can't send you my original code cuz my boss wouldn't be happy about it
David
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
Thanks David!
Your C# snippet worked great! Maybe it was because I was using the obsolete constructors or something.
Thanks again!!
|
|
|
|
|
|
the reason it does not work is that your html is not valid....
you don't have to escape < if you have specificied the out as html and the document root is html.
your code does not work as I suspect your "html" tag is in upper case!
http://www.w3.org/TR/xslt#section-HTML-Output-Method[^]
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
that's better solution. thx Philip!
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
Hello,
Iam a beginner in .NET and please help me in doing this:
I have a node like this:
<root>
<pleasehelp>100</pleasehelp>
<firstchild>
<pleasehelp>200</pleasehelp>
</firstchild>
<secondchild>
<pleasehelp>200</pleasehelp>
</secondchild>
</root>
I want to add an attribute to <pleasehelp> only under
<secondchild>, so i want something like this...
<secondchild>
<pleasehelp myattribute>200</pleasehelp>
</secondchild>
I learnt that attributes can be added only to elements.
Is there any method of traversing, using an Xpath query and getting that element alone(not node), so that i can add attribute to element directly, without loading that node into XmlDocument object and finding element and then adding attribue to it.
Please Help me..thanks in advance..
Regards,
Manivannan.P
|
|
|
|
|
hi,
you can add attribute directly like this
<secondchild text="First">
and u can get help to search node from following code.
XmlDocument doc = new XmlDocument();
doc.Load(Server.MapPath("XYZ.xml"));
XmlNode element;
XmlElement root = doc.DocumentElement;
// this line will get the node with the id
attributes matching with the
// selected category's ID.
element = root.SelectSingleNode("descendant::yournode[@text='First']");
// create a new node and append it under the selected category's node.
XmlElement node = doc.CreateElement("yournode");
node.SetAttribute("text","urstring");
node.SetAttribute("id","urvalue");
element.AppendChild(node);
// saving the updations in XML File.
doc.Save(Server.MapPath("XYZ.xml"));
Regards,
Manoj
|
|
|
|
|
If I have an XML file that contains classic "Contact" or "Customer" or "Purchase Order" data used in examples out there, is there a way I could, from within this same XML file provide the user with an interface to edit this data in a webbrowser?
This should be such that, for example, the user would call:
http://myserver.com/thexmlfile.xml
and be presented with a form (editable fields) instead of the default XML view of data that internet explorer provides.
Is this possible?
Sammy
"A good friend, is like a good book: the inside is better than the cover..."
|
|
|
|
|
I am new to the System.Xml, I am converting the code existing in MSXML parser code to System.Xml in unmanaged C++.
I am able to load the file with the Load() function, and I am getting the validate error from the catch block. there is no problem in loading the xml documet into the "m_docPtr" this is System.Xml.XmlDocument type.
After loading the xml document into "m_docPtr", I will change the values of some child elements. Now I want to validate the document again with the new chages.
In MSXML parser Validate() methode in the document class to do the above, Can I get the similar method or some procedure with System.Xml classes.
Thanks.
|
|
|
|
|
Hi Murlai,
do you mean System.Xml.ValidatingReader? Or do I miss something? In post below[^] you can see how to use it. In case you saw it, or even you know System.Xml.ValidatingReader, and it can't be used for some reason, plz tell me.. I don't do unmanaged so I can lear<n something
best regards,
David 'DNH' Nohejl
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
this->m_docPtr = new XmlDocument();
this->m_xmlTestReader = new XmlTextReader(strFileName);
this->m_xmlValidateReader = new XmlValidatingReader(this->m_xmlTestReader);
// load the strFileName into the document
this->m_docPtr->Load(this->m_xmlValidateReader);
System::String __gc *strParam = new String("//*/Range");
System::Xml::XmlNode *nodePtr = m_docPtr->SelectSingleNode(strParam);
System::String __gc *strVale = new String("-1290");
nodePtr->set_InnerText(strVale);
// Now I want validate the data..
----------------------------
When loading the xml file the Range is some positive value, if it is negative when loading the exception comming with error message, this is fine for me. I want validae after modifying the Range value to -1290 is not valied as per the .xsd schema. In the above How can I validate? Please help.. Thanks.
|
|
|
|
|
|
I'm bringing back customer data from Sql Server 2000 using a FOR XML EXPLICIT stored proc and intend to save using OPENXML. Bringing back the data works just fine. The problem I have is on what to do should the client want to enter a new customer. I've tried created an XSD and a strongly typed DataSet so that the initial values would get populated but can't get the DataSet in the correct hierarchy. So, I'm wondering if I should just create an xml template with all the default fields and values that I want and just use that when the client wants a new customer.
I have to think that there is a better way of doing this. The synchronization kind of worries me. If I change the stored proc, I have to change the XSD, the DataSet as well as the initial xml template. Does anyone have a better solution to what I'm trying to accomplish?
|
|
|
|
|
Hi There,
I need to provide intelligent xml editor feature in a WinForm window application. I am thinking about hosting the .NET xml designer but couldn't find if it is
possible and how to proceed if it is possible. If you have experience regarding this or using some other xml editor, I would appreciate your feedback.
Thanks in advance,
John
|
|
|
|
|
I am looking for a good article about the cost of using XML and the resultant Serialization that is required - compared to using binary representation
Can anybody help?
|
|
|
|