|
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?
|
|
|
|
|
|
What are the simple ways to validate an xml document against a schema, I am looking at XmlValidatingReader, which seems to be the solution,does anybody have a full piece of code I can try?
Berlin Brown
GIS Developer
http://www.retroevolution.com
|
|
|
|
|
hi,
it is very simple... i don't have full code, bt I don't think it is a problem.
I am working on app where I validate XML against my XSD:
this method reads XML with XmlValidatingReader
<br />
public void ValidateStg(String URL)<br />
{<br />
XmlValidatingReader r = new XmlValidatingReader(new XmlTextReader(URL));<br />
try<br />
{ <br />
r.ValidationType=ValidationType.Schema;<br />
r.ValidationEventHandler+=new System.Xml.Schema.ValidationEventHandler(r_ValidationEventHandler);<br />
r.Schemas.Add(null,"http://localhost/mySchemaExample/Schema.xsd");<br />
while(r.Read())<br />
{<br />
<br />
}<br />
}<br />
finally<br />
{<br />
r.Close();<br />
}<br />
}<br />
there is handler called when there is some problem ( I write down error message into xml log):
<br />
private void r_ValidationEventHandler(object sender, System.Xml.Schema.ValidationEventArgs e)<br />
{<br />
XmlDocument doc = new XmlDocument();<br />
doc.Load(@"C:\Inetpub/wwwroot/mySchemaExample/report.xml");<br />
XmlElement el = doc.CreateElement(null,"error",null);<br />
el.InnerText = e.Message;<br />
doc.DocumentElement.AppendChild(el);<br />
doc.Save(@"C:\Inetpub/wwwroot/mySchemaExample/report.xml");<br />
}<br />
As you see, it is really simple.
best regards,
David 'DNH' Nohejl
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
Hi,
Can anyone tell me if it's possible, by using DTD to prevent elements having identical attribute content. The element and attribute names can be identical as shown in the example below.
e.g., this should cause validation to fail ...
<MyElem MyAttrib="10"/>
<MyElem MyAttrib="10"/>
Thanks !
|
|
|
|
|
Hmm.. use ID type which quarantees that the values are unique?
e.g. <!ATTLIST MyAttrib type ID>
|
|
|
|
|
Have any one a method to read a data from a xml with XPath expression document and view a result with a datagrid
sorry for interruption
Ehab Nady
|
|
|
|
|
Can't you turn an XML document into a dataset ? If not, I wonder if a nodecollection would work, seeing as it's an array.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Here is my document:
<br />
<br />
<data><br />
<meetings><br />
<meeting id="900" title="Meeting Title" date="1/1/2005" location="Main Office"><br />
<attendee personID="100" /><br />
<attendee personID="101" /><br />
</meeting><br />
</meetings><br />
<people><br />
<person id="100" firstname="John" lastname="Doe" /><br />
<person id="101" firstname="Jane" lastname="Smith" /><br />
<person id="102" firstname="Jack" lastname="Williams" /><br />
</people><br />
</data><br />
<br />
I want to be able to display the meeting info, then display a table of meeting attendees. When displaying attendees, I want to match their related person info in a different node in the document. e.g. the desired output for the single meeting above would be:
Meeting Title, Main Office, 1/1/2005
John Doe
Jane Smith
Here is how I'm approaching it:
<br />
<xsl:template match="/data/meetings/meeting"><br />
<xsl:for-each select="attendee"><br />
<p><br />
<xsl:value-of select="/data/people/person[@id=@personID]/@firstname" /><br />
<xsl:value-of select="/data/people/person[@id=@personID]/@lastname" /><br />
</p><br />
</xsl:for-each><br />
</xsl:template><br />
The stylesheet loads fine, but there is no output for each person. If I hard-code the @personID value in the query I'm using to get to the specific person, then it works fine. Where am I going wrong?
Michael Hodnick
www.kindohm.com
|
|
|
|
|
Hi,
this tries to select person whose id is same as personID.
(it would work with data like this:
<person id="100" personID="100" firstname="John" lastname="Doe" /> )
You need to tell parser, that attribute personID is not atribute of person tag, but attribute of attendee tag. I'm not sure if I'm correct, but try something like this:
<xsl:value-of select="/data/people/person[@id=./@personID]/@firstname" />
Hope this helps
|
|
|
|
|
Hi,
I have been searching for a Parser that will parse both RSS and ATOM feeds. So far i have found numerous of RSS and a number of ATOM only parser (Not both) that were written in .NET.
I was wondering if anyone can point me in the right direction of know of any such projects in .NET.
So far, the only parser i seen that parses both is one from Magpie (php) and Unvieral.... (python).
Thanks
|
|
|
|