How to get line/col info for WSDLResource element [message #630887] |
Tue, 05 October 2010 13:18 |
|
Hi all,
The BPEL editor needs to do some additional validation (i.e. resolving imports) so it needs access to the WSDL element line and column numbers. I see there's a WSDLParser class which (presumably if the TRACK_LOCATION option is TRUE) will report this info, but I can't seem to find where this class is actually used, much less how to get access to it. Can anyone help?
Thanks!
Bob
|
|
|
|
Re: How to get line/col info for WSDLResource element [message #630908 is a reply to message #630899] |
Tue, 05 October 2010 14:43 |
|
Thanks Valentin! I should have realized this since WSDLParser is a utility class and all of its methods are static
BTW, the javadocs I found for this package mention that this is a provisional API - how "provisional" is it and is it likely to change in the near future?
Thanks again,
Bob
|
|
|
|
Re: How to get line/col info for WSDLResource element [message #630970 is a reply to message #630937] |
Tue, 05 October 2010 16:49 |
|
Sorry for being so dense, but I can't seem to get this to work
I have a WSDL that starts out like this:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions ...>
<types xmlns="http://schemas.xmlsoap.org/wsdl/">
<schema xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://www.example.org/" schemaLocation="some_invalid_location.xsd"/>
</schema>
</types>
and obviously, I'm trying to report the line/column of the missing import location. The WSDL Resource is part of a ResourceSet so I've set the load options to include "TRACK_LOCATION=true" like so:
Map opt = resSet.getLoadOptions();
opt.put("TRACK_LOCATION", Boolean.TRUE);
then the WSDL resource is created and loaded like so:
Resource res = resSet.createResource(uri, kind);
res.load(opt);
Then I navigate the model to get the imported XSD element:
Definition definition = res.getContents().get(0);
List<XSDSchema> schemas = definition.getETypes().getSchemas();
XSDSchemaContent sc = schemas.getContents().get(0);
int startLine = WSDLParser.getStartLine( sc.getElement() );
int startCol = WSDLParser.getStartColumn( sc.getElement() );
The startLine and startCol are always returned as 1/1 (likewise, end line/column are always the last character position in the WSDL file).
Also, the <definition> start line/column is reported as 1/1 (shouldn't the start line be 2?)
What am I missing here?
|
|
|
|
Powered by
FUDForum. Page generated in 0.02989 seconds