Questions tagged [xmlroot]

34 questions
15
votes
1 answer

Difference between using XMLRoot/XMLElement and using Serializable() attributes (in c#)

what is Difference between using XMLRoot/XMLElement and using Serializable() attributes? how do i know when to use each ?
Rodniko
  • 4,926
  • 20
  • 69
  • 93
15
votes
4 answers

XmlRoot() for Xml Serilization does not work

I'm trying to get my httphandler to print out an XML file with the format: ... ...
burnt1ce
  • 14,387
  • 33
  • 102
  • 162
11
votes
3 answers

Get attribute names and values from ElementTree

I have an XML element with several attributes. I've been using the ElementTree package. After I've parsed a tree from an xml file, I'm getting the document root, but I want to get the requested attribute, or even the entire list of…
Igal
  • 4,603
  • 14
  • 41
  • 66
5
votes
1 answer

error in marshalling - missing xmlrootelement annotation error

When i call one of the WSDL operation from a spring project, i am getting following exception - com.sun.istack.internal.SAXException2: unable to marshal type "com.pkg.wsdl.ABC" as an element because it is missing an @XmlRootElement annotation I am…
chappalprasad
  • 775
  • 4
  • 15
  • 26
4
votes
2 answers

Rename serializable class

If i Serializable the following code using XmlSerializer. [XmlRoot("products")] public class Products : List { } public class Product { } I get the following xml How to i write to get the…
Andreas
  • 451
  • 1
  • 4
  • 3
3
votes
1 answer

Add Attribute to XMLROOT ElementName

I have a class with the class attribute : [XmlRoot(ElementName = "RootXML")] public class Apply { /My Properties } now to create an xml from the above class I use below function : public virtual string RenderXml() { XmlTextWriter writer =…
Zaki
  • 5,540
  • 7
  • 54
  • 91
2
votes
3 answers

XmlRoot attribute is needed to deserialize but in xml file there is no root attribute

I have a question: I have an .xml file 2 Live Test Event 6 Test tournament
Oleg Kopot
  • 23
  • 3
2
votes
1 answer

JaxB unmarshall unexpected element error

I am running jaxb on the following xml file. bear Using the following java code. import java.io.File; import javax.xml.bind.JAXBContext; import…
jgr208
  • 2,896
  • 9
  • 36
  • 64
1
vote
1 answer

XML Schema declare a root

If I have a schema like this:
Ingó Vals
  • 4,788
  • 14
  • 65
  • 113
1
vote
4 answers

I have @xmlrootelement , but keep getting this exception: unable to marshal type as an element because it is missing an @XmlRootElement

I am trying to marshall/unmarshall a class which does not have @xmlrootelement. Can anyone help ? The marshaller I am using is of type Jaxb2Marshaller of the Spring's org.springframework.oxm.jaxb Most of the solutions present are of type…
Santosh Ravi Teja
  • 247
  • 1
  • 7
  • 18
1
vote
1 answer

Serializing class decorated with XmlRoot, error when used in List

When i try to serialize a class element of type Test, it gives an xml with root element as "testing" which is set using XmlRoot. But when I try to serialize an element of class Elems, Test element is serialized with root element "Test" instead of…
Rozuur
  • 4,115
  • 25
  • 31
1
vote
1 answer

Nested FOR XML results with SQL Server

My MS SQL table has following data ID CONTENT UDH TO FROM ------------------------------------------- 1 HELLO 1 9812 22 2 HELLO 1 9813 22 3 HELLO 1 9814 …
1
vote
1 answer

How to print pretty JSON using docx4j into a word document?

I want to print a simple pretty json string (containing multiple line breaks - many \n) into a word document. I tried the following but docx4j just prints all the contents inline in one single line (without \n). Ideally it should print multiline…
Dhwanit
  • 610
  • 1
  • 9
  • 17
1
vote
1 answer

XmlRoot attribute serialization to a file

I have the following code serializing an object into a file: TemplateClass item = new TemplateClass(); // Fill in item XmlSerializer writer = new XmlSerializer(typeof(TemplateClass)); using (StreamWriter file = new StreamWriter(filePath)) { …
Romonov
  • 8,145
  • 14
  • 43
  • 55
1
vote
0 answers

Take off XmlRootElement

I´m making a request. I should return a String. My Answer should be: 1 My atually answer is this: 1
Goldbones
  • 1,407
  • 3
  • 21
  • 55
1
2 3