[jdom-interest] SAXOutputter problem

Per Norrman per.norrman at austers.se
Thu May 12 07:00:37 PDT 2005


Hi,

If your jdomSchemaElement or any of its descendants contain the
namespace declaration for  'soapenc', then that prefix should
be reported.

If the namespace declaration for soapenc is in an ancestor of
jdomSchemaElement, then the prefix will not be reported.

You could probably argue wether or not this is the correct
behaviour, but this is probably the cause of your problem.

A fix could be:

for (Iterator iter = doc.getRootElement().getAdditionalNamespaces().iterator(); 
iter.hasNext();) {
     Namespace ns = (Namespace) iter.next();
     jdomSchemaElement.addNamespaceDeclaration(ns);
}

out.output(jdomSchemaElement);


/pmn

zamp at libero.it skrev:
> Hi All,
> 
> I have some problem in reading xsd inside my wsdl..these are my instructions..
> 
> (I use a specia parser for schema reading: XSOM=XML Schema Object Model..a sun API based on SAXParser)
> 
> XSOMParser parser  = new XSOMParser();
> parser.setErrorHandler(new ErrorReporter(System.out));
> SAXOutputter out = new SAXOutputter(parser.getParserHandler());
> out.setReportNamespaceDeclarations(true);
> out.output(jdomSchemaElement);
> XSSchemaSet xss = parser.getResult();
> 
> where jdomSchemElement represents jdomElement for "schema"
> 
> Now the problem reguards a portion of schema where are used namespace references
> inside attributes values (see down the piece)
> 
> <xsd:complexType name="ArrayOf_xsd_string">
> <xsd:complexContent>
>      <xsd:restriction base="soapenc:Array">
>       <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
>      </xsd:restriction>
> </xsd:complexContent>
> </xsd:complexType>
> 
> I have made this question to XSOM mailing list.....:
> 
> XSOMParser doesn't recognize "soapenc"...I have read some documentation about
> SaxParser (wich is behind XSOMParser) and is possible to solve problem by using
> opportunely startPrefixMapping an endPrefixMapping methods inside the
> ContentHandler...now I have seen that these methods are present in the
> XSOMParser's contentHandler but then why it does not work?
> 
> ....and this has been the answer:
> 
>      "And looking at the JDOM code, the output(Element) method isn't 
>       implemented properly; it doesn't take the in-scope namespace bindings 
>       into account.
>       As a result, the generated SAX events don't contain the prefix-URI 
>       association for soapenc, and that gets XSOM confused.
>       This really needs to be fixed on the JDOM side."
> 
> What do you think about?...Any suggestions? Where is the problem? (in JDOM or in XSOMParser?)
> 
> Thanks in advance...
> 
> 
> 
> 
> 
> 
> ____________________________________________________________
> 6X velocizzare la tua navigazione a 56k? 6X Web Accelerator di Libero!
> Scaricalo su INTERNET GRATIS 6X http://www.libero.it
> 
> 
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com
> 



More information about the jdom-interest mailing list