xml

Returning XML From a WCF Service

I am creating a WCF Web Service in which one method (exposed in Service) return data in XML format as given below: public string QueryDirectoryEntry() { XmlDocument doc = new XmlDocument(); doc.Load(@"c:\" + FILE_NAME); return doc.InnerXml; } If the client call this method ther service return data ...

XPATH issue in C# and PowerShell

Hello everyone, I have the following XML file and I want to print out the baseAddress value, then change the value and write update to the same XML file. My problem is I am using the following scripts in PowerShell to manipulate, and seems the related value could not be retrieved. I think the reason may be there is a sign '.' in the el...

Delete and concatenate child nodes using XSLT

hey everyone my xml looks like this: <someElement> <DB> <DBELEMENT> </DBELEMENT> <DBELEMENT> </DBELEMENT> </DB> <GROUP> <OBJECT> <something type="name"> <value>some value </value> </something> <something type="desc"> <value someattribue="AA"> <StyledElement> ...

PowerShell manipulating XML file issue

Hello everyone, Suppose I have the following XML file, and I want to use PowerShell (version 1.0) to manipulate the XML file to get the value for Foo (in this sample, value I want to get is "Foo Value") and Goo (in this sample, value I want to get is "Goo Value"), any ideas how to implement? $FooConfig = [xml](get-content .\Foo.exe.con...

Can .NET XmlSerializer class deserialize InnerXml as a string?

I have a very specific deserialization need, see example below: say I have following class: [Serializable] public class Person { public string Name { get; set; } public string PersonXml { get; set; } } and following XML <Person> <Name>John</Name> <PersonXml><someXmlFragment>text</someXmlFragment></PersonXml> </Person> Wh...

How to reference a non-nested group of tags in XSD

Is there a way to refer to a group of non-nested XML tags in XSD schema, e.g.: <foo> <a>a_val</a> <b>b_val</b> <c>c_val</c> <d>d_val</d> </foo> <bar> <e>e_val</e> <b>b_val2</b> <c>c_val2</c> <f>f_val</f> </bar> What I want to achieve is to have tags <b> and <c> extracted separately as complexType or abstract elemen...

Feed Reader: Should It Always Be Client Side?

Should a browser based Feed Reader always use something on the client side, like Javascript? UPDATE: I mean, specifically, for the Parsing of RSS. If you can offload it to the browser, it seems almost irresponsible to make your server do the work. Still, there are plenty of advantages in my particular situation to doing it server side....

How can I store multiple items in an XML file for easy parsing?

Suppose I have a number of elements to store like: fruitList = "apple", "orange", "banana", "kiwi", ... How would you store these in XML? <FruitList>"apple", "orange", "banana", "kiwi"</FruitList> OR <Fruits Type="Expensive" List="apple", "orange", "banana", "kiwi"> </Fruits> Is there a better way? Whatever method is chosen, ho...

Best way to process large XML in PHP

I have to parse large XML files in php, one of them is 6.5 MB and they could be even bigger. The SimpleXML extension as I've read, loads the entire file into an object, which may not be very efficient. In your experience, what would be the best way? ...

How to find a repeated string and the value between them using regexes?

How would you find the value of string that is repeated and the data between it using regexes? For example, take this piece of XML: <tagName>Data between the tag</tagName> What would be the correct regex to find these values? (Note that tagName could be anything). I have found a way that works that involves finding all the tagNames ...

Factorial in XSLT limit?

Hi. I have the following factorial function implemented in XSLT: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; <xsl:output method="text"/> <xsl:template match="/"> <xsl:apply-templates> </xsl:apply-templates> </xsl:template> <xsl:template match="facto...

Complex types and XSDs

Edit: I don't think I asked this question very well. I'm completely re-phrasing it All: I am trying to represent the following XML in XSD (I'm working with the Visual Studio XSD editor, as I really don't know XSD very well). Here's the XML: <TheParentNode> <AnElement ID="x">123</AnElement> </TheParentNode> I want to specify tha...

Why does this Python script only read the last RSS post into the file?

Hi! Im trying to fix a Python script which takes the posts from a specific RSS feed and strips them down and inputs them into a text file. As you can see beneath, there are two main print functions. One prints only to the shell once run, but it shows all of the posts, which is what I want it to do. Now, the second part is where the prob...

why is embedding JSON in XML bad?

My gut tells me that putting one format in another is wrong, but I can't seem to come up with concrete reasons. <root> <stuff> thing </stuff> <more> <[!CDATA[{"a":["b","c"]}]]> </more> </root> versus just putting it in the xml <root> <stuff> thing </stuff> <more> <a> b </a> <a> c </a> </more> </root> Th...

How do I generate an HTML file using XSL?

Hello, As I understand it, using XSL to generate documents has two parts: 1) An XML document which references an XSL stylesheet 2) An XSL stylesheet Let's say that I want to generate a document using XSL, and then send it to a friend. Without relying on the stylesheet being available on the internet, and without including the styleshe...

LINQ to XML - How to implement a simple XLink lookup - finding nodes anywhere

So we have an XML file with a very simple implementation of XLink: <root xmlns:xlink="http://www.w3.org/1999/xlink"&gt; <firstChild id="ID1" /> ... <ref xlink:href="#ID1" /> </root> Let's assume the XLink implementation won't get any more complicated than that. However the important point is that the element referred to (in this...

XmlDocument.SelectSingleNode returns null for root node

I have several xml files whose postfix is not .xml, but .component Now I want to handle them in the c# program, but It seems that the c# cant even find the root element of these xml files var doc = new XmlDocument(); doc.Load(path); // MG: edited to Load based on comment XmlNode root = doc.SelectSingleNode("rootNodename"); It seems th...

Windsor-like Xml configuration <include> in Unity

Hello, I have common DI configuration for my application and integration tests. However, a couple of the dependencies do differ; e.g. my IEMailGateway in the integration tests uses a decorated version so that 'real' e-mails are not sent. In Windsor I would have the 'main' configuration xml file and simply add an include to add the var...

deserialisation of multiple elements not working?

Dear friends, i have the following XSD: <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; <xsd:element name="Persons"> <xsd:complexType> <xsd:sequence> <xsd:element name="PersonFullName"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:pattern value="[A-Z0-9]{3,50}"/> </xsd:restriction> ...

How to populate the values of XML in JSP?

Hi, I am new to the Java development. I need to populate XML fields in a JSP page. I didn't do with JDBC actually i have written the Mysql wrapper in C it executes the query and return the table value as XML. Help me how to populate the XML fields in JSP? how to read the XML file using JDBC ResultSet? Will be much helpful thanks ...