xml

Can I express "may / may not contain" rules spanning multiple levels in XML Schema?

I have a hierarchy of objects that are transmitted via XML. The hierarchy rules are easy to express in XML Schema by stating which element may contain which child elements. A simplifed example of the XML data would be (the actual object data is contained in attributes and omitted for brevity): <root> <channel> <router> <mess...

Check well-formed XML without a try/catch?

Does anyone know how I can check if a string contains well-formed XML without using something like XmlDocument.LoadXml() in a try/catch block? I currently have code that does this; private bool IsValidXML(string value) { try { // Check we actually have a value if (string.IsNullOrEmpty(value) == false) { ...

XML Canonicalization algorithm gives two difference results when called directly than when called as part of an xml digital signature?

Hi all, I'm getting two different hashes of the same xml document when I directly canonicalize some xml than when I perform a digital signature on it which also performs the same canonicalization algoririth on the xml before hashing it? I worked out that the digital signature canonicalization includes the new line characters '\n' and s...

How can I build XmlDocument with many xml namespaces in a single node?

I'm trying to build XmlDocument so that after serialization I could achieve something like this xml: <?xml version="1.0" encoding="UTF-8"?> <wnio:element xmlns:wnio="somuri" xmlns:xf="abcd"> <xf:nestedelement>somtext</xf:nestedelement> </wnio:element> The things is that XmlElement allows to specify ONLY ONE namespace via NamespaceU...

How do I access deep data in a nested XML structure in Perl using XML::Simple?

I am using XML::Simple and I have the following XML structure in a variable $xmldata which I need to access through Perl code. <root> <a>sfghs</a> <b>agaga</b> <c> <c1>sgsfs</c1> <c2>sgsrsh</c2> </c> <d> <d1>agaga</d1> <d2>asgsg</d2> </d> </root> I can access the value of a and b b...

PHP XML IE problem

<?xml version="1.0" ?> <NBR> <resultGroups> <result>Hello</result> </resultGroups> </NBR> i have a n xml created in PHP ike this. i am retruning this XML into javascript and is trying to acces the value of node "result" using alert($(xmlObj).children('result').text()); In firefox its working fine. but in IE it gives o...

Excel XML Line Breaks within Cell from PHP DOM

I am trying to insert new lines into an Excel XML document. The entity that I need to insert is &#10; but whenever I insert that into PHP DOM, it just converts it to a normal line break. This is what I am getting: <Cell><Data>text text2 </Data></Cell> This is what I want: <Cell><Data>text&#10;text2&#10;</Data></Cell> I cannot figu...

Filter XMLList to nodes/attributes that have a certain namespace prefix

Hi all, This is best explained using an example. I have an xml document that has namespace qualified elements. What I want to do is search the xmlList to see how many namespace qualifier elements and/or attributes there are. So for example some text So for the above xml doc the namespace xsi would have 1 node returned from a search...

why the XML validator gives failed to read error about the existing xds include file

I have the following errors reported in my (scorm 2004) xml file, what is causing this error since the referenced include file imsss_v1p0util.xsd is present in the same folder. row 8 has this tag: < xs:include schemaLocation = "imsss_v1p0util.xsd"/ > parser output: Validating the XML for Wellformedness The XML is Well-formed Valid...

How can you filter a Deeply Nested XML using LINQ (streaming only), while maintaining the Tree Structure?

Hello I would like to know how to stream over a very large, deeply nested, XML Document using LINQ, while streaming it, filter nodes based on some criteria and then write the streamed output to a file, while maintaining the same original structure of the XML. This should happen without loading the entire document into memory. Is this ...

Sub-elements and namespaces in XSD

I've been trying to figure out how to use an XML Schema to validate XML files as I load them into an application. I've got that part working, but I can't seem to get the schema to recognise anything other than the root element as valid. For instance, I have the following XML file: <fun xmlns="http://ttdi.us/I/am/having/fun" xmlns...

Unmarshaling xml with html entities using JAXB

I need to load wikipedia revision histories into POJOs, so I'm using JAXB to unmarshall the wikipeida data dump (well, individual pages of it). The problem is that the text nodes occasionally contain entities that are not defined in the wikipedia xml dump. eg: (`&deg;' pleases keep in mind that I do not know the complete set of entiti...

convert an xs:float value to a hex-string representation of its binary value

using xsl 2.0, how would you convert an xs:float value to a hex-string representation of its binary value? i have no problem doing this for an integer (divide by 16 recursively and concatenate chars 0-9A-F), but float/double is stumping me. <xsl:function name="my:float-to-hex" as="xs:string"> <xsl:param name="in" as="xs:float"/> ...

Get rid of xml root node in xsl template output

Thank you all for the help ahead of time. I am using XSL Templates to serve as web page templates for a web framework, the end output being XHTML 1.0 Strict; it takes xml input and outputs the XHTML. It works perfectly except for 1 problem - the end output is also outputting a xml node instead of just the contents. Here is the basic xml...

Why can't RSS handle the Ampersand?

This is something I've been wondering for a while now. I'll occasionally come across an RSS feed that is broken, and blown to pieces all because line 23 say "Sanford & Sons." The most confusing thing is the fact that if you convert the & into &amp;, all is well, even though your alternative still contains the problem-char! Please somebo...

XML Representation of C++ Objects

I'm trying to create a message validation program and would like to create easily modifiable rules that apply to certain message types. Due to the risk of the rules changing I've decided to define these validation rules external to the object code. I've created a basic interface that defines a rule and am wondering what the best way to...

How to convert XML to JSON in C++?

I came across How to convert XML to JSON in ASP.NET C# (link) and one in javascript (at goessner.net/download/prj/jsonxml/). But have yet to find one in c++ that takes just a string as input (Or a tinyxml node as I'm using that library). ...

Unescape _xHHHH_ XML escape sequences using Python

I'm using Python 2.x [not negotiable] to read XML documents [created by others] that allow the content of many elements to contain characters that are not valid XML characters by escaping them using the _xHHHH_ convention e.g. ASCII BEL aka U+0007 is represented by the 7-character sequence u"_x0007_". Neither the functionality that allow...

what means "The matching wildcard is strict"

Validating the XML against the Controlling Documents ERROR: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'adlcp:datafromlms'. line: 21, col: 24 here is error line in my xml file: < adlcp:datafromlms>course=e7.txt;lesson=1< /adlcp:datafromlms> this is from XSD: ...

Digitally Sign Parts of a XML document

I have an XML document having structure similar to the following <envelop> <header>blaa</header> <message>blaa blaa</message> <footer></footer> </envelop> I want to digitally sign the header and message elements and add the signature to the footer element. How can I sign the elements and then later verify the signature (...