[jdom-interest] parsing adds attributes
Dolf Andringa
dolf.andringa at elcyion.nl
Sun Nov 20 06:45:47 PST 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi All,
Sorry to have another question. This time I did look at the FAQ (both of
JDOM and of Xerces). I've got a question that may be more related tot
Xercers/SAX than JDOM, but I hope you can help me with it.
As soon as I parse an XML document using the apache xalan parser with
the SAX API, elements that do not have attributes automatically get the
attribute type with the value simple. I don't want this. Any idea why
this happens and how I can prevent it from happening?
Code example:
builder=SAXBuilder("org.apache.xerces.parsers.SAXParser")
handelaar=myErrorHandler()
builder.setErrorHandler(handelaar)
builder.setFeature("http://xml.org/sax/features/validation",1)
builder.setFeature("http://apache.org/xml/features/validation/schema",1)
doc=builder.build(sys.argv[1])
nsgml=Namespace.getNamespace("http://www.opengis.net/gml")
nsows=Namespace.getNamespace("http://www.opengis.net/ows1.2")
print doc.getRootElement().getChild("featureMember",nsgml).getAttributes()
This outputs:
[[Attribute: type="simple"]]
The original XML file is in the attachment again.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFDgIwbKaTTNeXBMakRAjKgAKCNtxFWxLfluEjESh2xC87A0vUftACdHkmu
GczWm0+blhFTzaEkNZnpQ1o=
=HfAQ
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: G10.gml
Type: text/xml
Size: 28405 bytes
Desc: not available
Url : http://www.jdom.org/pipermail/jdom-interest/attachments/20051120/e9f9ed3e/G10.xml
More information about the jdom-interest
mailing list