FAQ Database Discussion Community


c# remove string with quotes from string [duplicate]

c#,string,url,xml-namespaces
This question already has an answer here: Can I escape a double quote in a verbatim string literal? 5 answers I have a string, containing XML namespace, and I cant seem to remove this part xmlns="http://www.rar.org/xyz/" I've tried return textWriter.ToString().Replace(@"xmlns="http://www.rar.org/xyz/"", ""); but this does not compile....

how to suppress namespace prefix with Qt5.4 QXmlStreamWriter

xml,qt,qt5,xml-namespaces,qt5.4
I have this dictionary.xml: <?xml version="1.0" encoding="UTF-8"?> <DictionarySet xmlns:mc="urn:fmosoft-map-creator" xmlns="urn:fmosoft-map-creator" Version="1"> <Dictionary SourceLanguage="en_US" SourceLanguageIsPredefined="true" TargetLanguage="es" TargetLanguageIsPredefined="true"> <Translation Source="asdf" Target="fdsa"/> <Translation Source="xyz" Target="jkl"/> </Dictionary> <Dictionary SourceLanguage="en_US" SourceLanguageIsPredefined="true" TargetLanguage="pt"...

Unexpected End of Stream while trying to tokenise sparql query

rdf,sparql,xml-namespaces
i have this my rdf file and i try to get all triples from specific namespace 'ns1' <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:ns1="http://www.w3.org/TR/rdf-schema/#" xmlns:property="http://www.SyrianDNA.com/property#" xmlns:info="http://www.SyrianDNA.com/info#"> <rdf:Description rdf:about="http://www.SyrianDNA.com/resource/monuments"> <ns1:be rdf:resource="http://www.SyrianDNA.com/resource/Syria"/>...

Python: specifying the namespace in an lxml.etree path

python,xml,svg,lxml,xml-namespaces
I'm trying to figure out how to access a specific element by id in an SVG file. I was using the python library of lxml to parse through the file, but it always comes up empty. Here is the python script I used to access the element: #!/usr/bin/env python from...

XML XInclude looses namespace in included nodes

xml,xml-namespaces,xsd-validation,xinclude
I'm trying to use namespaces on a xml file composed by more files. XML Schema <?xml version="1.0" encoding="utf-8"?> <xsd:schema version="1.0" attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:mynamespace" targetNamespace="urn:mynamespace"> <xsd:element name="main_element" type="typeMainElement" /> <xsd:complexType name="typeMainElement"> <xsd:sequence> <xsd:element name="inner_element" type="typeInnerElement" />...

XPath Evaluation fails while using with AutoPilot in VTD-XML

java,xml,xpath,xml-namespaces,vtd-xml
I have a bunch of xml's which contains elements's with namespaces and i am using VTD-XML to parse that xml. But when i tries to use an xpath to get a namespaced element. It will not fetch at all? Here is the xml sample <startQuery logLinkID="797ca6afb7a32458:1619f4f5:14d8fa72127:-7ff5" modelName="SampleModel" tracerString="tracer:: std.Page1.Pane1"> <xql:XQL...

Warning: The page /welcome.xhtml declares namespace http://primefaces.prime.org/ui but no TagLibrary associated to namespace

jsf,jsf-2,primefaces,xml-namespaces
I'm trying to make a project with primefaces but i can't make it work , the tags are not being rendered. Here is what i've got: Problem : welcome.xhtml : <html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.prime.org/ui" xmlns:ui="http://java.sun.com/jsf/facelets" > <h:head> <title>Ejemplo</title> <link rel="stylesheet" type="text/css" href="css/styles.css"/> </h:head> <h:body> <center>...

Namespace and no namespace tag in the same XML is according with the W3C recommendation?

xml,xml-namespaces,w3c
See the example XML below: <?xml version="1.0"?> <request serviceName="MyService" xmlns:model="http://me.myself.com/model"> <model:user>USER</model:user> <model:pass>PASS</model:pass> <package>PackageNumber</package> <types>Float</types> I know that this XML is correctly parsed and valid. I also know that the <user> and <pass> tags has the namespace "model" and the other tags has no namespace (or namespace denoted by the empty...

Reference C# type within XML schema?

c#,xml,namespaces,xml-namespaces
Is it possible to reference types within a C# project in an XML Schema file? For validation and intelli-sense I mean... Lets say I have the following: namespace Example { class myType { int test = 0; } } How would I reference the Example namespace within the schema file...

XML validation: why is explicitly specifying a namespace not allowed in this case?

xml,validation,xsd,xml-namespaces
Given the following XSD: <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:foo="urn:foo" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:foo" version="3.0"> <xsd:complexType name="Something"> <xsd:sequence> <xsd:element name="Nested" type="foo:NestedType"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="NestedType" /> </xsd:schema> The following XML is valid: <ns:Something xmlns:ns="urn:foo" xsi:type="ns:Something"...

Query for unique id with XDocument

c#,xml,linq,linq-to-xml,xml-namespaces
I have the following XML name Sample.xml which I am trying to query uniqueID with XDocument: <Request> <Person xmlns="http://CompanyName.AppName.version1" uniqueID="3221"> <AccountNo>83838</AccountNo> <FirstName>Tom</FirstName> <LastName>Jackson</LastName> </Person> <Person xmlns="http://CompanyName.AppName.version1" uniqueID="21132"> <AccountNo>789875</AccountNo> <FirstName>Chris</FirstName> <LastName>Smith</LastName>...

Can we change the XML namespace variable name in JDOM?

xml,xml-parsing,xml-namespaces,jdom,jdom-2
I've an XML: <OTC_RM xmlns="OTC_RM_11-0" xmlns:ns2="http://www.fpml.org/2010/FpML-4-9"> I wish to change the namespace variable name from ns2 to something else say fp using JDOM. And the change should reflect all across the XML document. Is it possible?...

JAXB - Move dynamically generated namespaces to document root

java,xml,jaxb,xml-namespaces
I've got this POJO, encapsulating a dynamic, non-nested element of an Atom entry: public class SimpleElement { private Namespace namespace; private String tagName; private String value; private Collection<Attribute> attributes; /* getters/setters/... */ And for completeness, Attribute public class Attribute { private String name; private String value; private Namespace namespace; /*...

Require xml namespace prefix on attribute in child node

c#,xml,powershell,namespaces,xml-namespaces
I am attempting to make modifications to a ClickOnce deployment manifest. One thing I need to do is setup the manifest to deploy an icon to the desktop. To do this you need to add the createDesktopShortcut attribute with a true value to the Deployment node. For Example, this is...

Adding default namespace conditionally using xslt

xml,xslt,namespaces,xml-namespaces,ibm-datapower
Requirement: Check whether a default namespace declaration xmlns="http://www.origoservices.com present in the request xml. If not, add the default namespace declaration. Sample Request xml 1: <message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <m_control> <control_timestamp>2014-11-05T09:30:38.308</control_timestamp> <retry_number>0</retry_number> <expected_response_type>synchronous</expected_response_type> <responder_id>Exchange Life 1</responder_id>...

Axiom OMElement generates child with empty default name space

xml,xml-parsing,xml-namespaces,axiom
Hi this is what i do for generating an xml code: OMFactory factory = OMAbstractFactory.getOMFactory(); OMNamespace nsSequence = factory.createOMNamespace("http://ws.apache.org/ns/synapse", ""); OMElement rootSequence = factory.createOMElement("sequence",nsSequence); /*<FILTER>*/ OMNamespace nsFilter = factory.createOMNamespace("http://org.apache.synapse/xsd", "ns"); OMElement filter = factory.createOMElement("filter",nsFilter); OMAttribute regex = factory.createOMAttribute("regex", null, "applID"); OMAttribute source =...

C#, XML: move second namespace to root element

c#,xml,xsd,xml-namespaces
I am trying to create an XML document, using the System.XML.XmlDocument Class. I have two namespaces in my document. What my C# code looks like: XmlDocument xDoc = new XmlDocument(); xDoc.InsertBefore(xDoc.CreateXmlDeclaration("1.0","UTF-8","yes"),xDoc.DocumentElement); XmlElement root = xDoc.CreateElement('ROOT','http://example.org/ns1'); xDoc.AppendChild(root); XmlElement child1 = xDoc.CreateElement('CHILD1','http://example.org/ns1'); root.AppendChild(child1); XmlElement child2 =...

Unable to remove empty xmlns attribute from XElement using c#

c#,xml,linq-to-xml,xml-namespaces,xmlns
Before posting this question I have tried all other solution on stack, but with no success. I am unable to remove empty xmlns attribute from XElement using C#, I have tried the following Codes. XElement.Attributes().Where(a => a.IsNamespaceDeclaration).Remove(); Another one which postted here foreach (var attr in objXMl.Descendants().Attributes()) { var elem...

XML Namespace URI with HTTPS?

xml,xml-parsing,schema,uri,xml-namespaces
Is it better to have a xmlns URI with https protocol? For example this is the recommended way by the manual: <http xmlns="http://www.springframework.org/schema/security"/> Is it legal and better to use this way? <http xmlns="https://www.springframework.org/schema/security"/> Are there XML parsers that try to connect to an address defined by xmlns URI? Parsers...

What happens, if I place a xmlns:f=“foo” inside the body?

html,html5,xml-namespaces
Assume this HTML5 page: <!DOCTYPE html> <html> <head><!-- some content --></head> <body> <div id="a" xmlns:f="http://exampleurl.jp/"> <a href="#">test</a> </div> </body> </html> This question includes the fact, that the namespace f is not used inside the document and http://exampleurl.jp/ is not reachable. Will browsers ... be ready for usage of that namespace...

Treat same tag, different namespace as the same

xml,xslt,xslt-1.0,xml-namespaces
I'm working on a project where I have xml files that contain html child nodes; some have the xmlns="http://www.w3.org/1999/xhtml" attribute, some do not. (in a previous process, a script checks the html sections for well-formedness, and uses htmltidy to clean them up if they need it) is there anyway for...

What is the XML namespace URI of Spring Message Facelets tag?

jsf,xml-namespaces,taglib,spring-faces
According to those tutorials about i18n in SpringFaces: http://www.javacodegeeks.com/2012/06/spring-jsf-integration.html https://coderphil.wordpress.com/2011/11/15/integrating-spring-javaserver-faces-internationalization-and-localization/ We should be able to use Spring messageSource bean directly in XHTML Page using <s:messageSource> tag: <s:messageSource source="#{messageSource}" var="messages"/> <p> <h:outputText value="#{messages.hello}"/> </p> </s:messageSource> However, those tutorials does...

Remove automatically applied namespace in php's SimpleXML

php,xml,dom,soap,xml-namespaces
I am trying to create a SOAP request for a paypal express checkout with SimpleXML. However, I am experiencing a behaviour I don't yet understand. The envelope and its header are generated this way: $envelope = new \SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:ebay:apis:eBLBaseComponents" xmlns:ns2="urn:ebay:api:PayPalAPI" /> '); $header = $envelope->addChild('SOAP-ENV:Header'); $requesterCredentials...

Can't select descendant nodes despite not having namespaces declared on them

c#,xml,xml-namespaces,xmldocument
I'm trying to read some XML: <?xml version="1.0" encoding="UTF-8"?> <gesmes:Envelope xmlns:gesmes="http://www.gesmes.org/xml/2002-08-01" xmlns="http://www.ecb.int/vocabulary/2002-08-01/eurofxref"> <gesmes:subject>Reference rates</gesmes:subject> <gesmes:Sender> <gesmes:name>European Central Bank</gesmes:name> </gesmes:Sender> <Cube> <Cube time='2015-02-23'> <Cube currency='USD' rate='1.1298'/> <Cube currency='JPY' rate='134.50'/> <Cube currency='BGN'...

XML Namespaces, Schema validation(XSD) and XSLT

xml,xslt,xsd,xml-namespaces
I have a XML file with the following structure: <?xml version="1.0" encoding="utf-8" ?> <?xml-stylesheet type="text/xsl" href="studentsStylesheet.xsl"?> <students xmlns="urn:students"> <student> ... </student> </students> A XSD schema: <?xml version="1.0" encoding="utf-8"?> <xs:schema targetNamespace="urn:students" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="students"> ... </xs:element> </xs:schema> And a XSL file for...

Modify namespaced XML using JavaScript with jQuery

javascript,jquery,xml,xml-namespaces
I have a namespaced XML document what must bu signed using special browser plugin. Here is the peace code, that sign document: var oCertificate = GetCertificateBySubjectName(certificateName); var token = oCertificate.Export(CADESCOM_ENCODE_BASE64); var element, xmlDoc; xmlDoc = $.parseXML(doc.toString()); element = $(xmlDoc).find("o\\:BinarySecurityToken"); element.text(token); var xmlString = undefined; if (window.ActiveXObject) { xmlString = xmlDoc[0];...

Namespace removal for modified element in XSL

xml,xslt-1.0,xml-namespaces
I am having a input XML, in which one elements schema got changed. So as per the new schema, I renamed it. Now for that particular element, I am getting an extra namespace in the output XML. I used exclude prefixes, but it didnot removed. I want only that particular...

How to map a XML ignoring namespace using JAXB?

java,xml,jaxb,xml-namespaces,unmarshalling
I'm receiving a XML from a web service with the following format: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <string xmlns="http://someurl.com">somethingheresomethinghere</string> And I'm trying to unmarshall this to a POJO that looks like this: @XmlRootElement(name="string") public class StringValue { @XmlValue private String value; public StringValue () { } } And my unmarshalling code...

Extract the data from clob data type xml value

sql,xml,oracle,xml-namespaces
I have the following xml value which is stored in the request_xml column and which is clob data type: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body> <ns:updateRechargeTicketResponse xmlns:ns="http://service.soap.CDRator.com"> <ns:return xmlns:ax232="http://core.result.service.soap.CDRator.com/xsd" xmlns:ax233="http://core.data.soap.CDRator.com/xsd" xmlns:ax230="http://payment.result.service.soap.CDRator.com/xsd"...

Parsing XML with undeclared prefixes in Python

python,xml,parsing,namespaces,xml-namespaces
I am trying to parse XML data with Python that uses prefixes, but not every file has the declaration of the prefix. Example XML: <?xml version="1.0" encoding="UTF-8"?> <item subtype="bla"> <thing>Word</thing> <abc:thing2>Another Word</abc:thing2> </item> I have been using xml.etree.ElementTree to parse these files, but whenever the prefix is not properly declared,...

Namespace prefix NS1 for href on %tagElement% is not defined, setAttributeNS

svg,safari,namespaces,xml-namespaces,setattribute
I got this error in safari while trying to convert svg to base64 url via code: $svgCopy = $('svg').clone() html = $('<div>').append($svgCopy).html() imgSrc = 'data:image/svg+xml;base64,' + btoa(html) imgEl.src = imgSrc The problem is that when you set attribute with NS (setAttributeNS) safari sets NS\d+ namespace and do not sets xmlns:NS\d+...

Query for all elements of a specific name with XMLDocument

c#,xml,linq,linq-to-xml,xml-namespaces
I have the following XML name Sample.xml which I am trying to query accountNo with XDocument: <Request xmlns="http://CompanyName.AppName.version1"> <Person> <AccountNo>83838</AccountNo> <FirstName>Tom</FirstName> <LastName>Jackson</LastName> </Person> <Person> <AccountNo>789875</AccountNo> <FirstName>Chris</FirstName> <LastName>Smith</LastName> </Person> Using below code in C# i am able to fetch Account no of first person XDocument xmlDoc...

Undefined namespace xml2 in R

xml,r,xpath,xml-namespaces
I'm learning how to use R to parse XML, and I'm trying to use Hadley's Wickham's xml2 package to parse a TEI XML text document, located here (warning: this is a zipped file, the particular one I'm trying to parse is given in the code below). I'm trying to get...

Rewrite XMLDocument to use namespace prefix

c#,xml,xml-namespaces
I have a XMLDocument which, when I save to file, repeats a namespace on most of the elements, as in <Test> <Test xmlns="http://example.com/schema1"> <Name xmlns="http://example.com/schema2">xyz</Name> <AddressInfo xmlns="http://example.com/schema2"> <Address>address</Address> <ZipCode>zzzz</ZipCode> </AddressInfo> ... Is it possible to amend this file so that it uses a namespace prefix throughout the document, ie something...

How to specify xml namespace is SVG for ui-router partial templates?

angularjs,svg,angular-ui-router,xml-namespaces
for the first time I have not found any solution to a problem I am encountering while developing a web app with AngularJS and UI-router. The issue : partial templates made of SVG elements are not created within the correct namespace and therefore are not displayed on some browsers -...

How can I strip namespaces out of an lxml tree?

python,xml,lxml,xml-namespaces,prefix
Following on from Removing child elements in XML using python ... Thanks to @Tichodroma, I have this code: If you can use lxml, try this: import lxml.etree tree = lxml.etree.parse("leg.xml") for dog in tree.xpath("//Leg1:Dog", namespaces={"Leg1": "http://what.not"}): parent = dog.xpath("..")[0] parent.remove(dog) parent.text = None tree.write("leg.out.xml") Now leg.out.xml looks like this: <?xml...

Deserializing a single element in a large XML document: xmlSerializer.Deserialize(xmlReader.ReadSubtree()) fails due to namespace issues

c#,xml,xml-namespaces,xmlreader,xmlserializer
I am attempting to process a large XML document (using a XmlReader) in a single pass, and deserialize only certain elements in it using an XmlSerializer. Below is some code and a tiny mock XML document showing how I have attempted to do this. Rationale for using XmlReader: 1. I...

XML: let child-node inherit parent-node namespace?

c#,xml,xpath,xml-namespaces
I'm trying to create some xml nodes runtime using XPath for C#. See XML Below: <Package xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest" xmlns="http://schemas.microsoft.com/appx/2010/manifest"> <Application> <m2:VisualElements> <!--- INSERT CHILD NODES HERE WHICH ALSO HAVE NAMESPACE 'm2' ----> </m2:VisualElements> </Application> </Package> Currently I'm doing the following: XElement visualElements = doc.Descendants().SingleOrDefault(p => p.Name.LocalName == "VisualElements");...