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: [email protected]
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

Reply via email to