[prev in list] [next in list] [prev in thread] [next in thread]
List: xmlbeans-user
Subject: All methods on type return NULL
From: "Vijai Kalyan" <vijai.kalyan () gmail ! com>
Date: 2007-05-24 0:30:21
Message-ID: 18b36e500705231730w2c4832c3rb3d8a2ae37c2313a () mail ! gmail ! com
[Download RAW message or body]
Hello Everyone,
I have a slight problem when using XMLBeans.
I created a schema in which one of the elements has tag "Constant". It is
used like so:
<Constant name="PI" value="3.142" type="number"/>
The schema defines this element to be of type "TConstant". When using
scomp.exe, this generates the interface
TConstant
and the implementation class
TConstantImpl
Now, I execute an XPath query that returns a DOM "Node" using JAXP. I then
parse the returned node. For example,
Node node = XPath.evaluate("//Constant[name="PI"]", new InputSource("foo.xml"),
XPathConstants.NODESET);
TConstant constantdecl = TConstant.Factory.parse (node);
So far so good. If I do
constantdecl.toString()
I get
<Constant name="PI" value="3.142" type="number"/>
which is correct. However, if I use any of the generated methods for
retrieving the attributes such as getType(), getName() or getValue(), I keep
getting null. The XML returning methods like xgetType(), xgetValue(),
xgetName() also return null.
I am not sure why this is so. If the toString() method is able to recreate
the XML correctly, I think it should be reasonable to expect the attribute
value retrieval methods to return the correct values.
Any help will be appreciated!
Thanks,
Vijai.
[Attachment #3 (text/html)]
<div>Hello Everyone,</div>
<div> </div>
<div>I have a slight problem when using XMLBeans.</div>
<div> </div>
<div>I created a schema in which one of the elements has tag "Constant". It \
is used like so:</div> <div> </div>
<div><Constant name="PI" value="3.142" \
type="number"/></div> <div> </div>
<div>The schema defines this element to be of type "TConstant". When using \
scomp.exe, this generates the interface</div> <div> </div>
<div>TConstant</div>
<div> </div>
<div>and the implementation class </div>
<div> </div>
<div>TConstantImpl</div>
<div> </div>
<div>Now, I execute an XPath query that returns a DOM "Node" using JAXP. I \
then parse the returned node. For example,</div> <div> </div>
<div>Node node = XPath.evaluate("//Constant[name="PI"]", new \
InputSource("foo.xml"), XPathConstants.NODESET);</div> <div>TConstant \
constantdecl = TConstant.Factory.parse (node);</div> <div> </div>
<div>So far so good. If I do</div>
<div> </div>
<div>constantdecl.toString()</div>
<div> </div>
<div>I get</div>
<div> </div>
<div><Constant name="PI" value="3.142" \
type="number"/></div> <div> </div>
<div>which is correct. However, if I use any of the generated methods for retrieving \
the attributes such as getType(), getName() or getValue(), I keep getting null. The \
XML returning methods like xgetType(), xgetValue(), xgetName() also return null. \
</div> <div> </div>
<div>I am not sure why this is so. If the toString() method is able to recreate the \
XML correctly, I think it should be reasonable to expect the attribute value \
retrieval methods to return the correct values. </div> <div> </div>
<div>Any help will be appreciated!</div>
<div> </div>
<div>Thanks,</div>
<div> </div>
<div>Vijai.</div>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic