Coder Social home page Coder Social logo

Comments (3)

GoogleCodeExporter avatar GoogleCodeExporter commented on June 8, 2024

Original comment by gregrobbins on 30 Jun 2009 at 1:35

  • Changed state: Accepted

from gdata-objectivec-client.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 8, 2024
Thanks for pointing out the issue and providing an alternative. You're right 
that the
library is in error in registering the empty-string prefix.

This led to some interesting discussion here about safe XPath expressions. 

While NSXML's XPath does implicitly prefix expression elements with the node's
default namespace, that is not really safe. There is no guarantee that future 
XML
will have the same default namespace, or that prefix-URI mappings will remain 
the
same.  If either of those changes, the XPath expression will give unexpected 
results.

Trying to alter the user's XPath expression is difficult to do correctly.  
Issues
like whitespace, OR operators (|'s), and other compound expressions make trying 
to
insert a prefix automatically in a reliable way quite a difficult task.

I will add to the library an XPath call which takes a dictionary explicitly 
mapping
prefixes (keys) to URIs (values), allowing for reliable XPath expressions that 
can
access nodes on the default namespace.  Using that will look like:

path = @"atom:entry/atom:link"; // four entry link nodes
dict = [NSDictionary dictionaryWithObject:kGDataNamespaceAtom
         forKey:kGDataNamespaceAtomPrefix];
nodes = [root nodesForXPath:path
                 namespaces:dict
                      error:&error];

Additionally, the plain nodesForXPath:error: method will allow _def_ns as a 
prefix
referring to the default namespace.  However, it will safer to use the XPath 
method
which takes the explicit namespace dictionary.

Original comment by gregrobbins on 2 Jul 2009 at 12:41

from gdata-objectivec-client.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 8, 2024
Better namespace support is now in top-of-trunk GDataXMLNode.

http://code.google.com/p/gdata-objectivec-client/source/detail?r=288

Original comment by gregrobbins on 3 Jul 2009 at 1:16

  • Changed state: Fixed

from gdata-objectivec-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.