[prev in list] [next in list] [prev in thread] [next in thread]
List: xmlbeans-dev
Subject: Child Text Node lost after calling newDomNode()
From: "Xue, Feng" <feng.xue () Mobility ! com>
Date: 2004-04-20 15:43:21
Message-ID: 85A702D32188D51193BD00508BBD5243099D3F4B () cbexch01 ! mobility ! com
[Download RAW message or body]
Hello,
I have a simple custom XMLBean compiled from a schema like:
<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="http://mydomain.com/xsd/myBean"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://mydomain.com/xsd/myBean"
elementFormDefault="qualified">
<simpleType name="MyType">
<restriction base="double"/>
</simpleType>
<element name="MyElement" type="tns:MyType"/>
</schema>
An the Java code:
import com.mydomain.xsd.myBean.*;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
...
...
void myMethod() {
MyElementDocument bean = MyElementDocument.Factory.newInstance();
bean.setMyElement(3.14d);
// this prints the the xml with text including 3.14d
System.out.println(bean.xmlText());
Element dom = ((Document) bean.newDomNode()) .getDocumentElement();
...
}
The problem is, after getting the DOM object my calling newDomNode(), the
Text Node for "3.14d" is lost from the DOM tree; i.e. instead of
<tns:MyElement
xmlns:tns="http://mydomain.com/xsd/myBean">3.14d</tns:MyElement>
I get XML like:
<tns:MyElement xmlns:tns="http://mydomain.com/xsd/myBean" />
Question: how come the DOM tree is not complete?
Any help is very much appreciated.
-Feng
- ---------------------------------------------------------------------
To unsubscribe, e-mail: xmlbeans-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-dev-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic