I want to parse some XML that looks like this:
<node>
This is
<child>
blah
</child>
some
<child>
foo
</child>
text
</node>
How do I get access to the text node children in Simple XML?
Can I access them in the correct order of text and element children?
Do I need some other package for this?
...
Hello,
I've narrowed down the code to this (ignore the colourization):
var theXML:XML =
<xml>
word
</xml>;
for each (var i:XML in theXML.*) {
trace(i);
}
For some reason, this prints out "word" over and over indefinitely. Any thoughts as to why? I'm a bit out of practice and have a feeling it's something obvious...
I am currently using Microsoft's FOR XML PATH feature to pull data back from MS SQL Server in an XML format. I really like the feature but am always uncomfortable about using vendor specific functions.
Do any of the other major database vendors have something similar?
Edit
Let me be more specific with type of features I'm looking for...
Is this a valid (well-formed) XML document?
<?xml version="1.0" encoding="UTF-8" ?>
<outer>
<inner>©</inner>
</outer>
At issue is whether the HTML/XHTML "" entity encoding is valid in an XML document where there is no DTD or schema to define it. An alternative way of expressing the above would be to say this:
<?xml version="1...
I have created a .NET web service that returns an object, say Class "getResponse".
The WS returns the following response ...
<getResponse xmlns="http://tempuri.org/getCustomer/wsdl/">
<Result xmlns="http://tempuri.org/getCustomer/">
<ResultCode>OK</ResultCode>
<ErrorsList/>
</Result>
</getResponse>
while th...
I use the following XmlSchema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.test.com/XmlValidation"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns:m="http://www.test.com/XmlValidation">
<xs:element name="test">
<xs:com...
Hi,
I am working on an application that parses a .csproj file. It needs to add an additional value to the <NoWarn> property if it exists. In the event that the property does not exist I want the application to add this property with its value to the specified parent node. How can I achieve this? I am using LINQ-to-XML to parse the proj...
Given this XML data:
<root>
<item>apple</item>
<item>orange</item>
<item>banana</item>
</root>
I can use this XSLT markup:
...
<xsl:for-each select="root/item">
<xsl:value-of select="."/>,
</xsl:for-each>
...
to get this result:
apple, orange, banana,
but how do I produce a list where the last comma is not present? ...
I'm developing a custom XML schema for communicating data between application components. What do the SO folks consider a good (or, ideally, best) practice for selecting the URI for the namespace? Why?
Some basic consideration:
Our product has many components, and it's probably a good idea if the namespace indicates which component w...
I need to create a service that will return XML containing data from the database. So I am thinking about using an ASHX that will accept things like date range and POST an XML file back. I have dealt with pages pulling data from SQL Server and populating into a datagrid for visual display but never into XML for delivery, what is the best...
I need to remove white spaces between xml tags, e.g. if the original xml looks like:
<node1>
<node2>
<node3>foo</node3>
</node2>
</node1>
I'd like the end-result to be crunched down to single line:
<node1><node2><node3>foo</node3></node2></node1>
Please note that I will not have control over the xml structure, so th...
I might have messed up on a design decision. Instead of using a strongly typed collection of custom objects, I have used a generic List. Essentially, what i have is:
public class AreaFields
{
[XmlArray("Items")]
[XmlArrayItem("Item")]
public List<Fields> Fields { set; get; }
[XmlAttribute]
int id { set; get; }
}
pu...
You can verify an XPath expression against an XML doc to verify it, but is there an easy way to verify the same XPath expression against the schema for that document?
Say I have an XSD schema like this:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" ... etc>
<xsd:element name="RootData">
<xsd:complexType>
<xsd:seq...
I would like to know if I create an instance of Msxml2.FreeThreadedDOMDocument.4.0 in one thread, can I safely manipulate the instance from different threads using raw pointers?
...
I'm looking for an efficient way to compare and get differences between two XML-based parse trees.
What would you suggest to be the best way to store those differences? I would have done this:
XML A:
<w:p>
<w:pPr>
<w:spacing w:after="1"/>
</w:pPr>
<w:r>
<w:t>World</w:t>
</w:r>
</w:p>
XML B:
<w:p>
<w:pPr>
<w:s...
I have a situation where my XSLT files should display prices alongwith decimals conditionally, depending on whether the input XML contains decimals or not. So, I can receive XML files with two types of values - XML will contain all prices formatted with decimals upto two places (I call this one "Decimal-XML") or the prices will be rounde...
What's your opinion on encoding accented and special characters in XHTML and XML.
Do you convert each and every non-US-ASCII character to named entity?
You use ISO-8859-x or Win-125x and encode to entities anything else?
Or do you directly write everything in UTF-8, without bothering about entities?
Please elaborate on which and why...
I got this XML file
<root>
<level1 name="A">
<level2 name="A1" />
<level2 name="A2" />
</level1>
<level1 name="B">
<level2 name="B1" />
<level2 name="B2" />
</level1>
<level1 name="C" />
</root>
Could someone give me a C# code using LINQ, the simplest way to print this result:
(Note the extra space if it is a level2 node)...
How can I create one XML Schema that will work with multiple but similar XML files. For instance, for a Food Recipes website I have a recipe XML called 'dessert' another 'indian' and another 'vegetarian', they are all pretty much the same, the only thing that changes is the root element. Here's an example of a file:
<?xml version="1.0" ...
Hi
I am parsing an XML file and storing the results in a record, but am having some trouble.
Im trying to store the results (content of my XML tags) into the fields of my record..
My record (at the moment there is only 1 set of XML elements). I think that the Parser.curconten is causing the problem...
Type
TXMLAlert=Record
alert...