我想将命名空间添加到子元素bt它是没有用的.. 我希望xml看起来像这样
final.xml
<sc:BusinessDataElementCatalog xmlns:sc="http://sctax.org/scits/oc-adapter">
<sc:ScitsDataElementCatalog sc:Version="648" sc:ElementCount="18" sc:Created="2013-04-08T11:44:21" sc:CreatedBy="SYSTEM" sc:LastModified="2013-04-08T11:44:21" sc:ModifiedBy="SYSTEM">
<sc:ScitsDataElement xmlns:sc="http://sctax.org/scits/oc-adapter" sc:Action="Add" sc:ElementDataSource="ITS" sc:ElementName="FrontNopaDataEntryDesc" sc:MultiLine="false" sc:ElementNamePrefix="its_" sc:ElementSource="ITS" sc:DataType="string" sc:Formatting="NotFormatted" sc:Shared="true" sc:Mandatory="false" sc:Editable="true" sc:MailTo="false" sc:ContextType="Entity" sc:ElementUse="ITS" sc:CaseEnabled="true" />
<sc:ScitsDataElement xmlns:sc="http://sctax.org/scits/oc-adapter" sc:Action="Add" sc:ElementDataSource="ITS" sc:ElementName="FrontNopaGLAcctCode" sc:MultiLine="false" sc:ElementNamePrefix="its_" sc:ElementSource="ITS" sc:DataType="string" sc:Formatting="NotFormatted" sc:Shared="true" sc:Mandatory="false" sc:Editable="true" sc:MailTo="false" sc:ContextType="Entity" sc:ElementUse="ITS" sc:CaseEnabled="true" />
<sc:ScitsDataElement xmlns:sc="http://sctax.org/scits/oc-adapter" sc:Action="Add" sc:ElementDataSource="ITS" sc:ElementName="FrontNopaDataEntryCode" sc:MultiLine="false" sc:ElementNamePrefix="its_" sc:ElementSource="ITS" sc:DataType="string" sc:Formatting="NotFormatted" sc:Shared="true" sc:Mandatory="false" sc:Editable="true" sc:MailTo="false" sc:ContextType="Entity" sc:ElementUse="ITS" sc:CaseEnabled="true" />
<sc:ScitsDataElement xmlns:sc="http://sctax.org/scits/oc-adapter" sc:Action="Add" sc:ElementDataSource="ITS" sc:ElementName="FrontNopaGLAcctName" sc:MultiLine="false" sc:ElementNamePrefix="its_" sc:ElementSource="ITS" sc:DataType="string" sc:Formatting="NotFormatted" sc:Shared="true" sc:Mandatory="false" sc:Editable="true" sc:MailTo="false" sc:ContextType="Entity" sc:ElementUse="ITS" sc:CaseEnabled="true" />
<sc:ScitsDataElement xmlns:sc="http://sctax.org/scits/oc-adapter" sc:Action="Add" sc:ElementDataSource="ITS" sc:ElementName="FrontJournalTypeSection" sc:MultiLine="false" sc:ElementNamePrefix="its_" sc:ElementSource="ITS" sc:DataType="string" sc:Formatting="NotFormatted" sc:Shared="true" sc:Mandatory="false" sc:Editable="true" sc:MailTo="false" sc:ContextType="Entity" sc:ElementUse="ITS" sc:CaseEnabled="true" />
<sc:ScitsDataElement xmlns:sc="http://sctax.org/scits/oc-adapter" sc:Action="Add" sc:ElementDataSource="ITS" sc:ElementName="FrontNopaPenaltyAmount" sc:MultiLine="false" sc:ElementNamePrefix="its_" sc:ElementSource="ITS" sc:DataType="string" sc:Formatting="NotFormatted" sc:Shared="true" sc:Mandatory="false" sc:Editable="true" sc:MailTo="false" sc:ContextType="Entity" sc:ElementUse="ITS" sc:CaseEnabled="true" />
</sc:ScitsDataElementCatalog>
</sc:BusinessDataElementCatalog>
bt我能管理的就是这个xml 为result.xml
<sc:BusinessDataElementCatalog xmlns:sc="http://sctax.org/scits/oc-adapter">
<sc:ScitsDataElementCatalog sc:Version="648" sc:ElementCount="18" sc:Created="2013-04-08T11:44:21.000000" sc:CreatedBy="2013-04-08T11:44:21" sc:LastModified="2013-04-08T11:44:21.000000" sc:ModifiedBy="2013-04-08T11:44:21">
<sc:ScitsDataElement sc:Action="Add" sc:ElementDataSource="ITS" sc:ElementName="BackNopaTotBalance" sc:MultiLine="false" sc:ElementNamePrefix="its_" sc:ElementSource="ITS" sc:DataType="string" sc:Formatting="NotFormatted" sc:Shared="true" sc:Mandatory="false" sc:Editable="true" sc:MailTo="false" sc:ContextType="Entity" sc:ElementUse="ITS" sc:CaseEnabled="true">
</sc:ScitsDataElement>
<sc:ScitsDataElement sc:Action="Add" sc:ElementDataSource="ITS" sc:ElementName="BackNopaTotPmntsCredits" sc:MultiLine="false" sc:ElementNamePrefix="its_" sc:ElementSource="ITS" sc:DataType="string" sc:Formatting="NotFormatted" sc:Shared="true" sc:Mandatory="false" sc:Editable="true" sc:MailTo="false" sc:ContextType="Entity" sc:ElementUse="ITS" sc:CaseEnabled="true">
</sc:ScitsDataElement>
<sc:ScitsDataElement sc:Action="Add" sc:ElementDataSource="ITS" sc:ElementName="BackNopaTotLiability" sc:MultiLine="false" sc:ElementNamePrefix="its_" sc:ElementSource="ITS" sc:DataType="string" sc:Formatting="NotFormatted" sc:Shared="true" sc:Mandatory="false" sc:Editable="true" sc:MailTo="false" sc:ContextType="Entity" sc:ElementUse="ITS" sc:CaseEnabled="true">
</sc:ScitsDataElement>
<sc:ScitsDataElement sc:Action="Add" sc:ElementDataSource="ITS" sc:ElementName="BackPeriodEndDateSection" sc:MultiLine="false" sc:ElementNamePrefix="its_" sc:ElementSource="ITS" sc:DataType="string" sc:Formatting="NotFormatted" sc:Shared="true" sc:Mandatory="false" sc:Editable="true" sc:MailTo="false" sc:ContextType="Entity" sc:ElementUse="ITS" sc:CaseEnabled="true">
</sc:ScitsDataElement>
<sc:ScitsDataElement sc:Action="Add" sc:ElementDataSource="ITS" sc:ElementName="BackNopaGLAcctName" sc:MultiLine="false" sc:ElementNamePrefix="its_" sc:ElementSource="ITS" sc:DataType="string" sc:Formatting="NotFormatted" sc:Shared="true" sc:Mandatory="false" sc:Editable="true" sc:MailTo="false" sc:ContextType="Entity" sc:ElementUse="ITS" sc:CaseEnabled="true">
</sc:ScitsDataElement>
<sc:ScitsDataElement sc:Action="Add" sc:ElementDataSource="ITS" sc:ElementName="BackNopaDataEntryCode" sc:MultiLine="false" sc:ElementNamePrefix="its_" sc:ElementSource="ITS" sc:DataType="string" sc:Formatting="NotFormatted" sc:Shared="true" sc:Mandatory="false" sc:Editable="true" sc:MailTo="false" sc:ContextType="Entity" sc:ElementUse="ITS" sc:CaseEnabled="true">
</sc:ScitsDataElement>
</sc:ScitsDataElementCatalog >
</sc:BusinessDataElementCatalog >
这是我的查询
SELECT XMLELEMENT("sc:BusinessDataElementCatalog ",
XMLATTRIBUTES('http://sctax.org/scits/oc-adapter' AS "xmlns:sc")
, B.XML )
FROM
(SELECT
XMLELEMENT ("sc:ScitsDataElementCatalog " ,
XMLATTRIBUTES( MAX(C.REVISION) AS "sc:Version" ,
COUNT(*) AS "sc:ElementCount" ,
MIN(C.CREATED_DTTM) AS "sc:Created",
'2013-04-08T11:44:21' AS "sc:CreatedBy" ,
MAX(C.UPDATED_DTTM) AS "sc:LastModified" ,
'2013-04-08T11:44:21' AS "sc:ModifiedBy" ) ,
XMLAGG(
XMLELEMENT("sc:ScitsDataElement",
XMLATTRIBUTES ('http://sctax.org/scits/oc-adapter' AS "xmlns:sc",
CASE
WHEN ( CATALOG.version_on_insert > 630 )
THEN 'Add'
ELSE 'Update'
END AS "sc:Action" ,
DATASOURCE.CODE AS "sc:ElementDataSource",
CATALOG.ELEMENT_NAME AS "sc:ElementName" ,
CASE
WHEN ( CATALOG.multiline_flag = 1 )
THEN 'true'
ELSE 'false'
END AS "sc:MultiLine" ,
'its_' AS "sc:ElementNamePrefix" ,
DATASOURCE.CODE AS "sc:ElementSource" ,
LOWER(DATATYPE.CODE) AS "sc:DataType" ,
FORMATTYPE.CODE AS "sc:Formatting" ,
CASE
WHEN ( CATALOG.shared_element_flag = 1 ) THEN 'true'
ELSE 'false'
END as "sc:Shared" ,
CASE
WHEN ( CATALOG.mandatory_flag = 1 ) THEN 'true'
ELSE 'false'
END as "sc:Mandatory" ,
CASE
WHEN ( CATALOG.editable_flag = 1 ) THEN 'true'
ELSE 'false'
END as "sc:Editable" ,
CASE
WHEN ( CATALOG.mail_to_flag = 1 ) THEN 'true'
ELSE 'false'
END as "sc:MailTo" ,
context.code as "sc:ContextType" ,
'ITS' as "sc:ElementUse" ,
CASE
WHEN ( CATALOG.case_enabled_flag = 1 ) THEN 'true'
ELSE 'false'
END AS "sc:CaseEnabled" ,
CATALOG.default_value as "sc:DefaultValue"
)
)
)
)AS xml
FROM ITS_OC_DATA_ELEMENT_CATALOG CATALOG
JOIN ITS_OC_DATA_ELEMENT_CATALOG C
ON c.OC_DATA_ELEMENT_CATALOG_KEY=CATALOG.OC_DATA_ELEMENT_CATALOG_KEY
JOIN r_oc_element_datasource dataSource
ON CATALOG.oc_element_datasource_key = dataSource.oc_element_datasource_key
JOIN r_oc_element_datatype datatype
ON CATALOG.oc_element_datatype_key = datatype.oc_element_datatype_key
JOIN r_oc_context_type context
ON CATALOG.oc_context_type_key = context.oc_context_type_key
JOIN r_oc_text_format_type formatType
ON CATALOG.OC_TEXT_FORMAT_TYPE_KEY = FORMATTYPE.OC_TEXT_FORMAT_TYPE_KEY
WHERE CATALOG.REVISION > 630
) B ;
sc:ScitsDataElement 是否有可能拥有命名空间..我可以在此查询中实现它..