Hi,
Thanks for the answer.
The definition of <TextOutlTxt> is:
<xs:complexType name="tgOutlTxt" mixed="false">
<xs:annotation>
<xs:documentation>Kurztext</xs:documentation>
</xs:annotation>
<xs:choice maxOccurs="unbounded">
<xs:element name="TextOutlTxt" type="tgMLText" minOccurs="0"
maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>Textbeschreibung mit
Einschraenkungen</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="TextComplement" type="tgTextComplement" minOccurs="0"
maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>Textergaenzung</xs:documentation>
</xs:annotation>
</xs:element>
</xs:choice>
</xs:complexType>
and the tgMLText
<xs:complexType name="tgMLText" mixed="false">
<xs:annotation>
<xs:documentation>Mehrzeilige Textbeschreibung</xs:documentation>
</xs:annotation>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="p" type="tgpMLText">
<xs:annotation>
<xs:documentation>Absatz</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="div" type="tgdiv">
<xs:annotation>
<xs:documentation>Abschnitt in formatiertem Text</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="span" type="tgspan">
<xs:annotation>
<xs:documentation>Teilabschnitt in formatiertem Text</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="br" type="tgbr">
<xs:annotation>
<xs:documentation>Zeilenumbruch</xs:documentation>
</xs:annotation>
</xs:element>
</xs:choice>
<xs:attribute name="textWidth" type="tgNormalizedString"/>
</xs:complexType>
I don’t want to edit my Schema and the xml file. They are already written by
somebody else. I just want to read the content. Is there an other way to
marshall the jaxb object without the xml overhead? I have implemented the
NamespacePrefixMapper. But I don’t think that this is the right way. This
class always returns a prefix.
Boris
>
Wolfgang Laun-2 wrote:
>
>> What is the XML schema definition for the element tagged <TextOutlTxt>?
>
>> If you want to have HTML tags in the content text of that element then
>> it should have the type xsd:string.
>> The XML instance document would have to be written using < and >
>> instead of < and > or like this:
>> <TextOutlTxt><![CDATA[
>> <p>A paragraph.</p>
>> ]]></TextOutlTxt>
>
>> The JAXB marshallier takes care of that.
>
>> -W
>
>
> On Tue, Sep 30, 2008 at 4:31 PM, Boris Koprinarov
> <bkoprinarov_at_googlemail.com> wrote:
>>
>> 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.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>
>
--
View this message in context: http://www.nabble.com/namespaces-by-marshaller-output-tp19743303p19761234.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.