I have an xml file:
<AutoData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Table1>
<Data1 10 </Data1>
<Data2 20 </Data2>
<Data3 40 </Data3>
<Table1>
</AutoData>
and I have to remove the portion xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" only.
I tried using sed... (10 Replies)
Hello. I'm new to *ix and am trying to pull a variable or two from an xml document. The document is in the format:
<name>7_3(A).mov</name>
<description>Some description from a file</description>
<updatename>7_3_A.mov</updatename>
<updatepath>Dailies Released</updatepath>
... (3 Replies)
Hi All,
I'm stuck with adding multiple lines(irrespective of line number) to a file before a particular xml tag. Please help me.
<A>testing_Location</A>
<value>LA</value>
<zone>US</zone>
<B>Region</B>
<value>Russia</value>
<zone>Washington</zone>
<C>Country</C>... (0 Replies)
HI All,
I have to split a xml file into multiple xml files and append it in another .xml file. for example below is a sample xml and using shell script i have to split it into three xml files and append all the three xmls in a .xml file. Can some one help plz.
eg:
<?xml version="1.0"?>... (4 Replies)
I've got two different files and want to compare them.
File 1 :
HTML Code:
<response ticketId="944" type="getQueryResults"><status>COMPLETE</status><description>Query results fetched successfully</description><recordSet totalCount="1" type="sms_records"><record... (1 Reply)
Hi ,
I have a below xml:
<ns:Body>
<ns:result>
<Date Month="June" Day="Monday:/>
</ns:result>
</ns:Body>
i have a lookup abc.txtt text file with below details
Month June July August
Day Monday Tuesday Wednesday
I need a output xml with below tags
<ns:Body>
<ns:result>... (2 Replies)
Hi All,
We need to split a large xml into multiple valid xml with same header(2lines) and footer(last line) for N number of letterId.
In the example below we have first 2 lines as header and last line as footer.(They need to be in each split xml file)
Header:
<?xml version="1.0"... (5 Replies)
Hi,
I'm having a xml file with multiple xml header. so i want to split the file into multiple files.
Sample.xml consists multiple headers so how can we split these multiple headers into multiple files in unix.
eg :
<?xml version="1.0" encoding="UTF-8"?>
<ml:individual... (3 Replies)
I want to write a one line script that outputs the result of multiple xml tags from a XML file. For example I have a XML file which has below XML tags in the file:
<EMAIL>***</EMAIL>
<CUSTOMER_ID>****</CUSTOMER_ID>
<BRANDID>***</BRANDID>
Now I want to grep the values of all these specified... (1 Reply)
Discussion started by: shubh752
1 Replies
LEARN ABOUT DEBIAN
test::xml::xpath
Test::XML::XPath(3pm) User Contributed Perl Documentation Test::XML::XPath(3pm)NAME
Test::XML::XPath - Test XPath assertions
SYNOPSIS
use Test::XML::XPath tests => 3;
like_xpath( '<foo />', '/foo' ); # PASS
like_xpath( '<foo />', '/bar' ); # FAIL
unlike_xpath( '<foo />', '/bar' ); # PASS
is_xpath( '<foo>bar</foo>', '/foo', 'bar' ); # PASS
is_xpath( '<foo>bar</foo>', '/bar', 'foo' ); # FAIL
# More interesting examples of xpath assertions.
my $xml = '<foo attrib="1"><bish><bosh args="42">pub</bosh></bish></foo>';
# Do testing for attributes.
like_xpath( $xml, '/foo[@attrib="1"]' ); # PASS
# Find an element anywhere in the document.
like_xpath( $xml, '//bosh' ); # PASS
# Both.
like_xpath( $xml, '//bosh[@args="42"]' ); # PASS
DESCRIPTION
This module allows you to assert statements about your XML in the form of XPath statements. You can say that a piece of XML must contain
certain tags, with so-and-so attributes, etc. It will try to use any installed XPath module that it knows about. Currently, this means
XML::LibXML and XML::XPath, in that order.
NB: Normally in XPath processing, the statement occurs from a context node. In the case of like_xpath(), the context node will always be
the root node. In practice, this means that these two statements are identical:
# Absolute path.
like_xpath( '<foo/>', '/foo' );
# Path relative to root.
like_xpath( '<foo/>', 'foo' );
It's probably best to use absolute paths everywhere in order to keep things simple.
NB: Beware of specifying attributes. Because they use an @-sign, perl will complain about trying to interpolate arrays if you don't escape
them or use single quotes.
FUNCTIONS
like_xpath ( XML, XPATH [, NAME ] )
Assert that XML (a string containing XML) matches the statement XPATH. NAME is the name of the test.
Returns true or false depending upon test success.
unlike_xpath ( XML, XPATH [, NAME ] )
This is the reverse of like_xpath(). The test will only pass if XPATH does not generates any matches in XML.
Returns true or false depending upon test success.
is_xpath ( XML, XPATH, EXPECTED [, NAME ] )
Evaluates XPATH against XML, and pass the test if the is EXPECTED. Uses findvalue() internally.
Returns true or false depending upon test success.
set_xpath_processor ( CLASS )
Set the class name of the XPath processor used. It is up to you to ensure that this class is loaded.
In all cases, XML must be well formed, or the test will fail.
SEE ALSO
Test::XML.
XML::XPath, which is the basis for this module.
If you are not conversant with XPath, there are many tutorials available on the web. Google will point you at them. The first one that I
saw was: <http://www.zvon.org/xxl/XPathTutorial/>, which appears to offer interactive XPath as well as the tutorials.
AUTHOR
Dominic Mitchell <cpan2 (at) semantico.com>
COPYRIGHT AND LICENSE
Copyright 2002 by semantico
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2009-07-02 Test::XML::XPath(3pm)