<p>I'm looking for feedback for my XPath implementation:
<a href="https://github.com/ChrisTrenkamp/goxpath">https://github.com/ChrisTrenkamp/goxpath</a></p>
<p>I know what the majority of you are thinking: "XML? Yuck." I agree with you, but I have a job that requires working XML. So, I'm kinda stuck with it for now.</p>
<p>I'm looking for some feedback as far as the code goes. I'm also looking for some ideas on extending the parser to operate on XML-tagged structs. </p>
<p>I would like to have the same functionality as this: <a href="http://www.eclipse.org/eclipselink/documentation/2.4/moxy/runtime008.htm">http://www.eclipse.org/eclipselink/documentation/2.4/moxy/runtime008.htm</a> This is handy for querying big data structures and/or complicated schema's (like what I have at my current job). Any idea's would be appreciated.</p>
<hr/>**评论:**<br/><br/>uncreativemynameis: <pre><p>I created a similar package for JSON: <a href="https://github.com/nicksardo/jsonpath" rel="nofollow">https://github.com/nicksardo/jsonpath</a></p>
<p>My design choices: </p>
<ul>
<li><p>Constant memory usage </p>
<ul>
<li>Don't load the entire document into memory -> stream-in & throw away<br/></li>
<li>Don't even load the entire structure into memory -> follow the path while parsing<br/></li>
</ul></li>
<li><p>Early termination </p>
<ul>
<li>Package will terminate parsing when value at end of path is found<br/></li>
<li>Client can cancel parsing at any time (graceful termination for those large XML documents)</li>
</ul></li>
<li><p>Support expressions </p>
<ul>
<li>Ability to select elements based off expressions of child elements.<br/></li>
</ul></li>
</ul></pre>mattn: <pre><p><a href="https://github.com/mattn/go-jsonpointer" rel="nofollow">https://github.com/mattn/go-jsonpointer</a></p>
<p>or</p>
<p><a href="https://github.com/mattn/go-scan" rel="nofollow">https://github.com/mattn/go-scan</a></p></pre>xyproto: <pre><p>Here is another *path package, but for JSON: <a href="https://github.com/xyproto/jpath" rel="nofollow">https://github.com/xyproto/jpath</a></p></pre>
