axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pavel.Pospichal" <pavel.pospic...@gmail.com>
Subject Re: create MessageElement from a XML file (Problem with blank namespaces)
Date Sun, 30 Aug 2009 14:16:32 GMT
Hi,
the problem might be that the builder is using parser which is not 
configured as namespace aware. Check the builder configuration by 
DocumentBuilder.isNamespaceAware(), or at factory, and set as you like.

Paul

A.H wrote:
> Please help me. Thanks for any tips
>
>     A.H wrote:
>     Hello,
>
>     I have to create a MessageElement from a XML-file. I used
>     following programm-code to open and parse the XML-file. After that
>     initialize the MessageElement attribute with the content of the
>     XML- File.
>
>
>     ////////////////////// Code ///////////////////////////
>
>     File xmlfile = new File(pathOfFile);
>     MessageElement[] mElemente = new MessageElement[1];
>     DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance();
>     DocumentBuilder builder = factory.newDocumentBuilder();
>     Document document = builder.parse(xmlfile);
>     Element element = document.getDocumentElement();
>     mElemente[0] = new MessageElement(element);
>
>
>     ////////////////////// Code ///////////////////////////
>
>     When i print the content of the MessageElement "mElement[0]" using
>     the function "getAsString" like:
>     System.out.println(mElemente[0].getAsString());
>
>     i notice that every attribut or elements become a blank namespace
>     like this:
>     personID
>
>     this blank namespace does not exist in the originale XML-file and
>     i dont know exactly why and from where they come. So when i send
>     the whole SOAP Message with this MessageElement to my Webservice i
>     become following error:
>
>     com.ctc.wstx.exc.WstxParsingException: Non-default namespace can
>     not map to empty URI (as per Namespace 1.0 # 2) in XML 1.0
>     documents at [row,col {unknown-source}]: [2,21]
>
>     My questions are:
>
>     1- How can i create a MessageElement from a XML file
>     2- How can i remove the blank namespace
>     3- Who cause this problem
>
>
>     Thank you very much for Help
>
>
> View this message in context: Re: create MessageElement from a XML 
> file (Problem with blank namespaces) 
> <http://www.nabble.com/create-MessageElement-from-a-XML-file-%28Problem-with-blank-namespaces%29-tp25169266p25211715.html>
> Sent from the Axis - User mailing list archive 
> <http://www.nabble.com/Axis---User-f232.html> at Nabble.com.


Mime
View raw message