05-20-2010
Remove the null prefix namespace declaration, i.e. xmlns="http://wherein.yahooapis.com/v1/schema", and your xmlstarlet query will work as expected.
By definition, a null prefix namespace declaration becomes the default namespace which means that the XPATH expressions generated by xmlstarlet will not work. This is not an xmlstarlet issue, you would also get no results if you wrote a XSL stylesheet to transform the XML document.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I need some tips to write a unix korn shell script that will parse an input text file. Input text file has messages that span several lines, each field in the message is delimited by /034 and the end of message is delimited by /035.
Input file looks something similar to
... (1 Reply)
Discussion started by: indianya
1 Replies
2. Shell Programming and Scripting
I have a file like:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<geonames>
<geoname>
<toponymName>Palos Verdes</toponymName>
<name>Palos Verdes</name>
<lat>42.1628912</lat>
<lng>-123.6481235</lng>
<geonameId>5718340</geonameId>
<countryCode>US</countryCode>... (4 Replies)
Discussion started by: unclecameron
4 Replies
3. Shell Programming and Scripting
Hi everyone!
How can I parse a delimited field using AWK?
For example, if I have lastName#firstName or lastName*firstName. I'd like an AWK script that would return lastName and then another that would return firstName? Is this possible? (13 Replies)
Discussion started by: Fatbob
13 Replies
4. Shell Programming and Scripting
I'm parsing around 600K xml files, with roughly 1500 lines of text in each, some of the lines include Chinese, Russian, whatever language, with a bash script that uses
cat $i | xmlstarlet sel -t -m "//section1/section2/section3/section4/section5" -v "@VALUE" -n > somefile
which works, but I... (15 Replies)
Discussion started by: unclecameron
15 Replies
5. Shell Programming and Scripting
When parsing multiple fields in a file using AWK, how do you group by one of the fields and parse by delimiters?
to clarify
If a file had
tom | 223-2222-4444 , randofield
ivan | 123-2422-4444 , random filed
... | and , are the delimiters ...
How would you group by the social security... (4 Replies)
Discussion started by: Josef_Stalin
4 Replies
6. Shell Programming and Scripting
Hi Experts,
I have a data with multiple entry , I want to filter PKG= & the last column "00060110" or "00088150" in the output
file:
###############################################################################################
PKG= P8SDB :: VGS = vgP8SOra vgP8SDB1 vgP8S001... (5 Replies)
Discussion started by: rveri
5 Replies
7. Shell Programming and Scripting
Hello:
I am working parsing a large input file which will be broken down into multiples based on the second field in the file, in this case: STORE.
The idea is to create each file with the corresponding store number, for example: Report_$STORENUM_$DATETIMESTAMP , and obtaining the... (7 Replies)
Discussion started by: ec012
7 Replies
8. Shell Programming and Scripting
I am trying to parse the input in awk to include the |gc= in $4 but am not able to. The below is close:
awk so far:
awk '{sub(/\|]+]++/, ""); print }' input.txt Input
chr1 955543 955763 AGRN-6|pr=2|gc=75 0 +
chr1 957571 957852 AGRN-7|pr=3|gc=61.2 0 +
chr1 970621 ... (7 Replies)
Discussion started by: cmccabe
7 Replies
9. Shell Programming and Scripting
I have a XML file of little huge size. I have to build a logic to get the count of the tag <capacity>.
And have an if loop such that all the <capacity> blocks are captured one after the other.
sample input file - sample1.xml
<subcolumns><capacity><name>45.90</name>
<index>0</index>... (1 Reply)
Discussion started by: ramprabhum
1 Replies
10. UNIX for Beginners Questions & Answers
I have multiple xml files where i want to update a subnode if the subnode project points to different project or insert a subnode if it doesn't exist using a xmlstarlet or any other command that can be used in a bash script.
I have been able to update the subnode project if it doesn't point to... (1 Reply)
Discussion started by: Sekhar419
1 Replies
LEARN ABOUT CENTOS
xml::libxml::namespace
XML::LibXML::Namespace(3) User Contributed Perl Documentation XML::LibXML::Namespace(3)
NAME
XML::LibXML::Namespace - XML::LibXML Namespace Implementation
SYNOPSIS
use XML::LibXML;
# Only methods specific to Namespace nodes are listed here,
# see XML::LibXML::Node manpage for other methods
my $ns = XML::LibXML::Namespace->new($nsURI);
print $ns->nodeName();
print $ns->name();
$localname = $ns->getLocalName();
print $ns->getData();
print $ns->getValue();
print $ns->value();
$known_uri = $ns->getNamespaceURI();
$known_prefix = $ns->getPrefix();
DESCRIPTION
Namespace nodes are returned by both $element->findnodes('namespace::foo') or by $node->getNamespaces().
The namespace node API is not part of any current DOM API, and so it is quite minimal. It should be noted that namespace nodes are not a
sub class of XML::LibXML::Node, however Namespace nodes act a lot like attribute nodes, and similarly named methods will return what you
would expect if you treated the namespace node as an attribute. Note that in order to fix several inconsistencies between the API and the
documentation, the behavior of some functions have been changed in 1.64.
METHODS
new
my $ns = XML::LibXML::Namespace->new($nsURI);
Creates a new Namespace node. Note that this is not a 'node' as an attribute or an element node. Therefore you can't do call all
XML::LibXML::Node Functions. All functions available for this node are listed below.
Optionally you can pass the prefix to the namespace constructor. If this second parameter is omitted you will create a so called
default namespace. Note, the newly created namespace is not bound to any document or node, therefore you should not expect it to be
available in an existing document.
declaredURI
Returns the URI for this namespace.
declaredPrefix
Returns the prefix for this namespace.
nodeName
print $ns->nodeName();
Returns "xmlns:prefix", where prefix is the prefix for this namespace.
name
print $ns->name();
Alias for nodeName()
getLocalName
$localname = $ns->getLocalName();
Returns the local name of this node as if it were an attribute, that is, the prefix associated with the namespace.
getData
print $ns->getData();
Returns the URI of the namespace, i.e. the value of this node as if it were an attribute.
getValue
print $ns->getValue();
Alias for getData()
value
print $ns->value();
Alias for getData()
getNamespaceURI
$known_uri = $ns->getNamespaceURI();
Returns the string "http://www.w3.org/2000/xmlns/"
getPrefix
$known_prefix = $ns->getPrefix();
Returns the string "xmlns"
AUTHORS
Matt Sergeant, Christian Glahn, Petr Pajas
VERSION
2.0018
COPYRIGHT
2001-2007, AxKit.com Ltd.
2002-2006, Christian Glahn.
2006-2009, Petr Pajas.
perl v5.16.3 2013-05-13 XML::LibXML::Namespace(3)