|
List Info
Thread: How to get attributes from a XmlObject DomNode?
|
|
| How to get attributes from a XmlObject
DomNode? |

|
2007-09-10 05:11:13 |
|
| Hi
all,
How to get
attributes from a XmlObject DomNode?
I have the
following schema:
<xs:complexType
name="cardType">
<xs:sequence>
<xs:element name="available-credit"
type="xs:int"/>
<xs:element name="credit-used"
type="xs:int"/>
</xs:sequence>
<xs:attribute name="name"
use="required">
<xs:simpleType>
<xs:restriction
base="xs:NMTOKEN">
<xs:enumeration
value="MasterCard"/>
<xs:enumeration
value="Visa"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="number" type="xs:string"
use="required"/>
</xs:complexType>
I use xmlbean to geneated the type jars
and parse the belowing xml to be a CardType instance, when I want to get the
attributes from XmlObject dom node, I get null(expect name and number
attribute), from the internal node impl(_textsource) I find it's a document
fragment (org.apache.xmlbeans.impl.store.Xobj$DocumentFragXobj),
in org.w3c.dom.Node api, get attribute form document fragment
should be null, so are there some other way to get those attributes?
(I don't know the exactly attributes the currenly XmlObject
has)
<xml-fragment
name="Visa" number="1111">
<available-credit>1000</available-credit>
<credit-used>2000</credit-used> </xml-fragment>
Thanks a
lot!
Terry
|
[1]
|
|
|
about | contact Other archives ( Real Estate discussion Medical topics )
|