You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Andrew Mak <ma...@ca.ibm.com> on 2008/08/27 18:35:24 UTC
peeking inside a composite file
Hi,
I was wondering if Tuscany has any API or utility class that would allow
me to peek inside a composite file to get the targetNamespace and name,
without having to parse the entire file?
Thanks in advance,
Andrew Mak
Re: peeking inside a composite file
Posted by Raymond Feng <en...@gmail.com>.
You can use the StAX to get the QName as follows:
Assuming url points to the composite file:
URLConnection connection = url.openConnection();
connection.setUseCaches(false);
XMLStreamReader reader =
factory.createXMLStreamReader(connection.getInputStream());
reader.nextTag();
assert Constants.COMPOSITE_QNAME.equals(reader.getName());
String ns = reader.getAttributeValue(null,
"targetNamespace");
if (ns == null) {
ns = XMLConstants.NULL_NS_URI;
}
String name = reader.getAttributeValue(null, "name");
reader.close();
Thanks,
Raymond
From: Andrew Mak
Sent: Wednesday, August 27, 2008 9:35 AM
To: user@tuscany.apache.org
Subject: peeking inside a composite file
Hi,
I was wondering if Tuscany has any API or utility class that would allow me
to peek inside a composite file to get the targetNamespace and name, without
having to parse the entire file?
Thanks in advance,
Andrew Mak