Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old September 5th, 2008, 10:23 AM
Newbie
 
Join Date: May 2007
Posts: 27
Default Namespace prefix used but not declared

Hi All,

I am trying to parse the xml.

<ns1:ProcessGLAccountValidationRequestABM xmlns:ns1="http://xmins.oracle.com/ApplicationObjects/Ebiz/Core/ABM/ChartOfAccounts/V1">
<ns2:ChartOfAccountsName xmlns:ns2="http://xmlns.oracle.com/ApplicationObjects/Ebiz/Core/ABO/ChartOfAccounts/V1">Netherlands Accounting Flex</ns2:ChartOfAccountsName>
<ns2:ChartOfAccountsId>50560</ns2:ChartOfAccountsId>
<ns2:CodeCombinations>
<ns2:CodeCombinationId>76589</ns2:CodeCombinationId>
<ns2:GLElementValueList>
<ns2:ValueSetName>SEGMENT1</ns2:ValueSetName>
<ns2:Value>04</ns2:Value>
</ns2:GLElementValueList>
<ns2:GLElementValueList>
<ns2:ValueSetName>SEGMENT2</ns2:ValueSetName>
<ns2:Value>7410</ns2:Value>
</ns2:GLElementValueList>
<ns2:GLElementValueList>
<ns2:ValueSetName>SEGMENT3</ns2:ValueSetName>
<ns2:Value>320</ns2:Value>
</ns2:GLElementValueList>
<ns2:GLElementValueList>
<ns2:ValueSetName>SEGMENT4</ns2:ValueSetName>
<ns2:Value>000</ns2:Value>
</ns2:GLElementValueList>
</ns2:CodeCombinations>
</ns1:ProcessGLAccountValidationRequestABM>

but when i tried it is throwing error,

Exception occured in ValidateCCIDProcess.process() :oracle.xml.parser.v2.XMLParseException: Namespace prefix 'ns2' used but not declared.
oracle.xml.parser.v2.XMLParseException: Namespace prefix 'ns2' used but not declared.

Please help me.
--------------------

thanks & regards,
Rakesh.
Reply
  #2  
Old September 5th, 2008, 03:12 PM
Dormilich's Avatar
Expert
 
Join Date: Aug 2008
Location: Leipzig, Germany
Age: 31
Posts: 636
Default

Hi,

all namespaces must be declared in the root element.

regards
Reply
  #3  
Old September 8th, 2008, 04:20 PM
Moderator
 
Join Date: Mar 2006
Posts: 889
Default

I agree, move the namespace declaration to the root.

More detailed explanation:
The namespace doesn't have to be declared in the root node; however, each namespace declaration is only good for the element it is in, and all descendants of that node.

Expand|Select|Wrap|Line Numbers
  1. <ns2:ChartOfAccountsName xmlns:ns2="http://xmlns.oracle.com/ApplicationObjects/Ebiz/Core/ABO/ChartOfAccounts/V1">Netherlands Accounting Flex</ns2:ChartOfAccountsName> 
  2. <ns2:ChartOfAccountsId>50560</ns2:ChartOfAccountsId> 
  3.  
The ns2 namespace only lasts within the ns2:ChartOfAccountsName here.
ns2:ChartOfAccountsId can not find this namespace in any of its ancestors (parent node, or parent's parent, etc..)

You could also make the xml valid by redeclaring the namespace wherever you need to, as below, but that gets messy quickly.
Expand|Select|Wrap|Line Numbers
  1. <ns2:ChartOfAccountsName xmlns:ns2="http://xmlns.oracle.com/ApplicationObjects/Ebiz/Core/ABO/ChartOfAccounts/V1">Netherlands Accounting Flex</ns2:ChartOfAccountsName> 
  2. <ns2:ChartOfAccountsId xmlns:ns2="http://xmlns.oracle.com/ApplicationObjects/Ebiz/Core/ABO/ChartOfAccounts/V1">50560</ns2:ChartOfAccountsId> 
  3.  
Reply
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles