[jdom-interest] Namespace Dropped

Mike Aymard Mike_Aymard at gap.com
Mon Oct 2 14:37:10 PDT 2006


Hello,

 

I'm fairly new to JDOM and am having an issue with namespaces. I am
reading an xml file, making a small change and then writing it back out.
What's happening is that the "xmi:" prefix is being dropped from the
attributes. Not sure if it's because the xml is not properly formed to
begin with, but it's not my file, rather something I must modify.

 

Here's a sample of the input file:

 

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

<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:resources.j2c="http://www.ibm.com/websphere/appserver/schemas/5.0/
resources.j2c.xmi">

  <resources.jms:JMSProvider xmi:id="builtin_jmsprovider"
name="WebSphere JMS Provider" description="Built-in WebSphere JMS
Provider" externalInitialContextFactory="" externalProviderURL="">

    <factories xmi:type="resources.jms.internalmessaging:WASQueue"
xmi:id="WASQueue_1112308680518" name="CancelInventoryQ"
jndiName="jms/mq/ecom/out/cancelInventoryQ" node="localhost"
persistence="APPLICATION_DEFINED" priority="APPLICATION_DEFINED"
specifiedPriority="0" expiry="APPLICATION_DEFINED" specifiedExpiry="0"/>

  <resources.jdbc:JDBCProvider xmi:id="JDBCProvider_1106536192663"
name="Oracle Thin JDBC Provider" description="Oracle JDBC Thin Driver">

    <classpath>${ORACLE_JDBC_DRIVER_PATH}/ojdbc14.jar</classpath>

    <factories xmi:type="resources.jdbc:DataSource"
xmi:id="DataSource_1106536192663" name="GID Data Source"
jndiName="jdbc/gidd1" description="An Oracle DataSource." category=""
authDataAlias="GIDD1" statementCacheSize="10"
datasourceHelperClassname="com.ibm.websphere.rsadapter.OracleDataStoreHe
lper" relationalResourceAdapter="builtin_rra">

      <propertySet xmi:id="J2EEResourcePropertySet_1106536192665">

        <resourceProperties xmi:id="J2EEResourceProperty_1106536192667"
name="driverType" type="java.lang.String" value="" description="The type
of the driver. The possible values are: thin, oci8." required="false"/>

      </propertySet>

      <connectionPool xmi:id="ConnectionPool_1106536192663"
connectionTimeout="1800" maxConnections="10" minConnections="1"
reapTime="180" unusedTimeout="1800" agedTimeout="0"
purgePolicy="EntirePool"/>

      <mapping xmi:id="MappingModule_1106536192665"
mappingConfigAlias="DefaultPrincipalMapping" authDataAlias="GIDD1"/>

    </factories>

  </resources.jdbc:JDBCProvider>

</xmi:XMI>

 

After writing out the file, the "xmi:" prefix has been removed from the
attributes, such as xmi:id. This causes an error when the outputted xml
file is used by its application.

 

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

<xmi:XMI xmlns:xmi="http://www.omg.org/XMI"
xmlns:resources.j2c="http://www.ibm.com/websphere/appserver/schemas/5.0/
resources.j2c.xmi" version="2.0">

  <resources.jms:JMSProvider id="builtin_jmsprovider" name="WebSphere
JMS Provider" description="Built-in WebSphere JMS Provider"
externalInitialContextFactory="" externalProviderURL="">

    <factories type="resources.jms.internalmessaging:WASQueue"
id="WASQueue_1112308680518" name="CancelInventoryQ"
jndiName="jms/mq/ecom/out/cancelInventoryQ" node="localhost"
persistence="APPLICATION_DEFINED" priority="APPLICATION_DEFINED"
specifiedPriority="0" expiry="APPLICATION_DEFINED" specifiedExpiry="0"
/>

  </resources.jms:JMSProvider>

  <resources.jdbc:JDBCProvider id="JDBCProvider_1106536192663"
name="Oracle Thin JDBC Provider" description="Oracle JDBC Thin Driver">

    <classpath>${ORACLE_JDBC_DRIVER_PATH}/ojdbc14.jar</classpath>

    <factories type="resources.jdbc:DataSource"
id="DataSource_1106536192663" name="GID Data Source"
jndiName="jdbc/gidd1" description="An Oracle DataSource." category=""
authDataAlias="GIDD1" statementCacheSize="10"
datasourceHelperClassname="com.ibm.websphere.rsadapter.OracleDataStoreHe
lper" relationalResourceAdapter="builtin_rra">

      <propertySet id="J2EEResourcePropertySet_1106536192665">

        <resourceProperties id="J2EEResourceProperty_1106536192667"
name="driverType" type="java.lang.String" value="" description="The type
of the driver. The possible values are: thin, oci8." required="false" />

      </propertySet>

      <connectionPool id="ConnectionPool_1106536192663"
connectionTimeout="1800" maxConnections="10" minConnections="1"
reapTime="180" unusedTimeout="1800" agedTimeout="0"
purgePolicy="EntirePool" />

      <mapping id="MappingModule_1106536192665"
mappingConfigAlias="DefaultPrincipalMapping" authDataAlias="GIDD1" />

    </factories>

  </resources.jdbc:JDBCProvider>

</xmi:XMI>

 

Is there something I can do to prevent it from being remove or somehow
put it back? Any help would be greatly appreciated.

 

Thanks!

Mike

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.jdom.org/pipermail/jdom-interest/attachments/20061002/90ab9178/attachment.htm


More information about the jdom-interest mailing list