users@jaxb.java.net

namespaces by marshaller output

From: Boris Koprinarov <bkoprinarov_at_googlemail.com>
Date: Tue, 30 Sep 2008 07:31:35 -0700 (PDT)

Hi All,

I have some questions about jaxb Marshall output.

My xml file:

<GAEB>
<GAEBInfo></GAEBInfo>
<PrjInfo></PrjInfo>
<Award>
<DP>55</DP>
<AwardInfo></AwardInfo>
<OWN></OWN>
<BoQ ID="123">
<BoQInfo></BoQInfo>
<BoQBody>
<Remark ID="1">
<Description>
<CompleteText>
<DetailTxt></DetailTxt>
<OutlineText>
<OutlTxt>
<TextOutlTxt>
<p>
<"span">Erklaerung Einheitspreis/Gesamtbetrag<"/span"> (without "")
</p>
</TextOutlTxt>
</OutlTxt>
</OutlineText>
</CompleteText>
</Description>
</Remark>
</BoQBody>
</BoQ>
</Award>
</GAEB>


And here is my output from the marshaller:
< xmlns:ns2="http://www.w3.org/2000/09/xmldsig#"
xmlns:ns3="http://www.mytest.com">
    <ns3:TextOutlTxt>
        <ns3:p>
            <ns3:span>Erklärung Einheitspreis/Gesamtbetrag</ns3:span>
        </ns3:p>
    </ns3:TextOutlTxt>
</>

Between <TextOutlTxt> tags is some html code. I am trying to get that code
as a “plain” html code without the xml tags. In my output there are
1. < xmlns:ns2="http://www.w3.org/2000/09/xmldsig#"
xmlns:ns3="http://www.mytest.com">

2. <ns3:> namespace Prefix.

Is there any way to remove them from my marshaller output?

 Here is my code:

---Unmarshaller :

try {
                JAXBContext jaxbContext =
JAXBContext.newInstance("my.package”);


                iJaxbContext=jaxbContext;
             
             } catch (JAXBException ex) {
                    LOGGER.info("Can not bind the xml file with the schema!"
+
                                                               
ex.toString());
             }
             
try {
                                Unmarshaller unmarshaller =
iJaxbContext.createUnmarshaller();
                
                JAXBElement<TgGAEB> GAEBtempElement = (JAXBElement<TgGAEB>)
                        unmarshaller.unmarshal(this.getFile());
               
                iObject.addLookup(GAEBtempElement.getValue());
                
            
            } catch (JAXBException ex) {
                LOGGER.info("Can not get the Unmarshall for the xml file!"
                                                            +
ex.toString());
             }



---Marshaller:

public String jaxbElementToString(Object aElement){


        StringWriter htmlString = new StringWriter();
        try {

            
JAXBContext jaxbContext = JAXBContext.newInstance("my.package");
                
                             iJaxbContext=jaxbContext;
             
             } catch (JAXBException ex) {
                    LOGGER.info("Can not bind the xml file with the schema!"
+
                                                               
ex.toString());
             }
             
             try {
                
Marshaller marshaller = iJaxbContext.createMarshaller();
          
marshaller.setProperty(marshaller.JAXB_FORMATTED_OUTPUT,Boolean.TRUE);
marshaller.setProperty(marshaller.JAXB_FRAGMENT,Boolean.TRUE);
              
                  
                  JAXBElement el = new
JAXBElement(myname,aElement.getClass(),aElement);
                
                  java.io.StringWriter sw = new java.io.StringWriter();
                marshaller.marshal(el, sw);
              
             } catch (JAXBException ex) {
                LOGGER.info("Can not get the Unmarshall for the xml file!"
                                                            +
ex.toString());
             }

         return htmlString.toString();
}


Boris
-- 
View this message in context: http://www.nabble.com/namespaces-by-marshaller-output-tp19743303p19743303.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.