[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>&nbsp;</div>
<div>I have a slight problem when using XMLBeans.</div>
<div>&nbsp;</div>
<div>I created a schema in which one of the elements has tag &quot;Constant&quot;. It \
is used like so:</div> <div>&nbsp;</div>
<div>&lt;Constant name=&quot;PI&quot; value=&quot;3.142&quot; \
type=&quot;number&quot;/&gt;</div> <div>&nbsp;</div>
<div>The schema defines this element to be of type &quot;TConstant&quot;. When using \
scomp.exe, this generates the interface</div> <div>&nbsp;</div>
<div>TConstant</div>
<div>&nbsp;</div>
<div>and the implementation class </div>
<div>&nbsp;</div>
<div>TConstantImpl</div>
<div>&nbsp;</div>
<div>Now, I execute an XPath query that returns a DOM &quot;Node&quot; using JAXP. I \
then parse the returned node. For example,</div> <div>&nbsp;</div>
<div>Node node = XPath.evaluate(&quot;//Constant[name=&quot;PI&quot;]&quot;, new \
InputSource(&quot;foo.xml&quot;), XPathConstants.NODESET);</div> <div>TConstant \
constantdecl = TConstant.Factory.parse (node);</div> <div>&nbsp;</div>
<div>So far so good. If I do</div>
<div>&nbsp;</div>
<div>constantdecl.toString()</div>
<div>&nbsp;</div>
<div>I get</div>
<div>&nbsp;</div>
<div>&lt;Constant name=&quot;PI&quot; value=&quot;3.142&quot; \
type=&quot;number&quot;/&gt;</div> <div>&nbsp;</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>&nbsp;</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>&nbsp;</div>
<div>Any help will be appreciated!</div>
<div>&nbsp;</div>
<div>Thanks,</div>
<div>&nbsp;</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