Read XML with TAG, PHP

Estou louco pesquisando and não I get to check em uma conclusão. Precise fazer to leitura do XML abaixo. How do I access information?

<? php
$ arq = & # 39;



ENVIO_LOTE_GUIAS
2014-12-22
11:15:01
& # 39 ;;

$ sxe = new SimpleXMLElement ($ arq);

$ namespaces = $ sxe-> getNamespaces (true);
var_dump ($ namespaces);
?>

I have this return of error:

Warning: SimpleXMLElement :: __ construct (): Entity: line 8: analyzer error: premature end of the data in the cabecalho tag line 3 in C:  xampp  htdocs  test  index.php in line 12

Warning: SimpleXMLElement :: __ construct ():  in C:  xampp  htdocs  test  index.php on line 12

Warning: SimpleXMLElement :: __ construct (): ^ in C:  xampp  htdocs  test  index.php on line 12

Warning: SimpleXMLElement :: __ construct (): Entity: line 8: analyzer error: premature end of the data in the mensagemTISS label line 2 in C:  xampp  htdocs  test  index.php in line 12

Warning: SimpleXMLElement :: __ construct ():  in C:  xampp  htdocs  test  index.php on line 12

Warning: SimpleXMLElement :: __ construct (): ^ in C:  xampp  htdocs  test  index.php on line 12

Fatal error: Exception not detected & # 39; Exception & # 39; with the message & # 39; The string could not be analyzed as XML & # 39; in C:  xampp  htdocs  test  index.php: 12 Stack tracking: # 0 C:  xampp  htdocs  test  index. php (12): SimpleXMLElement -> __ construct (& # 39; <? xml version = "... & # 39;) # 1 {main} in C:  xampp  htdocs  test  index.php on the line 12

Why does loading the SVG in the media library fail if the file does not have an XML tag at the beginning?

I have enabled SVG uploads using this code:

add_filter (& # 39; upload_mimes & # 39 ;, function ($ mimes) {
$ mimos['svg'] = & # 39; image / svg + xml & # 39 ;;
returns $ mimes;
});

However, the SVG file loads that start with the the label fails with the usual "Sorry, this type of file is not allowed for security reasons". error that WordPress displays when SVG uploads are not supported.

If I add To the file, just before the opening. label, the load is successful.

Why is the XML tag required? Is this requirement in WordPress normal or is there a problem with my configuration?

sql server – sp_whoisactive @get_locks error xml parameter

I often receive this error when I execute the following command

sp_whoisactive @get_locks = 1

Msg 6841, Level 16, State 1, Procedure sp_WhoIsActive, Line 4287 FOR XML could not serialize the data for the node & # 39; Lock / @ resource_description & # 39; because it contains a character (0x0001) that is not allowed in XML. To retrieve this data using FOR XML, convert it to binary, varbinary or image data and use the BINARY BASE64 directive. Warning: the null value is eliminated by an addition or another SET operation. & # 39;

I think it is related to the capture of the xml of the locks that remain, however, I realize that it happens frequently. Is there a way to avoid this or is it a known problem? Running SQL Server 2012, and the latest version v11.32 of sp_whoisactive.

View of the XML source: the exposed filter is case-sensitive

I have a Drupal 8 view that uses XML as a data source.

I have exposed established filters in the XML text of the XML elements Y .

The exposed filters work, but they are case sensitive. Then, & # 39; Michael & # 39; it works but & # 39; michael & # 39; do not. In Drupal 7, the default behavior was not case sensitive with a check box option "Strict Comparison". That behavior has changed in Drupal 8.

How do I get these exposed filters insensitive to uppercase and lowercase? Alter entry?

Drupal 8 view of the XML source: the exposed filter is case-sensitive

I have a Drupal 8 view that uses XML as a data source.

I have exposed established filters in the XML text of the XML elements Y .

The exposed filters work, but they are case sensitive. Then, & # 39; Michael & # 39; it works but & # 39; michael & # 39; do not. In Drupal 7, the default behavior was not case sensitive with a check box option "Strict Comparison". That behavior has changed in Drupal 8.

How do I get these exposed filters insensitive to uppercase and lowercase? Alter entry?

xml – c # – System.OutOfMemory Exception

I am making an importer of an XML file to insert directly into the database, the fields are always equal to this type of XML so no large validation is necessary only in certain fields.

I have done several tests, it has always been good but when importing an XML file of 10 MB, with 600 clients that gives System.OutOfMemory Exception to "client 60".

Being that in other tests he completed 200 clients without any problem.

I'm "inexperienced" in this area, I needed a little help.

namespace Saft_Import
{
public class class ImportSAFT: CustomForm
{
public Import Import ()
{
InitializeComponent ();
}

Client list

ClientClient = newClientList ();
List of products
ProductProduct = newProductList ();

int i = 0;

// variables for indefOf
int inic = 0;
int final = 0;

// how many users are there
int interexiste = 0;

// customers
string s;

int wordCount = 0;
int wordProd = 0;


private async void btnImportar_Click (sender object, EventArgs e)
{


try
{
(OpenFileDialog ofd = new OpenFileDialog () {Filter = "Filter documents | * .xml", Multiselect = false, ValidateNames = true})
{
if (ofd.ShowDialog () == DialogResult.OK)
{
(StreamReader sr = new StreamReader (ofd.FileName, System.Text.Encoding.GetEncoding ("iso-8859-1"))))
{
// receives the value of the xml and passes to s.

s = Waitit sr.ReadToEndAsync ();
Variable.Text = await sr.ReadToEndAsync ();

// s = xmlValue.Text ?? "empty text";
s = s.Replace ("& # 39;", "& # 39; & # 39; & # 39;);


foreach (Match m in Regex.Matches (s, ""))
{
wordcount ++;
}
foreach (Match n in Regex.Matches (s, ""))
{
wordProd ++;
}

MessageBox.Show ("There is" + Convert.ToString (wordCount + 1) + "clients");
// initialize costumer

NovoCostumer ();
DbClients ();


NovoProduto ();
MessageBox.Show ("There is" + Convert.ToString (wordProd + 1) + "products");
ProdutosDB ();
// connection to database with while




xmlValue.Text = "";
Variable.Text = "";

}
}
}
}



catch (ex Exception)
{
MessageBox.Show (ex.Message, "message", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}

private void DbClients ()
{
list listClients = new list();
Client list.Add (CLI);
of
{
if (wordCount> i)
{
ImportClients ();
}




(var db = new SqlConnection ())
{


string connectionString;
SqlConnection cnn;

/ * Connection to the local database - Server name - Name db - id and Password * /
(in the event of an error in the system).

// open the database of the database.
cnn = new SqlConnection (connectionString);
cnn.Open ();

SqlCommand check_User_Name = new SqlCommand ("SELECT COUNT (*) FROM clients WHERE (client = & # 39;" + cli.CostumerID + "& # 39;)", cnn);
int UserExist = (int) check_User_Name.ExecuteScalar ();


if (UserExist> 0)
{
// Client exists

userexiste ++;

}
other
{
// Client does not exist.
if (wordCount> i)
{

SqlCommand cmdinsert = new SqlCommand (@ "INSERT INTO Clients (Client, Name, FiscalName, NumContrib, Fac_Mor, Fac_Lo, Fac_Cp, Fac_CploC, Fac_Cel, Fac_Tel, Fac_Fax) values ​​(& # 39;" + cli.CostumerID + "& # 39 ;, & # 39; "+ cli.CompanyName + +" "," "+ cli.CompanyName +" & # 39;, & # 39; "+ cli.CostumerTaxID +" & # 39;, & # 39 ; "+ cli.BillAdress +" & # 39;, "+ cli.City +" & # 39;, "+ cli.PostalCode +" +, "," + "," + "," "," + "," + "," + "," + "," + ".
// execute the query (cminsert) to insert in the bd, and close the connection db.
cmdinsert.ExecuteNonQuery ();
}
}

cnn.Close ();
}
xmlValue.Text + = " r  n val i" + i;
i ++;
if (i <wordCount)
{
NovoCostumer ();
}

} while (i <= wordCount);
            i = 0;
            wordCount = 0;
            MessageBox.Show("SAFT Importado e já existiam " + Convert.ToString(userexiste) + " clientes na base de dados");
            userexiste = 0;
        }

        private void ProdutosDB()
        {
            do
            {
                if (wordProd > i)
{
ImportProdutos ();
}

(var db = new SqlConnection ())
{


string connectionString;
SqlConnection cnn;

/ * Connection to the local database - Server name - Name db - id and Password * /
(in the event of an error in the system).

// open the database of the database.
cnn = new SqlConnection (connectionString);
cnn.Open ();

SqlCommand check_Product_Name = new SqlCommand ("SELECT COUNT (*) FROM article WHERE (article = & # 39;" + prod.codProduct + "& # 39;)", cnn);
int ProductExist = (int) check_Product_Name.ExecuteScalar ();


if (ProductExist> 0)
{

userexiste ++;

}
other
{

if (wordProd> i)
{
SqlCommand check_User_Name = new SqlCommand ("SELECT COUNT (*) FROM Article Types WHERE (TypeArticle = & # 39;" + prod.typeProduct + "& # 39;)", cnn);
int ProdExists = (int) check_User_Name.ExecuteScalar ();


(ProdExists <= 0)
{
SqlCommand cmdTipoArt = new SqlCommand (@ "INSERT INTO TypesArticle (TypeArticle, Description) values ​​(& # 39;" + prod.typeProduct + "& # 39 ;, & # 39;" + prod.typeProduct + "& # 39 ;), cnn);
cmdTypeArt.ExecuteNonQuery ();
}
/ * else
{
SqlCommand cmdTipoArt = new SqlCommand (@ "INSERT INTO TypesArticle (TypeArticle, Description) values ​​(& # 39;" + prod.typeProduct + "& # 39 ;, & # 39;" + prod.typeProduct + "& # 39 ;), cnn);
cmdTypeArt.ExecuteNonQuery ();
} * /

if (prod.famProducto.Equals ("Without family"))
{
prod.famProduct = "NULL";
}
string UN = "UN";
int Iva = 23;
Variable.Text + = " r  n" + prod.typeProduct;
Variable.Text + = " r  n" + prod.codProduct;
Variable.Text + = " r  n" + prod.produtDescr;
Variable.Text + = " r  n" + prod.famProduct;

SqlCommand cmdProductos = new SqlCommand (@ "INSERT INTO Article (TypeArticle, Article, Description, Iva, UnitBase) values ​​(& # 39;" + prod.typeProduct + "& # 39 ;, & # 39;" + prod. ProductCode + "& # 39 ;, & # 39;" + prod.produtDescr "+," + "+" +, "+" + "+" "), Cnn);
// execute the query (cminsert) to insert in the bd, and close the connection db.
cmdProdutos.ExecuteNonQuery ();
}


}

cnn.Close ();
}

i ++;
if (i <wordProd)
{
NovoProduto ();
}


} while (i <wordProd);
i = 0;
wordProd = 0;
MessageBox.Show ("SAFT Imported and already existed" + Convert.ToString (userexiste) + "Products in the database");
userexiste = 0;
list listProducts = new List();
listaProdutos.Add (prod);

}




private void ImportProducts ()
{
Produced Type ();
ProductCode ();
ProductGroup ();
ProductDescript ();
ProductNumberCode ();
}

private void ProductNumberCode ()
{
inic = prod.producto.IndexOf ("")" + "".Length;
final = prod.producto.IndexOf ("");
prod.prodNumbercode = prod.product.Substring (start, end - start);
xmlValue.Text + = " r  n left the numberCd";
}

private void ProductDescript ()
{
inic = prod.producto.IndexOf ("")" + "".Length;
final = prod.producto.IndexOf ("");
prod.produtDescr = prod.product.Substring (start, end - start);
xmlValue.Text + = " r  n left novdescric";
}


private void ProductGroup ()
{
inic = prod.producto.IndexOf ("")" + "".Length;
final = prod.producto.IndexOf ("");
prod.famProduct = prod.product.Substring (start, end - start);
xmlValue.Text + = " r  n left the groupProdct";
}

private void ProductCode ()
{
inic = prod.producto.IndexOf ("")" + "".Length;
final = prod.producto.IndexOf ("");
prod.codProduct = prod.product.Substring (start, end - start);
xmlValue.Text + = " r  n left the product Code";
}

private void ProductType ()
{
inic = prod.producto.IndexOf ("")" + "".Length;
// xmlValue.Text + = " r  n left the" + inic;
final = prod.producto.IndexOf ("");
// xmlValue.Text + = " r  n left the" + end;
prod.typeProduct = prod.product.Substring (start, end - start);
// xmlValue.Text + = " r  n out of the TipoProduto";

}

private void NewProduct ()
{
inic = s.IndexOf ("")" + "".Length;
//xmlValue.Text + = " r  n quit" + inic;

final = s.IndexOf ("");
// xmlValue.Text + = " r  n come out" + end;
prod.product = s.Substring (start, end - start);
s = s.Replace (""+ prod.product +"",");
// xmlValue.Text + = " r  n left the new Product1";
}

private void ImportClients ()
{
// costumer ID -
CostumerIDs ();


// Company name
NomeCompanies ();


// CostumerTaxID
CostumerTaxes ();


// AddressBilling
AdressBill ();

// removeBillAdress
RemoveBillAdress ();


// ShipToAddress
ShipAdress ();

// Tele
The telecommunications companies ();

// Fax
Fax machines ();

// Web page
Website ();

// email
Email ();

}

private void Email ()
{
(cli.Costumer.Contains ("") == true)
{
inic = cli.Costumer.IndexOf ("")" + "".Length;
final = cli.Costumer.IndexOf ("");
cli.email = cli.Costumer.Substring (start, end - start);
}
}

private void Website ()
{
(cli.Costumer.Contains ("") == true)
{
inic = cli.Costumer.IndexOf ("")" + "".Length;
final = cli.Costumer.IndexOf ("");
cli.website = cli.Costumer.Substring (start, end - start);
}
}

private void ShipAdress ()
{
/ * int Ship = Costumer.IndexOf ("")" + "".Length;
int finalShipAddressDetail = Costumer.IndexOf ("");
string ShiplAdress = Costumer.Substring (Ship, finalShipAddressDetail - Ship);
Variable.Text + = (" r  n" + ShiplAdress) ?? "empty text";
// city
int ciudad2 = Costumer.IndexOf ("")" + "".Length;
int finalCidad2 = Costumer.IndexOf ("");
string City2 = Costumer.Substring (city2, finalCity2 - city2);
Variable.Text + = (" r  n" + City) ?? "empty text";
// Postal Code
int Postal2 = Costumer.IndexOf ("")" + "".Length;
int finalPostal2 = Costumer.IndexOf ("");
string PostalCode2 = Costumer.Substring (Postal2, finalPostal2 - Postal2);
Variable.Text + = (" r  n" + PostalCode2) ?? "empty text";
// Country
int Country2 = Costumer.IndexOf ("")" + "".Length;
int finalPais2 = Costumer.IndexOf ("");
string Country2 = Costumer.Substring (Pais2, finalPais2 - Pais2); * /
}

private void NewCostumer ()
{


inic = s.IndexOf ("")" + "".Length;
final = s.IndexOf ("");
// xmlValue.Text + = " r  n" + Convert.ToString ((final - init));
cli.Costumer = s.Substring (start, end - start);
// xmlValue.Text + = " r  n left the costumer";
s = s.Replace (""+ cli.Costumer +"",");

}

private void Faxs ()
{
(cli.Costumer.Contains ("") == true)
{
inic = cli.Costumer.IndexOf ("")" + "".Length;
final = cli.Costumer.IndexOf ("");
cli.Fax = cli.Costumer.Substring (start, end - start);
}
}

private void Teles ()
{

(cli.Costumer.Contains ("") == true)
{
inic = cli.Costumer.IndexOf ("")" + "".Length;
final = cli.Costumer.IndexOf ("");
cli.telephone = cli.Costumer.Substring (start, end - start);
//variavel.Text + = (" r  n" + phone) ?? "empty text";
}
}

private void RemoveBillAdress ()
{
inic = cli.Costumer.IndexOf ("")" + "".Length;
final = cli.Costumer.IndexOf ("");
cli.RemoveBillingAdress = cli.Costumer.Remove (start, end - start);
}

private void AdressBill ()
{

(cli.Costumer.Contains ("") == true)
{
inic = cli.Costumer.IndexOf ("")" + "".Length;
final = cli.Costumer.IndexOf ("");
cli.BillAdress = cli.Costumer.Substring (Convert.ToInt32 (init), Convert.ToInt32 (final - init));
// variable.Text + = (" r  n" + BillAdress) ?? "empty text";
// city
inic = cli.Costumer.IndexOf ("")" + "".Length;
final = cli.Costumer.IndexOf ("");
cli.City = cli.Costumer.Substring (Convert.ToInt32 (init), Convert.ToInt32 (final - init));
// variable .Text + = (" r  n" + City) ?? "empty text";
// Postal Code
inic = cli.Costumer.IndexOf ("")" + "".Length;
final = cli.Costumer.IndexOf ("");
cli.PostalCode = cli.Costumer.Substring (Convert.ToInt32 (init), Convert.ToInt32 (final - init));
// variable.Text + = (" r  n" + PostalCode) ?? "empty text";
// Country
inic = cli.Costumer.IndexOf ("")" + "".Length;
final = cli.Costumer.IndexOf ("");
cli.Country = cli.Costumer.Substring (start, (end - start));
// variable.Text + = (" r  n" + Country) ?? "empty text";
}
}

Private void CostumerTaxes ()
{

(cli.Costumer.Contains ("") == true)
{
inic = cli.Costumer.IndexOf ("")" + "".Length;

final = cli.Costumer.IndexOf ("");

cli.CostumerTaxID = cli.Costumer.Substring ((init), (final - init));
// variable.Text + = (" r  n" + CostumerTaxID) ?? "empty text";
}
}

private void CompanyName ()
{
inic = cli.Costumer.IndexOf ("")" + "".Length;
final = cli.Costumer.IndexOf ("");
cli.CompanyName = cli.Costumer.Substring (start, end - start);
}

private void CostumerID ()
{
inic = cli.Costumer.IndexOf ("")" + "".Length;

final = cli.Costumer.IndexOf ("");

cli.CostumerID = cli.Costumer.Substring (start, end - start);
cli.CostumerID = cli.CostumerID.Substring (0, 11);
}


}
}

Should the versions of the document library be enabled when storing XML files?

Should the versions of the document library be enabled when storing XML files? I know the advantages of turning it on for MS Office documents. Does it do any good to activate it for XML files and folders?

c # – Error signing xml passing the PIN automatically

I have this code that selects the certificate according to the last serial:

public static X509Certificate2Collection Select Certificate (serial string)
{
X509Store store = new X509Store (StoreName.My, StoreLocation.CurrentUser);
var Key = new RSACryptoServiceProvider ();
store.Open (OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
X509Certificate2Collection collection = store.Certificates;
X509Certificate2Collection fcollection = collection.Find (X509FindType.FindBySerialNumber, serial, true);

return fcollection;
}

And that part here in the signature, to pass the password automatically:

    SignedXml firmXml = new SignedXml (doc);


KeyInfo keyInfo = new KeyInfo ();

//signedXml.SigningKey = x509Cert.PrivateKey;
keyInfo.AddClause (new KeyInfoX509Data (x509Cert));
RSACryptoServiceProvider Key = new RSACryptoServiceProvider ();
Key = (System.Security.Cryptography.RSACryptoServiceProvider) x509Cert.PrivateKey;
firmXml.SigningKey = Key;
firmXml.KeyInfo = keyInfo;
firmXml.SigningKey = Certificates.LerDevice (Key, PIN);
firmXml.SignedInfo.SignatureMethod = SignedXml.XmlDsigRSASHA1Url;
reference.DigestMethod = SignedXml.XmlDsigSHA1Url;

But what happens, when I have two certificates on my machine, it returns the invalid password. I have changed the passwords to remain the same, but in this case it does not return an invalid PIN error, but it is signed with the wrong certificate, which returns another error.
It's as if the query I'm doing will not be worth anything.

This is the function LerDevice ()

public static RSACryptoServiceProvider ReadDevice (RSACryptoServiceProvider key, PIN string)
{
CspParameters csp = new CspParameters (key.CspKeyContainerInfo.ProviderType, key.CspKeyContainerInfo.ProviderName);
SecureString ss = new SecureString ();
foreach (char a in PIN)
{
ss.AppendChar (a);
}
csp.ProviderName = key.CspKeyContainerInfo.ProviderName;
csp.ProviderType = key.CspKeyContainerInfo.ProviderType;
csp.KeyNumber = key.CspKeyContainerInfo.KeyNumber == KeyNumber.Exchange? 1: 2;
csp.KeyContainerName = key.CspKeyContainerInfo.KeyContainerName;
csp.KeyPassword = ss;
csp.Flags = CspProviderFlags.NoPrompt | CspProviderFlags.UseDefaultKeyContainer;

RSACryptoServiceProvider rsa = new RSACryptoServiceProvider (csp);
return rsa;
}

I've already tried line by line, I've changed some things, and it still happens. If you only have one certificate connected, it works perfectly, everything indicates that you take the first certificate in alphabetical order, because when I am signing the other certificate it does not return the problem.

laravel – XML ​​Sitemap could not be recovered for approximately 2 months

I'm really fed up now. I'm trying to make my XML site map read in the Search Console, but for the past 1 month it says it can not be recovered. Every time I send the index of the site map, it is sent with a status of success, but the "State of the last reading" is approximately 5 months.

After clicking on it to see the other sub sitemaps, only three of them are searched by Google and the rest have a status that could not be recovered.

These are site maps generated dynamically in Laravel.

I also tried the manually created site map but the error "could not be recovered" is still returned.

Please help me rectify the problem.

enter the description of the image here

enter the description of the image here

How to add XMl block to a design using Php

I created a block in my custom module and generated an XML code for my block as …


     
         
           
                slider_title
                Latest FME products
          
                slider_description
                Here are the latest products for you
          
          
                slider_limit_products
                12
          
         
     

now what I want to do this I want to add this block to my current design, so I create an observer

core_layout_render

Where can I get My current design name, all I want to do now is that I want to add this block to my current design using PHP

How I can get this