Menu
  • HOME
  • TAGS

Automatic sitemap.xml

Tag: xml,seo,sitemap

I am trying to figure out if it would be better to automate my sitemap or to manually update it monthly.

I am not very good with how sitemaps work in the first place so trying to learn about them now is something that I am really interested in doing. Would automating the sitemap make a large difference in the indexing process? Does the sitemap have anything to do with the indexing process in the first place?

Also could I go about using a system similar to this in my sitemap and have it extremely limited in the sitemap but would still crawl all of the links on that page?

<url>
<loc>http://www.somedomain.com/category/</loc>
<changefreq>daily</changefreq>
<priority>0.80</priority>
</url>

Or would I need to make it so that the entire sitemap has each post like this

<url>
<loc>http://www.soundpiff.com/category/example-content.html</loc>
<changefreq>weekly</changefreq>
<priority>0.80</priority>
</url>

Best How To :

Whether you create it manually or automatically, the result should be the same, and consumers would not now about how it got created in the first place (they can’t see behind the curtain).

But in case of manually, if you only intend to update it monthly, you might loose 1 month until new pages get indexed, in the worst case (!). Worst case, because many consumers might use other ways in addition for finding new pages.

The Sitemaps protocol doesn’t define a mechanism for specifying URL templates, so no, you should list absolute URLs of the pages you want consumers to know about. See also their FAQ Do URLs in the Sitemap need to be completely specified?: "Yes."

Error when building an XDocument

c#,xml,linq,xpath,linq-to-xml

You can ignore pretty much all your code, the issue is just this: XDocument people = new XDocument("Persons"); You can't create an XDocument containing a string, you need to add an element: XDocument people = new XDocument( new XElement("Persons", original.XPathSelectElements(xpathFilterDups))); ...

How to use XDocument to get attributes and add them to a List

c#,xml,winforms,list

The attributes you're trying to get aren't attribute of Payments element. You need to go one level deeper to get them. Try this way : ...... doc = XDocument.Load(reader); var data = doc.Root .Elements() .Elements("Payments"); foreach(var d in data) { var patti = d.Element("Patti"); list1.Add(new List<string>() { patti.Attribute("Rent").Value, patti.Attribute("Water").Value, patti.Attribute("Electricity").Value,...

XML Schema 1.0 “All” with multiple same elements?

xml,schema

You're blocked by a non-orthogonality of XML Schema. You'd think that the following should work: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="top"> <xs:complexType> <xs:sequence> <xs:all> <xs:element name="A" minOccurs="0"/> <xs:element name="B" minOccurs="0"/> <xs:element name="C" minOccurs="0"/> <xs:element name="D" minOccurs="0"/> </xs:all> <xs:element name="E" minOccurs="1"...

How do I retain search engine accessibility when loading external file into html

javascript,jquery,html,seo,cross-platform

Well the problem is that at first, the section you're about to insert data in is blank, which means that sharing this page on Facebook for example will result in just a blank box. So, what you want to achieve is a way to run that javascript before crawling the...

What is the xpath for retrieving all attribute nodes (whatever be the attributes name) with a specified value?

java,xml,xpath

Well //@* gives you all attribute nodes, add a predicate //@*[. = 'zzz'] and you have all attribute nodes with the value zzz.

XML, XSL namespaces

xml,xslt,namespaces

To produce a valid output HTML document you just need to add exclude-result-prefixes="xsi xslFormatting" on the <ins:stylesheet> (root) element of your stylesheet. But indeed in your stylesheet you don't use the xsi and xslFormatting namespaces anywhere. Thus you could also modify your stylesheet by removing these namespaces declarations, leading you...

Collect strings after a foreach loop

c#,xml,foreach

Yep, you need to do the adding within the loop. I'd use a List<string> as it supports LINQ: XmlNodeList skillNameNodeList=SkillXML.GetElementsByTagName("name"); List<string> skills = new List<string>(); foreach (XmlNode skillNameNode in skillNameNodeList) { skills.Add(skillNameNode.Attributes["value"].Value); } ...

group siblings by identifying the first node of a certain type in sequence

xml,xslt,xpath

Try it this way: <xsl:key name="kFirstText" match="*[not(self::type1[not(preceding-sibling::*[1][self::type1])])]" use="generate-id(preceding-sibling::type1[not(preceding-sibling::*[1][self::type1])][1])"/> This excludes the "leader" nodes from the group retrieved by the key....

Magento simplexml_load_string() error location

php,xml,magento

It's something related with /var/www/html/app/code/core/Mage/Core/Model/Layout/Update.php so I would edit that file and I would go to the line 450. Just before that line write: Mage::log(print_r($filename, true)); Make sure that your logging is enabled and refresh the page. After that, take a look to var/log/system.log. The last xml is probably what...

Sequence number for static and dynamic rows in XSLT 2.0

xml,xslt-2.0

Would this XSLT do: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text" /> <xsl:strip-space elements="*"/> <xsl:template match="/*"> <xsl:apply-templates select=".//line"/> </xsl:template> <xsl:template match="line"> <xsl:variable name="pos" select="position() + (3 * count(preceding::data))"/> <xsl:value-of select="concat(format-number($pos, '00000 '), ., '&#xa;')"/> </xsl:template> <xsl:template...

Load XML to list using LINQ [duplicate]

c#,xml,linq

Make a base class which will have id,x,y,z, and have Vendors,Bankers and Hospitals extend it. Then you can have a collection of the base class, and add to it the classes that inherit from it....

finding file in root of wpf application

c#,xml,wpf,visual-studio,relative-path

First, ensure that the file is definitely copied into your output ./bin/ directory on compile: This worked perfectly for me in my WPF application: const string imagePath = @"pack://application:,,,/Test.txt"; StreamResourceInfo imageInfo = Application.GetResourceStream(new Uri(imagePath)); byte[] imageBytes = ReadFully(imageInfo.Stream); If you want to read it as binary (e.g. read an image...

Get XML node value when previous node value conditions are true (without looping)

xml,vb.net,linq-to-xml

UPDATE Using an XDocument vs an XmlDocument, I believe this does what you're asking without using loops. This is dependent on the elements being in the order of <PhoneType> <PhonePrimaryYN> <PhoneNumber> string xml = "<?xml version=\"1.0\"?>" + "<Root>" + " <PhoneType dataType=\"string\">" + " <Value>CELL</Value>" + " </PhoneType>" + "...

Converting XSD 1.1 to 1.0 - Validation Error

xml,xsd

You can't get this to work with XSD 1.0. An "all" is not allowed as part of a choice. That's actually true in 1.1 as well. But what are you actually trying to achieve? You've got a choice with only one branch, which is obviously redundant, except that it specifies...

XML-XSLT-XPATH : How to convert multiple XML elements to a string, separated by semicolon

xml,xslt,xpath,xslt-2.0

you could use something like: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:output method="text"/> <xsl:template match="/"> <xsl:text>UserNames: &quot;</xsl:text> <xsl:value-of select="/Users/user/username" separator=";"/> <xsl:text>&quot;&#xA;</xsl:text> <xsl:text>Names: &quot;</xsl:text> <xsl:value-of select="/Users/user/name" separator=";"/>...

Deserializing or parse XML response in Symfony2

php,xml,symfony2,deserialization,jmsserializerbundle

It depends on your intention. If you want to directly push part or all of the XML to an entity/document object for saving to a database then the JMSSerializerBundle can do this very smartly and is definitely the best way to do it. If however you just want to extract...

Remove all nodes in a specified namespace from XML

c#,xml,linq-to-xml

Iterating through elements then through attributes seems not too hard to read : var xml = @"<?xml version='1.0' encoding='UTF-8'?> <root xmlns:test='urn:my-test-urn'> <Item name='Item one'> <test:AlternativeName>Another name</test:AlternativeName> <Price test:Currency='GBP'>124.00</Price> </Item> </root>"; var doc = XDocument.Parse(xml); XNamespace test = "urn:my-test-urn"; //get all elements in specific namespace and remove doc.Descendants() .Where(o => o.Name.Namespace...

XMLPullParser black diamond question marks with certain characters

android,xml,character-encoding,xmlpullparser,questionmark

Content encoding and character encoding are not the same thing. Content encoding refers to compression such as gzip. Since getContentEncoding() is null, that tells you there's no compression. You should be looking at conn.getContentType(), because the character encoding can usually be found in the content-type response header. conn.getContentType() might return...

Fixed element in android?

android,xml,android-fragments

You need a FrameLayout. In a FrameLayout, the children are overlapped on top of each other with the last child being at the topmost. activity_main.xml <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:fab="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent"...

Convert contents of an XmlNodeList to a new XmlDocument without looping

c#,xml,xpath,xmldocument,xmlnodelist

If you're happy to convert it into LINQ to XML, it's really simple: XDocument original = ...; // However you load the original document // Separated out for clarity - could be inlined, of course string xpath = "//Person[not(PersonID = following::Person/PersonID)]" XDocument people = new XDocument( new XElement("Persons", original.XPathSelectElements(xpath) )...

XSLT for-each statement not iterating proper amount of times

xml,xslt

Try it this way? <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/template/L"> <html> <body> <ul> <xsl:for-each select="Q"> <li> <xsl:value-of select="text()"/> <ul> <xsl:for-each select="R"> <li> <xsl:value-of select="."/> </li> </xsl:for-each> </ul> </li> </xsl:for-each> </ul> </body> </html> </xsl:template> </xsl:stylesheet> Explanation: When...

xpath query seem to be failing

xml,xpath

$str = '<root><Pages> <copyright>me inc. 2015,</copyright> <author>Me</author> <lastUpdate>2/1/1999</lastUpdate> <Home>--------------------</Home> <About>--------------------</About> <Contact>------------------</Contact> </Pages></root>'; $xml = simplexml_load_string($str); $result = $xml->xpath('//Pages/*[(name() = "Home") or following-sibling::Home]'); if ($result === false) { $this->parseError(); //To return xml Error code...

R readHTMLTable failed to load external entity [duplicate]

xml,r,connection

In the link that I mentioned in the comment, you can find solutions using RCurl and httr package. Here, I provide the solution using rvest package. library(rvest) kk<-html("http://en.wikipedia.org/wiki/List_of_S%26P_500_companies")%>% html_table(fill=TRUE)%>% .[[1]] //table 1 only head(kk) Ticker symbol Security SEC filings GICS Sector GICS Sub Industry Address of Headquarters 1 MMM 3M...

ImageView inside scrollview (Android)

android,xml

use android:fillViewport="true" for scroll view and change ImageView scale type to android:scaleType="fitXY" <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="bottom" > <ScrollView android:id="@+id/scroll" android:fillViewport="true" android:layout_width="fill_parent" android:layout_height="fill_parent"> <RelativeLayout android:id="@+id/relativeLayout1" android:layout_width="match_parent" android:layout_height="match_parent" > <ImageView...

Java XPath returns single result instead of NodeSet

java,xml,dom,xpath

My guess is that you make a mistake while processing the result NodeList. Try the following approach: NodeList results = (NodeList) xpath.evaluate(..); for (int i = 0; i < nodelist.getLength(); i++) { Node node = (Node) nodelist.item(i); ... } ...

XSLT How to remove style from div and td tags

xml,xslt

To remove some nodes start with the identity transformation template <xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template> then add an empty template for the nodes to be removed: <xsl:template xmlns:xhtml="http://www.w3.org/1999/xhtml" match="xhtml:div/@style | xhtml:li/@style | xhtml:td/@style | xhtml:span/@style"/> ...

Remove XML Node text using XSLT

xml,xslt,xslt-2.0

Here's one way: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:strip-space elements="*"/> <!-- identity transform --> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="c"> <xsl:apply-templates/> </xsl:template> </xsl:stylesheet> Here's another:...

How get value from property file to input in springConfig.xml

java,xml,spring-mvc

Look at this line of your stack trace: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mailSender' defined in class path resource [springConfig.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'int' for property 'port'; nested exception is java.lang.NumberFormatException: For input...

Unable to construct Document object from xml string

java,xml,xpath,xml-parsing

As Arthur Elrich pointed out in the comments, you should make the factory namespace aware and provide a namespace context to the XPath instance. DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.parse( new InputSource(new StringReader(...))); XPath xpath = XPathFactory.newInstance().newXPath(); xpath.setNamespaceContext(new MyNamespaceContext()); String s = xpath.evaluate("//location:address/text()",...

How to extract efficientely content from an xml with python?

python,xml,python-2.7,pandas,lxml

There are several things wrong here. (Asking questions on selecting a library is against the rules here, so I'm ignoring that part of the question). You need to pass in a file handle, not a file name. That is: y = BeautifulSoup(open(x)) You need to tell BeautifulSoup that it's dealing...

List view not returning to original state after clearing search

java,android,xml,android-activity,android-listfragment

You are operating on the original data instead of filtered data. You should maintain a reference to original data and use the filtered data for all other purposes. So that the original data is displayed when search is cleared. Replace all usages of mData with mFilteredData as below and only...

odoo v8 - Field(s) `arch` failed against a constraint: Invalid view definition

python,xml,view,odoo,add-on

You have made silly mistake in defining _columns. _colums is not valid dictionary name for fields structure. Replace this by _columns and restart service and update module. ...

Extracting XML data from CLOB

sql,xml,oracle

Use xmltable. Data setup: create table myt( col1 clob ); insert into myt values('<ServiceDetails> <FoodItemDetails> <FoodItem FoodItemID="6486" FoodItemName="CARROT" Quantity="2" Comments="" ServingQuantityID="142" ServingQuantityName="SMALL GLASS" FoodItemPrice="50" ItemDishPriceID="5336" CurrencyName="INR" CurrencyId="43"/> </FoodItemDetails> <BillOption> <BillDetails TotalPrice="22222" BillOption="cash"/> </BillOption> <Authoritativeness/> </ServiceDetails>' ); commit; Query:...

XSL transformation outputting multiple times and other confusion

xml,xslt,xpath

1) Your template is applied to 3 elements, and for each of them, loops over all the parents li elements (yes, for each of them, ask all the li elements, children of the grand-father of the current content, which are all the 3 li elements, each time). 2) Because that's...

About sorting based on the counting of subelements

xml,xslt

You can use a key in order to count the properties in the sort instruction. A stylesheet containing the following: <xsl:key name="p" match="property" use="@agency"/> <xsl:template match="/immo"> <result> <xsl:for-each select="agency"> <xsl:sort select="count(key('p', @name))"/> <res id="{ @name }" count="{ count(key('p', @name)) }"/> </xsl:for-each> </result> </xsl:template> when applied to the following input: <immo>...

Clean and convert HTML to XML for BaseX

html,xml,converter,xquery,basex

BaseX has integration for TagSoup, which will convert HTML to well-formed XHTML. Most distributions of BaseX already bundle TagSoup, if you installed BaseX from a Linux repository, you might need to add it manually (for example, on Debian and Ubuntu it's called libtagsoup-java). Further details for different installation options are...

XML Post from form using curl PHP

php,xml,curl

$data = array( "line1" => "sample data", "line2" => "sample data 2", ); $data_string = json_encode($data); $url = "http://test.com/webservicerequest.asmx"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); // set url to post to curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Content-Length: ' . strlen($data_string))...

HTMLPurifier without XML declaration

php,xml,htmlpurifier

you need cut result string $n = strlen('<?xml encoding="utf-8" ?>'); $content_text_fixHTML = substr($H->purify($content_text), $n); ...

Ruby- get a xml node value

ruby,xml

Try to use css instead of xpath, this will work for you, doc = Nokogiri::XML(response.body) values = doc.css('Name').select{|name| name.text}.join',' puts values => Ram,Sam ...

XSL - iterate through elements and update based on the node index from another xml file

xml,xslt

An XSL transformation that meets your requirement may be like the following: <?xml version="1.0" encoding="utf-16" ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml"/> <!-- the update source file: --> <xsl:param name="usource" select="'updatesource.xml'"/> <xsl:template match="Material"> <!-- Material's position: --> <xsl:variable name="pos"> <xsl:value-of select="count(preceding::Material)+1"/> </xsl:variable>...

type conversion performance optimizable?

c#,xml,csv,optimization,type-conversion

IEnumerable<string> values = new List<string>(); values = … Probably not going to be a big deal, but why create a new List<string>() just to throw it away. Replace this with either: IEnumerable<string> values; values = … If you need values defined in a previous scope, or else just: Enumerable<string> values...

Multiply arrays by arrays in JAVA

java,arrays,xml,permutation

Something like this? import java.util.ArrayList; import java.util.Collections; import java.util.List; public class MatrixCross { public static void cross(String[]... matrix){ cross(0,matrix, Collections.EMPTY_LIST); } private static void cross(int index,String[][] matrix, List<String> result){ if (index >= matrix.length){ System.out.println("<test>"); int i = 1; for (String str : result) { System.out.println(" <test_"+i+">"+str+"</test_"+i+">"); i++; } System.out.println("</test>"); }...

Tagging values in HTML document for automated extraction

html,xml,html5

If you are using them as meta-documents and they are sent to the parser, then converted as HTML and as long as the converted HTMLs do not have any irrelevant tags, it is fine! So, if the following code: <requirement> THE REQUIREMENT HERE </requirement> Gets converted into something like: <!--...

removing a parent node dependig upon child node using xslt

xml,xslt

i want an xslt template which removes the other event node along with child nodes in which other event type value is OriginalCommitDateTime. The standard method to exclude specific nodes is to start with the identity transform template to copy all nodes as the rule, then add an empty...

Parsing XML array using Jquery

javascript,jquery,xml,jquery-mobile

EMI and CustomerName are elements under json so you can use .find() to find those elements and then text() to get its value. $(data).find("json").each(function (i, item) { var heures = $(item).find("CustomerName").text(); var nbr = $(item).find("EMI").text(); console.log(heures); }); .attr() is used to get the attribute value of an element like in...

C# XML: System.InvalidOperationException

c#,xml

Is "User Info" and "Course Data" is a different entity. If it is so, I think you may encapsulate them in one entity. XmlTextWriter writer = new XmlTextWriter(path, System.Text.Encoding.UTF8); writer.WriteStartDocument(true); writer.Formatting = Formatting.Indented; writer.Indentation = 4; writer.WriteStartElement("My Entity"); /* It is a biggest one*/ writer.WriteStartElement("User Info"); writer.WriteStartElement("Name"); writer.WriteString(userName); writer.WriteEndElement(); writer.WriteStartElement("Tutor...

Change attribute value of an XML tag in Qt

c++,xml,qt

I guess, but I think your XML is only present in your memory. You have to trigger somethink like tsFileXml.WriteToFile(filename) to store your changes to a file on your filesystem.

How to calculate max string-length of a node-set?

xml,xslt,xslt-1.0,libxslt

<xsl:variable name="max_a_width"> <xsl:for-each select="data"> <xsl:sort select="string-length(@a)" data-type="number" /> <xsl:if test="position() = last()"> <xsl:value-of select="string-length(@a)" /> </xsl:if> </xsl:for-each> </xsl:variable> This is the general method of picking from an ordered list of derived values in XSLT 1.0. If you want to pick the minimum/maximum from actual (natively sortable) values, you can take...

Create XSD based on root element

java,xml,parsing,xsd

Using XSL 2.0 you can have multiple output documents and can define every file name, file content, etc. Default java support for XSL 2.0 is far from perfect, so I use the incredible Saxon (you can download saxon-he here, unzip it and add saxon9he.jar to your project). This is the...

XElement.Value is stripping XML tags from content

c#,.net,xml,xml-parsing,xelement

As others have said, this format is truly horrible, and will break as soon as the XML embedded in the JSON will contain double quotes (because in the JSON they will be encoded as \", which will make the XML invalid). The JSON should really be embedded as CDATA. Now,...