Get the schemaLocation from the XML file

14 views
Skip to first unread message

Pranav

unread,
Oct 20, 2007, 8:30:43 AM10/20/07
to bo...@googlegroups.com
Hi,

I have this XML file, which has the *xsi:schemaLocation* I need to read
this tag and get the path (relative / absolute) for the Schema Location.
Is there something (API) available in JAXP or JDOM to get the same? Or
if something else is available, please suggest it.

Please advice.

Thanks,
Pranav

--
Pranav Aggarwal

DISCLAIMER:
-----------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
It shall not attach any liability on the originator or Altair or its affiliates. Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the opinions of Altair or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of
this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have
received this email in error please delete it and notify the sender immediately. Before opening any mail and
attachments please check them for viruses and defect.

-----------------------------------------------------------------------------------------------------------------------

Venkatraman S

unread,
Oct 20, 2007, 8:44:35 AM10/20/07
to bo...@googlegroups.com
On 10/20/07, Pranav <Pranav....@altair.com> wrote:
I have this XML file, which has the *xsi:schemaLocation* I need to read
this tag and get the path (relative / absolute) for the Schema Location.
Is there something (API) available in JAXP or JDOM to get the same? Or
if something else is available, please suggest it.

Couple of ways :
1) let me start with the dirtiest ;) -  if you are not comfortable with SAX/DOM, then write a regular expression for getting the contents of a tag .. something like : <" + tagName + ">([^<>]*)</" + tagName + ">"

2) Use a SAX/ DOM parser

3) Use XPATH api.

-vEnKAt

--
Blog @ http://blizzardzblogs.blogspot.com
Reply all
Reply to author
Forward
0 new messages