473,785 Members | 2,863 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Namespace prefix used but not declared

27 New Member
Hi All,

I am trying to parse the xml.

<ns1:ProcessGLA ccountValidatio nRequestABM xmlns:ns1="http ://xmins.oracle.co m/ApplicationObje cts/Ebiz/Core/ABM/ChartOfAccounts/V1">
<ns2:ChartOfAcc ountsName xmlns:ns2="http ://xmlns.oracle.co m/ApplicationObje cts/Ebiz/Core/ABO/ChartOfAccounts/V1">Netherlan ds Accounting Flex</ns2:ChartOfAcco untsName>
<ns2:ChartOfAcc ountsId>50560</ns2:ChartOfAcco untsId>
<ns2:CodeCombin ations>
<ns2:CodeCombin ationId>76589</ns2:CodeCombina tionId>
<ns2:GLElementV alueList>
<ns2:ValueSetNa me>SEGMENT1</ns2:ValueSetNam e>
<ns2:Value>04 </ns2:Value>
</ns2:GLElementVa lueList>
<ns2:GLElementV alueList>
<ns2:ValueSetNa me>SEGMENT2</ns2:ValueSetNam e>
<ns2:Value>7410 </ns2:Value>
</ns2:GLElementVa lueList>
<ns2:GLElementV alueList>
<ns2:ValueSetNa me>SEGMENT3</ns2:ValueSetNam e>
<ns2:Value>32 0</ns2:Value>
</ns2:GLElementVa lueList>
<ns2:GLElementV alueList>
<ns2:ValueSetNa me>SEGMENT4</ns2:ValueSetNam e>
<ns2:Value>00 0</ns2:Value>
</ns2:GLElementVa lueList>
</ns2:CodeCombina tions>
</ns1:ProcessGLAc countValidation RequestABM>

but when i tried it is throwing error,

Exception occured in ValidateCCIDPro cess.process() :oracle.xml.par ser.v2.XMLParse Exception: Namespace prefix 'ns2' used but not declared.
oracle.xml.pars er.v2.XMLParseE xception: Namespace prefix 'ns2' used but not declared.

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

thanks & regards,
Rakesh.
Sep 5 '08 #1
2 14405
Dormilich
8,658 Recognized Expert Moderator Expert
Hi,

all namespaces must be declared in the root element.

regards
Sep 5 '08 #2
jkmyoung
2,057 Recognized Expert Top Contributor
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:ChartOfAcco untsName here.
ns2:ChartOfAcco untsId 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.  
Sep 8 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
7310
by: Romeo Disca | last post by:
Hello newsgroup, i'm new to xml - what's wrong with this piece code here? i have these two files: test.xml ---- <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE a SYSTEM "test.ent"
2
2704
by: Frank Wilson | last post by:
Is there a way to change the namespace prefix of a document? I am sending a document to an application that requires that every element be prefixed with "sm". My inbound document has every element prefixed with "ns0". Is there way to do this without looping through every node? Thanks, Frank
2
2012
by: Dale Anderson | last post by:
I have a schema that I'm trying to read. The schema has an element named 'GrantApplication' and one with a namespace prefix named 'SF424:GrantApplication'. When I try to read this schema in, I get an exception saying 'A datatable named 'GrantApplication' alread belongs to this dataset'. Why is dotnet not recognizing the namespace prefix and treating these like two separate elements? Thanks for your help.
4
4604
by: jb | last post by:
I have discovered that when the WSDL is auto-generated in .NET (i.e. http://.../MyService.asmx?WSDL): * Prior to SP1, it generated xmlns:s0="http://mynamespace/" in <wsdl:definitions>, and then output my web methods as "s0:MyWebMethod" in <wsdl:message> sections * At SP1, it generates xmlns:tns="http://mynamespace/" in <wsdl:definitions>, and then output my web methods as "tns:MyWebMethod" in <wsdl:message> sections
3
27063
by: Andy Fish | last post by:
Hi, I am creating a new XmlDocument from scratch, but I can't see how I can make a namespace declaration and associate a prefix with it. For instance in the following example: XmlDocument doc = new XmlDocument(); XmlElement el = doc.CreateElement("foo:data"); doc.AppendChild(el); doc.Save("foo.xml");
2
18732
by: james.cssa | last post by:
I want to declare namespace prefix in the Envelope element (i.e. xmlns:xsi and xmlns:xsd) so that the document will be serialized to look like the following. However, I don't know the right way to do that in Java. <?xml version='1.0' encoding='UTF-8'?> <SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance' xmlns:xsd='http://www.w3.org/1999/XMLSchema'>
1
5902
by: Tanja Schaettler | last post by:
Hello! I have an existing SOAP message which looks like: <?xml version="1.0" encoding="UTF-8" ?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <SOAP-ENV:Body>
2
21644
by: scottpet | last post by:
Hi, I want to add a namespace prefix to the root node of an object I am serializing to XML. I have been reading though this article: http://msdn2.microsoft.com/en-gb/library/system.xml.serialization.xmlnamespacedeclarationsattribute.aspx I get namespace prefixes in the document, but not on the root node. Specifically, the serializer does not work as described in the last
3
8450
by: Markus Bauer | last post by:
Hello, I have a problem with the namespace prefix. I need to add nodes to a xml file that is not created by me. It has a namespace with the prefix "NFD". So an already existing node looks like that: <NFD:Sonstiger_Hinweis> <NFD:Erfassungsdatum>20070102</NFD:Erfassungsdatum>
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10329
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10092
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8974
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7500
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3650
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.