In Oracle, you can use the XMLElement() function to create an element, as in:
XMLElement('name', 'John')
But how to create an element in a specific namespace? For instance, how to create the following element:
<my:name xmlns:my="http://www.example.com/my">John</my:name>
...
I'm writing a Windows service in C#. I've got an XmlWriter which is contains the output of an XSLT transformation. I need to get the XML into an XMLElement object to pass to a web service. What is the best way to do this?
...
I'm using a webservice which returns an XmlElement object to my c# program. I would like to read information from the XmlElement using Xpath. What is the best way to create an XPathDocument from the XmlElement?
...
Hello,
I'm new to C#, and just started using XmlElement and its SelectSingleNode method. In my XML file there's a tag that may have a value (i.e. <tag>value</tag>) or be empty (i.e. <tag></tag>). If it's empty, SelectSingleNode returns null.
I'm currently using the following code to catch the value of the tag:
XmlElement elem = ....
...
I am creating several XmlElements used in a larger XML Document.
XmlElement thisElement = xmlSearchParameters.CreateElement("value");
thisElement.InnerXml = this.searchParameters[key];
This works well for most instances, but if the value of searchParameters[key] happens to include an & symbol, I get one of the two following errors:
...
I have a method which returns XML in C#( type: XmlElement). How do I return an Empty XML? Can't use string.Empty obviously.
...
I create a window in WPF. The constructor takes a "ref XmlElement settings" which is used to display information in that window.
In the constructor, I clone those settings:
_ClonedSettings = (XmlElement)settings.Clone();
and I keep a pointer to the original settings:
_OriginalSettings = settings;
The UI modifies _ClonedSettings. Then ...
I would like to marshall a Collection as nested attributes.
Right now I have:
@XmlElement(name="entry")
public Collection<Integer> getSizes(){ ... }
which returns:
<entry>1</entry>
<entry>2</entry>
But I would like to get:
<entry id="1"/>
<entry id="2"/>
Is this possible without new classes?
...
I asked a question about deserializing based on an attribute with data contracts. Apparently this isnt possible so I have to convert my DataContract to use XmlElement's (see http://stackoverflow.com/questions/2177079/net-represent-xml-in-class-without-xsd)
I'm assuming datacontracts cannot intermingle with xmlelements. How can I define...
I need to be able to define an attribute with a prefix in a xml element.
For instance...
<nc:Person s:id="ID_Person_01"></nc:Person>
In order to do this I though that the following would have worked.
XmlElement TempElement = XmlDocToRef.CreateElement("nc:Person", "http://niem.gov/niem/niem-core/2.0");
TempElement.SetAttribute("s:id"...
i have the following code below but sometime the "serving_description" tag isn't there. Right now i just put a try catch around it but i wanted to find out if there was a cleaner way to handle this scenario.
XmlElement servingElement = (XmlElement)servingNode;
serving.Id = Convert.ToInt32(servingElement.GetElementsByTagName("serving_id...
Hi,
I am trying to use a Web Service that defines a type with some mandatory fields having a default value:
<complexType name="DocumentRegistrationRequest">
<sequence>
<element name="title" type="string">
<annotation>
<documentation>Title/subject of the document</documentation>
</anno...
Hi.
Is there a way to convert different named xml nodes into one class when deserializing an XML
Example XML:
<items>
<aaa>value</aaa>
<bbb>value</bbb>
</items>
Normaly i would write:
[XmlRoot("items")]
class Items
{
[XmlElement("aaa")]
public string aaa;
[XmlElement("bbb")]
public string bbb;
}
But now i...
Suppose I have an XML-serializable class called Song:
[Serializable]
class Song
{
public string Artist;
public string SongTitle;
}
In order to save space (and also semi-obfuscate the XML file), I decide to rename the xml elements:
[XmlRoot("g")]
class Song
{
[XmlElement("a")]
public string Artist;
[XmlElement("s")...
Hi
I want to search for an element value in all the XML files(assume 200+) in a folder using C#.
My scenario is each file will contain multiple item tags.So i have to check all item tags for User Selected SearchValue. Eg: ABC123
Currently i am using foreach loop and it's taking longtime.
Could you please suggest me a better option t...
i return an xmlElement from a WCf method.
when i do a service reference in the client, the same method is returning XElement instead of XmlElement.
i tried everything: updating the service reference, making a new service reference, but it doesn't help.
This is my client:
ServiceReference1.BasicServiceClient basicWCfClient = new Servic...