I have an XmlObject (org.apache.xmlbeans.XmlObject) obj .
XmlObject obj;
...
obj.toString(); //<xml-fragment>n2</xml-fragement>
// content ="n2"
String content = obj.toString().substring(14, obj.length() - 15)
What is the right way to store "n2" in content?
From the javadoc for SimpleValue - "All XmlObject implementations can be coerced to SimpleValue"
So the correct approach would be:
//to get the string value
((SimpleValue)obj).getStringValue();
//to set the string value
((SimpleValue)obj).setStringValue("n2");