xml

XML file reader using C#

<a><b>26a83f12c782</b><c>128</c><d>12</d></a> static void ReadXml1() { string b = null; double c = 0; double d = 0; using (XmlTextReader xmlReader = new XmlTextReader("Testxml.xml")) { if (xmlReader != null) { while (xmlReader.Read()) { ...

Test when there are no properties

I've create a script that will delete all user properties for a particular individual. I'm able to use an api call to get the users' properties from the xml. And I'm using a delete api to remove each property. I would like to be able to test when there are no more properties left and then output a message accordingly. Inside the for lo...

JavaScript: Given the DOM, find the largest piece of continuous text (content part)

Hi Folks, The goal is to find the largest piece of contiguous text in a document. The problem is that the largest piece does not lie under a single element, e.g. a blog post which has <p> tags in it so iterating nodes and comparing innerHTMLs is not going to work. And by getting innerText of an element, the root node always contains big...

XPath query with descendant and descendant text() predicates

I would like to construct an XPath query that will return a "div" or "table" element, so long as it has a descendant containing the text "abc". The one caveat is that it can not have any div or table descendants. <div> <table> <form> <div> <span> <p>abcdefg</p> </span> </div> <table> ...

How to extract titles, images and text from any kind of feed ?

I want to extract the titles, images and text from any kind of Feed Rss ( feedburner, xml, etc ). How can I do this with javascript ? For example, I want to extract the stuff above from this feed: http://feeds.mashable.com/Mashable and from this feed: http://casadipacheco.blogspot.com/feeds/posts/default ...

C# winform treeview control to search xml

Can someone help me with a code snippet in C# to search(linq preferably) for either XML element or attribute in a XML loaded using treeview control? The user has a search string tab in a WinForm UI and on a successful search the given node containing the element or attribute string is highlighted. ...

How to receive XML data produced by a website?

There is some php API service that when sent some parameters in query string, it returns date in xml format. So I was wondering how to send call the page and get back the result in c# .net. Like with an xml reader or xml scheme? ...

How to display XML into a tree view?

I have a variable of XDocument, and I want to display its structure in a TreeView. I tried TreeView1.DataSource = doc; but I got this error HierarchicalDataBoundControl only accepts data sources that implement IHierarchicalDataSource or IHierarchicalEnumerable. ...

Generate Json schema from XML schema (XSD)

Does anybody know how to generate a Json schema from a existing XML schema (XSD file)? Are there any tools available for this? ...

.net webservices using complex types with other platforms e.g. Java

I'm working on a .net system that will both expose and consume web-services with another system to pass data back and forth - the other system is java based. Our proposed XSD contains complex types and some concern has been expressed about using complex types and how we'd be better sticking to simple types. I'd have thought .net would ...

Scala: Convert org.w3c.dom.Document to scala.xml.NodeSeq

Hey folks, Title is pretty self-explanatory. How can I convert an instance of org.w3c.dom.Document to a Scala NodeSeq, to enjoy it's facilitation? Cheers Parsa ...

How to extracting the XML contents of an XDocument variable ?

I have the a full XML file in an XDocument variable which I get from some API like this using (var reader = XmlReader.Create("website")) { doc = XDocument.Load(reader); } I need to get the structure of the XML and navigate through its nodes, but through the XDocument variable, I only get the whole document ...

Problem in converting data of XML file into hashmap

I am using following code to convert a XML file data into HashMap. I had modified the old code. Now it is running properly. but only for XML file having following structure: < root> < tag> < subtag>< /subtag> < subtag>< /subtag> : </tag> < tag> < subtag>< /subtag> < subtag>< /subtag> ...

How to serialize class members as attributes to xml in C#.

Hi All, I am trying to serialize my object to xml. A serializer seemingly serializes all data members as children, but I want to serialize all members as attributes, not children. Here's a code example: [DataContract] public class MyDataClass { [DataMember] int foo = 24; [DataMember] string bar = "brabrabra"; } This will b...

Is there a way to create XML dat according to an XSD in Perl?

I have a CSV file, and a XSD from which I need to create an XML file which conforms to the XSD Schema. Is there a way to create an XML according to an XSD? Doing it manually seems unreasonable. ...

Display a random item from an xml list

I've been looking all over, and I can't find a clean solution (that I can make sense of). How can I pull an entry at random from an xml list? My starting point is as follows (which pulls the latest entry): <script type="text/javascript"> var xmlDoc=null; if (window.ActiveXObject) {// code for IE xmlDoc=new ActiveXObject("Microsof...

Android: Tabstyle

Hi All, I have a simple question... How can I make a simple white background under my tab style.. This is my source main source code.xml I was thinking to make a new LinearLayout with an android:background="#ffffff" Can anyone help thinking.. i'm an beginning android programmer .. Thanks a lot!! Here is my source code: <?xml ...

(x)HTML: Parsing bizarre tags

I am building my own humble (x)html parser. All is ok, but some doctype tags break it. Let me show you: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [ <!ENTITY D "&#x2014;"> <!ENTITY o "&#x2018;"> <!ENTITY c "&#x2019;"> <!ENTITY O "&#x201C;"> <!ENTITY C "&#x201D...

HTML tags and attributes sored in xml file

Hi, Does anyone own or knows where can i find a xml file containing all the HTML tags and attributes? Thanks. ...

Is there a class to convert between .NET data and XML types?

I need to convert .NET data to XML types and viceversa and I wonder if there is any class already on the .NET framework to do it. UPDATE I want to perform a data type conversion. ...