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.