Return-Path: X-Original-To: apmail-xalan-c-users-archive@www.apache.org Delivered-To: apmail-xalan-c-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A7237104EE for ; Wed, 25 Sep 2013 19:17:21 +0000 (UTC) Received: (qmail 44510 invoked by uid 500); 25 Sep 2013 19:17:21 -0000 Delivered-To: apmail-xalan-c-users-archive@xalan.apache.org Received: (qmail 44476 invoked by uid 500); 25 Sep 2013 19:17:20 -0000 Mailing-List: contact c-users-help@xalan.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: c-users@xalan.apache.org Delivered-To: mailing list c-users@xalan.apache.org Received: (qmail 44468 invoked by uid 99); 25 Sep 2013 19:17:19 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Sep 2013 19:17:19 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [64.255.237.172] (HELO smtp2.pacifier.net) (64.255.237.172) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Sep 2013 19:17:14 +0000 Received: from webmail.iinet.com (web04-proaxis.pacifier.net [64.255.238.49]) by smtp2.pacifier.net (Postfix) with ESMTP id 5A4042CA47; Wed, 25 Sep 2013 12:16:54 -0700 (PDT) Received: from 159.121.180.80 (SquirrelMail authenticated user shathawa@e-z.net) by webmail.iinet.com with HTTP; Wed, 25 Sep 2013 12:16:54 -0700 (PDT) Message-ID: <28553.159.121.180.80.1380136614.squirrel@webmail.iinet.com> In-Reply-To: <1380115744220-40498.post@n7.nabble.com> References: <1380115744220-40498.post@n7.nabble.com> Date: Wed, 25 Sep 2013 12:16:54 -0700 (PDT) Subject: Re: mapping a prefix to a namespace URI From: shathawa@e-z.net To: "afrenger" Cc: c-users@xalan.apache.org User-Agent: SquirrelMail/1.4.6 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-Virus-Checked: Checked by ClamAV on apache.org Aaron, When you mention "default" namespace, are you instead trying to use a "no namespace" arena? XML documents and fragments with no target namespace prefix are allocated to the "no namespace" arena. A namespace_name can be associated with more than one prefix. The use of any of the prefixes can then validate to a proper namespace. Namespaces are bound to prefixes by the XML Parser. A Stylesheet can have its own namespace prefix bindings that are emitted by the XML output method. Nested namespace (xmlns:prefix='namespace_name') assignments are allowed. Parent namespaces that share a prefix that has been redefined in the child element are not available within the scope of the child element. Any namespace (xmlns:prefix) mappings in the parent are inherited by the child, but can be overwritten by the child context. Xalan now has the ability to associate parsed XML documents with a top-level parameter name. Documents are parsed using the Xerces-C XML Parser library. The way a resolver works is to map a URL or system file pathname to a resource. The resolver then pushes a reader onto the XML Reader stack to start reading from the new object (XML Document or fragment). The XPath document() function returns a parsed nodeset object. It uses the installed entity resolver that performs the above mentioned operation by submitting a bytestream of data to an XML parser so that a parsed nodeset object can be returned by document(). Sincerely, Steven J. Hathaway > Hi, > > I need to get some values from a number of xml sources that have default > namespaces. I've implemented the code from the sample SimplXPathAPI and > got > this to work if I removed the default namespaces but, if I leave them in, > selectSingleNode returns NULL. I was able to remove the namespaces for my > test data (or add prefixes), but unfortunately I will not be able to do > this > with the real data. > > I've done an exhaustive search of the xalan-c forums and the internet in > general for the past several days and I've come up with a few things but I > don't think I'm heading in the right direction any longer. I've > implemented > a PrefixResolver derivative (myPrefixResolver) and I'm passing an instance > of that into the XPathEvaluator, so the XPath implementation can map the > namespace prefix to the proper namespace URI. The problem is that I'm > having trouble mapping the prefix to the namespace. > > Optimally I would like to have a function in my PrefixResolver derivative > that takes a prefix and a uri and adds it to my namespace. > > I've come up with the following (and many other variations) but it crashes > when I try to set the node value. > > void > myPrefixResolver::setPrefix(const XalanDOMString& prefix, const > XalanDOMString& uri) > { > AttributeVectorType myVector(XalanMemMgrs::getDefaultXercesMemMgr(), 1); > myVector.front()->setNodeValue(uri); > > m_namespaces.insert(&prefix, myVector); > } > > I've tried many things including tying to clone an existing XalanNode and > creating my vector this way. I haven't deviated much from the way > XalanDocumentPrefixResolver derived from PrefixResolver. I am a bit > desperate at this point because I have a very tight schedule and I thought > this part would be the easy part. > > Any help that can be proffered would be extremely appreciated! > > Thanks, > Aaron > > > > > > > > -- > View this message in context: > http://apache-xml-project.6118.n7.nabble.com/mapping-a-prefix-to-a-namespace-URI-tp40498.html > Sent from the Xalan - C - Users mailing list archive at Nabble.com. > >