Questions tagged [xml-libxml]

For the Perl XML parsing module. For the C library libxml2, use the libxml2 tag.

225 questions
5
votes
2 answers

cpanm use custom libs and cflags

On my mac OS X machine Darwin maci 15.6.0 Darwin Kernel Version 15.6.0 I have installed libxml2 and libxslt in following custom directory /usr/local/MyLibs/libxml2-2.9.2 and libxslt /usr/local/MyLibs/libxslt-1.1.29 Now I want to use these libs to…
Recker
  • 1,915
  • 25
  • 55
5
votes
1 answer

Append a CDATA with XML::LibXML appendTextNode() AS-IS

I use this code to create a new node with the expected output: the code : open my $fh, "<", $xml_file; binmode $fh; my $parser = XML::LibXML->new(); my $doc = $parser->load_xml(IO => $fh); # create…
MevatlaveKraspek
  • 2,246
  • 3
  • 20
  • 23
5
votes
3 answers

Add new nodes/elements to XML::LibXML object

Here is a basic XML document example Anne Catfish wrangler Bob
Keryn Drake
  • 121
  • 2
  • 10
4
votes
3 answers

XML::LibXML remove heading when write to xml

When I update value with XML::LibXML the first two lines are removed. I want to preserve the xml as is, except one updated value. My original xml is:
Gregory Danenberg
  • 519
  • 2
  • 9
  • 15
4
votes
2 answers

Are blank child nodes of any use to XML parsers?

Why do we have to have the notion of blank XML nodes? What benefit do they bring to the alchemy of XML parsing? A simple example here with Perl's XML::LibXML: use strict; use warnings; use feature 'say'; use XML::LibXML; my $xml =…
Zaid
  • 36,680
  • 16
  • 86
  • 155
4
votes
1 answer

Iterating over nodes using XML::LibXML

I am using XML::LibXML (Ver: 1.70). My xml input file looks like this:
Nano HE
  • 1,879
  • 7
  • 28
  • 39
4
votes
2 answers

Ubuntu 14.04 configure: error: "libxml not found"

Trying to install the XML package as follows I get the error configure: error: "libxml not found". It seems that R is picking up the libxml2 installation from Anaconda. How can I fix this? R version 3.4.4 (2018-03-15) -- "Someone to Lean…
SkyWalker
  • 13,729
  • 18
  • 91
  • 187
4
votes
1 answer

How do I create ENTITY references in the DOCTYPE using perl/LibXML

I'm trying to create the following DTD containing entity declarations: …
4
votes
2 answers

Is this a valid XPath expression?

Is this xpath a valid XPath expression? (It does what it should ). #!/usr/bin/env perl use strict; use warnings; use 5.012; use XML::LibXML; my $string =< Pumkinsingers
sid_com
  • 24,137
  • 26
  • 96
  • 187
4
votes
1 answer

useful set of cookbook examples of perl xml::libxml dom parser for (x)html?

the authors of some simpler perl dom parsers for xml seem to discourage their use for mixed content in favor of XML::LibXML. so I am now beginning to learn XML::LibXML and am looking for cookbook examples of common use. think reading (x)html…
ivo Welch
  • 2,427
  • 2
  • 23
  • 31
4
votes
1 answer

perl script to iterate over xml nodes using XML::LibXML

I am trying to come up with a perl script to iterate over some nodes and get values in xml file. My XML File looks like below and is saved spec.xml
skanagasabap
  • 910
  • 3
  • 12
  • 24
4
votes
1 answer

How to actually modify values of an XML file using XML::LibXML

I have an XML file (information.xml). I have to extract element and attribute values from this XML file and insert those element and attribute values into another XML file (build.xml). I have to change the build.xml file by filling the appropriate…
Shubhra Garg
  • 167
  • 1
  • 3
  • 14
4
votes
2 answers

Remove XML namespaces with XML::LibXML

I'm converting an XML document into HTML. One of the things that needs to happen is the removal of namespaces, which cannot be legally declared in HTML (unless it's the XHTML namespace in the root tag). I have found posts from 5-10 years ago about…
Nate Glenn
  • 6,455
  • 8
  • 52
  • 95
4
votes
4 answers

XPath variables in XML::Twig or Other

I'm using XML::Twig::XPath to work with ITS data, and am trying to figure out how to resolve XPath expressions with variables in them. Here's an example of what I need to work with from the ITS spec:
Nate Glenn
  • 6,455
  • 8
  • 52
  • 95
3
votes
1 answer

XML::LibXML's notion of a text node's parent

Something seems odd here. In the example below, I'm accessing text nodes via an XPath query ( //book/isbn/text() ). The text() is necessary to coerce XML::LibXML into allowing me to use the XML::LibXML::Text methods. To get to the parent node…
Zaid
  • 36,680
  • 16
  • 86
  • 155
1
2
3
14 15