Using the following code to serialize the dom to an XMl file.

 

import org.apache.xml.serialize.XMLSerializer;

import org.apache.xml.serialize.OutputFormat;

import org.w3c.dom.Document;

 

      OutputFormat format = new OutputFormat(_document);

      format.setMethod("xml");

      format.setLineSeparator(AdtConstants.CR);

      format.setIndenting(true);

      format.setLineWidth(0);            

      format.setPreserveSpace(true);

      XMLSerializer serializer = new XMLSerializer (

          new FileWriter(fileName), format);

      serializer.asDOMSerializer();

      serializer.serialize(_document);

 

Is there a trick to have the XMLSerializer or OutputFormat show namespaces in the output ??

 

I have looked at the rootElement, it has a namespace uri , with no prefix.

 

Partial output is

 

<?xml version="1.0" encoding="UTF-8"?>

<DataSet>

            <BlockFlush>

                        <WellEntireData>

                                    <WellEntire>

                                                <Attributes>

                                                            <wellid>1</wellid>

                                                            <uwi>177090037300</uwi>

                                                            <wellUwiType>API</wellUwiType>

                                                            <commonWellName>A001</commonWellName>

                                                            <wellOperator>

                                                            </wellOperator>

                                                            <wellName>00047</wellName>

                                                            <wellNumber>A-1</wellNumber>

                                                            <xCoordinate units="feet">-3.349124657968917E7</xCoordinate>

                                                            <yCoordinate units="feet">1.102703719652455E7</yCoordinate>

 

 

expect to see

 

<DataSet xmlns="someNameSpace">

            <BlockFlush>

                        <WellEntireData>

                                    <WellEntire>

                                                <Attributes>

                                                            <wellid>1</wellid>

                                                            <uwi>177090037300</uwi>

                                                            <wellUwiType>API</wellUwiType>

                                                            <commonWellName>A001</commonWellName>

                                                            <wellOperator>

                                                            </wellOperator>

                                                            <wellName>00047</wellName>

                                                            <wellNumber>A-1</wellNumber>

                                                            <xCoordinate units="feet">-3.349124657968917E7</xCoordinate>

                                                            <yCoordinate units="feet">1.102703719652455E7</yCoordinate>

 

Bill Riegel

LandMark Graphics

713-839-3388

 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to